@@ -35,7 +35,7 @@ public Image(uint width, uint height) : this(width, height, Color.Black) { }
35
35
////////////////////////////////////////////////////////////
36
36
public Image ( uint width , uint height , Color color ) : base ( sfImage_createFromColor ( width , height , color ) )
37
37
{
38
- if ( CPointer == IntPtr . Zero )
38
+ if ( IsInvalid )
39
39
{
40
40
throw new LoadingFailedException ( "image" ) ;
41
41
}
@@ -50,7 +50,7 @@ public Image(uint width, uint height, Color color) : base(sfImage_createFromColo
50
50
////////////////////////////////////////////////////////////
51
51
public Image ( string filename ) : base ( sfImage_createFromFile ( filename ) )
52
52
{
53
- if ( CPointer == IntPtr . Zero )
53
+ if ( IsInvalid )
54
54
{
55
55
throw new LoadingFailedException ( "image" , filename ) ;
56
56
}
@@ -71,7 +71,7 @@ public Image(Stream stream) :
71
71
CPointer = sfImage_createFromStream ( adaptor . InputStreamPtr ) ;
72
72
}
73
73
74
- if ( CPointer == IntPtr . Zero )
74
+ if ( IsInvalid )
75
75
{
76
76
throw new LoadingFailedException ( "image" ) ;
77
77
}
@@ -96,7 +96,7 @@ public Image(byte[] bytes) :
96
96
{
97
97
pin . Free ( ) ;
98
98
}
99
- if ( CPointer == IntPtr . Zero )
99
+ if ( IsInvalid )
100
100
{
101
101
throw new LoadingFailedException ( "image" ) ;
102
102
}
@@ -133,7 +133,7 @@ public Image(Color[,] pixels) :
133
133
}
134
134
}
135
135
136
- if ( CPointer == IntPtr . Zero )
136
+ if ( IsInvalid )
137
137
{
138
138
throw new LoadingFailedException ( "image" ) ;
139
139
}
@@ -159,7 +159,7 @@ public Image(uint width, uint height, byte[] pixels) :
159
159
}
160
160
}
161
161
162
- if ( CPointer == IntPtr . Zero )
162
+ if ( IsInvalid )
163
163
{
164
164
throw new LoadingFailedException ( "image" ) ;
165
165
}
@@ -356,7 +356,7 @@ public void FlipVertically()
356
356
////////////////////////////////////////////////////////////
357
357
public override string ToString ( )
358
358
{
359
- if ( CPointer == IntPtr . Zero )
359
+ if ( IsInvalid )
360
360
return MakeDisposedObjectString ( ) ;
361
361
362
362
return $ "[Image] Size({ Size } )";
0 commit comments