BitmapDataExtensionsToTransparent(IReadableBitmapData) 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
)

Parameters

bitmapData  IReadableBitmapData
The IReadableBitmapData to convert to transparent.

Return Value

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

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

  Note

This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. You can use the ToTransparent(IReadableBitmapData, ParallelConfig) overload to configure these, while still executing the method synchronously. Alternatively, use the BeginToTransparent(IReadableBitmapData, AsyncConfig) or ToTransparentAsync(IReadableBitmapData, TaskConfig) (in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.

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