BitmapDataExtensionsTransformColors(IReadWriteBitmapData, FuncColor64, Color64, ParallelConfig) Method

Transforms the colors of this bitmapData using the specified transformFunction delegate.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.2
C#
public static bool TransformColors(
	this IReadWriteBitmapData bitmapData,
	Func<Color64, Color64> transformFunction,
	ParallelConfig? parallelConfig = null
)

Parameters

bitmapData  IReadWriteBitmapData
The IReadWriteBitmapData to be transformed.
transformFunction  FuncColor64, Color64
The transform function to be used on the colors of the specified bitmapData. It must be thread-safe.
parallelConfig  ParallelConfig  (Optional)
The configuration of the operation such as parallelization, cancellation, reporting progress, etc. When Progress is set in this parameter, then this library always passes a DrawingOperation instance to the generic methods of the IAsyncProgress interface. If , then the degree of parallelization is configured automatically. This parameter is optional.
Default value: .

Return Value

Boolean
, if the operation completed successfully.
, if the operation has been canceled and the ThrowIfCanceled property of the parallelConfig parameter was .

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IReadWriteBitmapData. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

If bitmapData has an indexed PixelFormat and it supports setting the Palette, then its palette entries will be transformed instead of the actual pixels. Though for indexed formats it's preferred to use the TransformColors(IReadWriteBitmapData, FuncColor32, Color32) overload instead.

On multi-core systems transformFunction might be called concurrently so it must be thread-safe.

Exceptions

ArgumentNullExceptionbitmapData or transformFunction is .

See Also