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: 8.1.0
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

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 with Format32bppArgb pixel format.

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.

See Also