@@ -134,7 +134,7 @@ IInternalImageProcessingContext<TPixel> operationsRunner
134
134
/// <exception cref="ArgumentNullException">The operation is null.</exception>
135
135
/// <exception cref="ObjectDisposedException">The source has been disposed.</exception>
136
136
/// <exception cref="ImageProcessingException">The processing operation failed.</exception>
137
- public static Image ? Clone ( this Image source , Action < IImageProcessingContext > operation )
137
+ public static Image Clone ( this Image source , Action < IImageProcessingContext > operation )
138
138
=> Clone ( source , source . GetConfiguration ( ) , operation ) ;
139
139
140
140
/// <summary>
@@ -149,7 +149,7 @@ IInternalImageProcessingContext<TPixel> operationsRunner
149
149
/// <exception cref="ObjectDisposedException">The source has been disposed.</exception>
150
150
/// <exception cref="ImageProcessingException">The processing operation failed.</exception>
151
151
/// <returns>The new <see cref="Image"/>.</returns>
152
- public static Image ? Clone ( this Image source , Configuration configuration , Action < IImageProcessingContext > operation )
152
+ public static Image Clone ( this Image source , Configuration configuration , Action < IImageProcessingContext > operation )
153
153
{
154
154
Guard . NotNull ( configuration , nameof ( configuration ) ) ;
155
155
Guard . NotNull ( source , nameof ( source ) ) ;
@@ -158,7 +158,7 @@ IInternalImageProcessingContext<TPixel> operationsRunner
158
158
159
159
ProcessingVisitor visitor = new ( configuration , operation , false ) ;
160
160
source . AcceptVisitor ( visitor ) ;
161
- return visitor . ResultImage ;
161
+ return visitor . GetResultImage ( ) ;
162
162
}
163
163
164
164
/// <summary>
@@ -274,14 +274,16 @@ private class ProcessingVisitor : IImageVisitor
274
274
275
275
private readonly bool mutate ;
276
276
277
+ private Image ? resultImage ;
278
+
277
279
public ProcessingVisitor ( Configuration configuration , Action < IImageProcessingContext > operation , bool mutate )
278
280
{
279
281
this . configuration = configuration ;
280
282
this . operation = operation ;
281
283
this . mutate = mutate ;
282
284
}
283
285
284
- public Image ? ResultImage { get ; private set ; }
286
+ public Image GetResultImage ( ) => this . resultImage ! ;
285
287
286
288
public void Visit < TPixel > ( Image < TPixel > image )
287
289
where TPixel : unmanaged, IPixel < TPixel >
@@ -290,7 +292,7 @@ public void Visit<TPixel>(Image<TPixel> image)
290
292
this . configuration . ImageOperationsProvider . CreateImageProcessingContext ( this . configuration , image , this . mutate ) ;
291
293
292
294
this . operation ( operationsRunner ) ;
293
- this . ResultImage = operationsRunner . GetResultImage ( ) ;
295
+ this . resultImage = operationsRunner . GetResultImage ( ) ;
294
296
}
295
297
}
296
298
}
0 commit comments