@@ -13,20 +13,20 @@ public static class MagicImageProcessor
13
13
14
14
private static void checkInStream ( Stream imgStream )
15
15
{
16
- if ( imgStream == null ) throw new ArgumentNullException ( nameof ( imgStream ) ) ;
16
+ if ( imgStream is null ) throw new ArgumentNullException ( nameof ( imgStream ) ) ;
17
17
if ( ! imgStream . CanSeek || ! imgStream . CanRead ) throw new ArgumentException ( "Input Stream must allow Seek and Read" , nameof ( imgStream ) ) ;
18
18
if ( imgStream . Length <= 0 || imgStream . Position >= imgStream . Length ) throw new ArgumentException ( "Input Stream is empty or positioned at its end" , nameof ( imgStream ) ) ;
19
19
}
20
20
21
21
private static void checkOutStream ( Stream outStream )
22
22
{
23
- if ( outStream == null ) throw new ArgumentNullException ( nameof ( outStream ) ) ;
23
+ if ( outStream is null ) throw new ArgumentNullException ( nameof ( outStream ) ) ;
24
24
if ( ! outStream . CanSeek || ! outStream . CanWrite ) throw new ArgumentException ( "Output Stream must allow Seek and Write" , nameof ( outStream ) ) ;
25
25
}
26
26
27
27
public static ProcessImageResult ProcessImage ( string imgPath , Stream outStream , ProcessImageSettings settings )
28
28
{
29
- if ( imgPath == null ) throw new ArgumentNullException ( nameof ( imgPath ) ) ;
29
+ if ( imgPath is null ) throw new ArgumentNullException ( nameof ( imgPath ) ) ;
30
30
checkOutStream ( outStream ) ;
31
31
32
32
using ( var ctx = new WicProcessingContext ( settings ) )
@@ -65,7 +65,7 @@ public static ProcessImageResult ProcessImage(Stream imgStream, Stream outStream
65
65
66
66
public static ProcessImageResult ProcessImage ( IPixelSource imgSource , Stream outStream , ProcessImageSettings settings )
67
67
{
68
- if ( imgSource == null ) throw new ArgumentNullException ( nameof ( imgSource ) ) ;
68
+ if ( imgSource is null ) throw new ArgumentNullException ( nameof ( imgSource ) ) ;
69
69
checkOutStream ( outStream ) ;
70
70
71
71
using ( var ctx = new WicProcessingContext ( settings ) )
@@ -78,7 +78,7 @@ public static ProcessImageResult ProcessImage(IPixelSource imgSource, Stream out
78
78
79
79
public static ProcessingPipeline BuildPipeline ( string imgPath , ProcessImageSettings settings )
80
80
{
81
- if ( imgPath == null ) throw new ArgumentNullException ( nameof ( imgPath ) ) ;
81
+ if ( imgPath is null ) throw new ArgumentNullException ( nameof ( imgPath ) ) ;
82
82
83
83
var ctx = new WicProcessingContext ( settings ) ;
84
84
var dec = new WicDecoder ( imgPath , ctx ) ;
@@ -108,18 +108,16 @@ public static ProcessingPipeline BuildPipeline(Stream imgStream, ProcessImageSet
108
108
109
109
public static ProcessingPipeline BuildPipeline ( IPixelSource imgSource , ProcessImageSettings settings )
110
110
{
111
- if ( imgSource == null ) throw new ArgumentNullException ( nameof ( imgSource ) ) ;
111
+ if ( imgSource is null ) throw new ArgumentNullException ( nameof ( imgSource ) ) ;
112
112
113
113
var ctx = new WicProcessingContext ( settings ) ;
114
114
var dec = new WicDecoder ( imgSource , ctx ) ;
115
115
buildPipeline ( ctx , false ) ;
116
116
return new ProcessingPipeline ( ctx ) ;
117
117
}
118
118
119
- public static ProcessImageResult ExecutePipeline ( this ProcessingPipeline pipeline , Stream outStream )
120
- {
121
- return executePipeline ( pipeline . Context , outStream ) ;
122
- }
119
+ public static ProcessImageResult ExecutePipeline ( this ProcessingPipeline pipeline , Stream outStream ) =>
120
+ executePipeline ( pipeline . Context , outStream ) ;
123
121
124
122
private static void buildPipeline ( WicProcessingContext ctx , bool outputPlanar = true )
125
123
{
@@ -136,7 +134,7 @@ private static void buildPipeline(WicProcessingContext ctx, bool outputPlanar =
136
134
bool savePlanar = outputPlanar
137
135
&& ctx . Settings . SaveFormat == FileFormat . Jpeg
138
136
&& ctx . Settings . InnerRect == ctx . Settings . OuterRect
139
- && ctx . SourceColorContext == null ;
137
+ && ctx . SourceColorContext is null ;
140
138
141
139
WicTransforms . AddExifRotator ( ctx ) ;
142
140
WicTransforms . AddPlanarCache ( ctx ) ;
0 commit comments