BitmapDataExtensionsToTransparent(IReadableBitmapData, ParallelConfig) Method

Returns a new IReadWriteBitmapData, which is the clone of the specified bitmapData with transparent background.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
C#
public static IReadWriteBitmapData? ToTransparent(
	this IReadableBitmapData bitmapData,
	ParallelConfig? parallelConfig
)

Parameters

bitmapData  IReadableBitmapData
The IReadableBitmapData to convert to transparent.
parallelConfig  ParallelConfig
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.

Return Value

IReadWriteBitmapData
An IReadWriteBitmapData, which is the clone of the specified bitmapData with transparent background, or , if the operation was 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 IReadableBitmapData. 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

This method uses the bottom-left pixel to determine the background color, which must be completely opaque; otherwise, just an exact clone of bitmapData will be returned.

This method always returns a new IReadWriteBitmapData that has a pixel format with alpha support.

To attempt to make an IReadWriteBitmapData transparent without creating a new instance use the MakeTransparent method.

To force replacing even non-completely opaque pixels use the ToTransparent(IReadableBitmapData, Color32) overload instead.

  Note

Please note that unlike the MakeOpaque method, this one changes exactly one color shade without any tolerance.

See Also