BitmapExtensionsClear(Bitmap, Color, Color, Byte) Method
Namespace: KGySoft.DrawingAssembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 9.2.0
public static void Clear(
this Bitmap bitmap,
Color color,
Color backColor = default,
byte alphaThreshold = 128
)
<ExtensionAttribute>
Public Shared Sub Clear (
bitmap As Bitmap,
color As Color,
Optional backColor As Color = Nothing,
Optional alphaThreshold As Byte = 128
)
public:
[ExtensionAttribute]
static void Clear(
Bitmap^ bitmap,
Color color,
Color backColor = Color(),
unsigned char alphaThreshold = 128
)
[<ExtensionAttribute>]
static member Clear :
bitmap : Bitmap *
color : Color *
?backColor : Color *
?alphaThreshold : byte
(* Defaults:
let _backColor = defaultArg backColor new Color()
let _alphaThreshold = defaultArg alphaThreshold 128
*)
-> unit
- bitmap Bitmap
- The Bitmap to be cleared.
- color Color
- A Color that represents the desired result color of the bitmap.
- backColor Color (Optional)
- If bitmap cannot have alpha or has only single-bit alpha, and color is not fully opaque, then specifies the color of the background.
If color has alpha and it is considered opaque, then it will be blended with backColor to determine the color of the cleared bitmap.
The Color.A property of the background color is ignored. This parameter is optional.
Default value: Empty, which has the same RGB values as Black. - alphaThreshold Byte (Optional)
- If bitmap has only single-bit alpha or its palette contains a transparent color,
then specifies a threshold value for the Color.A property, under which the specified color is considered transparent. If 0,
then the cleared bitmap will not be transparent. This parameter is optional.
Default value: 128.
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).
This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. Use the
BitmapDataExtensions.BeginClear
or
BitmapDataExtensions.ClearAsync (in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.