BitmapExtensionsGetReadableBitmapData Method

KGy SOFT Drawing Libraries Help
Gets an IReadableBitmapData instance, which provides fast read-only access to the actual data of the specified bitmap. The bitmap can have any PixelFormat.
See the Remarks section of the GetReadWriteBitmapData method for details and examples.

Namespace:  KGySoft.Drawing
Assembly:  KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 5.2.0
Syntax

public static IReadableBitmapData GetReadableBitmapData(
	this Bitmap bitmap,
	Color backColor = null,
	byte alphaThreshold = 128
)

Parameters

bitmap
Type: System.DrawingBitmap
A Bitmap instance, whose data is about to be accessed.
backColor (Optional)
Type: System.DrawingColor
For the GetReadableBitmapData method affects indexed bitmaps only when GetColorIndex and GetNearestColor methods are called with an alpha color on the Palette property of the returned IReadableBitmapData instance. Queried colors with alpha, which are considered opaque will be blended with this color before performing a lookup. The alpha value (Color.A property) of the specified background color is ignored. This parameter is optional.
Default value: Color.Empty, which has the same RGB values as Black.
alphaThreshold (Optional)
Type: SystemByte
For the GetReadableBitmapData method affects indexed bitmaps only when GetColorIndex and GetNearestColor methods are called with an alpha color on the Palette property of the returned IReadableBitmapData instance. In such case determines the lowest alpha value of a color, which should not be considered as transparent. If 0, then a color lookup will never return a transparent color. This parameter is optional.
Default value: 128.

Return Value

Type: IReadableBitmapData
An IReadableBitmapData instance, which provides fast read-only access to the actual data of the specified bitmap.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Bitmap. 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).
See Also

Reference