Note
For information about the possible usable PixelFormats on different platforms see the Remarks section of the ConvertPixelFormat method.
public static IReadWriteBitmapData GetReadWriteBitmapData(
this Bitmap bitmap,
Color backColor = default,
byte alphaThreshold = 128
)
<ExtensionAttribute>
Public Shared Function GetReadWriteBitmapData (
bitmap As Bitmap,
Optional backColor As Color = Nothing,
Optional alphaThreshold As Byte = 128
) As IReadWriteBitmapData
public:
[ExtensionAttribute]
static IReadWriteBitmapData^ GetReadWriteBitmapData(
Bitmap^ bitmap,
Color backColor = Color(),
unsigned char alphaThreshold = 128
)
[<ExtensionAttribute>]
static member GetReadWriteBitmapData :
bitmap : Bitmap *
?backColor : Color *
?alphaThreshold : byte
(* Defaults:
let _backColor = defaultArg backColor new Color()
let _alphaThreshold = defaultArg alphaThreshold 128
*)
-> IReadWriteBitmapData
All possible PixelFormats are supported, of which a Bitmap can be created in the current operating system.
If alphaThreshold is zero, then setting a fully transparent pixel in a bitmap with indexed or single-bit-alpha pixel format will blend the pixel to set with backColor even if the bitmap can handle transparent pixels.
If alphaThreshold is 1, then the result color of setting a pixel of a bitmap with indexed or single-bit-alpha pixel format will be transparent only if the color to set is completely transparent (has zero alpha).
If alphaThreshold is 255, then the result color of setting a pixel of a bitmap with indexed or single-bit-alpha pixel format will be opaque only if the color to set is completely opaque (its alpha value is 255).
If a pixel of a bitmap without alpha gradient support is set by the IWritableBitmapData.SetPixel/IWritableBitmapDataRow.SetColor methods or by the IReadWriteBitmapDataRow indexer, and the pixel has an alpha value that is greater than alphaThreshold, then the pixel to set will be blended with backColor.