@@ -35,7 +35,7 @@ public Image(uint width, uint height) : this(width, height, Color.Black) { }
3535 ////////////////////////////////////////////////////////////
3636 public Image ( uint width , uint height , Color color ) : base ( sfImage_createFromColor ( width , height , color ) )
3737 {
38- if ( CPointer == IntPtr . Zero )
38+ if ( IsInvalid )
3939 {
4040 throw new LoadingFailedException ( "image" ) ;
4141 }
@@ -50,7 +50,7 @@ public Image(uint width, uint height, Color color) : base(sfImage_createFromColo
5050 ////////////////////////////////////////////////////////////
5151 public Image ( string filename ) : base ( sfImage_createFromFile ( filename ) )
5252 {
53- if ( CPointer == IntPtr . Zero )
53+ if ( IsInvalid )
5454 {
5555 throw new LoadingFailedException ( "image" , filename ) ;
5656 }
@@ -71,7 +71,7 @@ public Image(Stream stream) :
7171 CPointer = sfImage_createFromStream ( adaptor . InputStreamPtr ) ;
7272 }
7373
74- if ( CPointer == IntPtr . Zero )
74+ if ( IsInvalid )
7575 {
7676 throw new LoadingFailedException ( "image" ) ;
7777 }
@@ -96,7 +96,7 @@ public Image(byte[] bytes) :
9696 {
9797 pin . Free ( ) ;
9898 }
99- if ( CPointer == IntPtr . Zero )
99+ if ( IsInvalid )
100100 {
101101 throw new LoadingFailedException ( "image" ) ;
102102 }
@@ -133,7 +133,7 @@ public Image(Color[,] pixels) :
133133 }
134134 }
135135
136- if ( CPointer == IntPtr . Zero )
136+ if ( IsInvalid )
137137 {
138138 throw new LoadingFailedException ( "image" ) ;
139139 }
@@ -159,7 +159,7 @@ public Image(uint width, uint height, byte[] pixels) :
159159 }
160160 }
161161
162- if ( CPointer == IntPtr . Zero )
162+ if ( IsInvalid )
163163 {
164164 throw new LoadingFailedException ( "image" ) ;
165165 }
@@ -356,7 +356,7 @@ public void FlipVertically()
356356 ////////////////////////////////////////////////////////////
357357 public override string ToString ( )
358358 {
359- if ( CPointer == IntPtr . Zero )
359+ if ( IsInvalid )
360360 return MakeDisposedObjectString ( ) ;
361361
362362 return $ "[Image] Size({ Size } )";
0 commit comments