BitmapDataFactoryCreateBitmapData(Size, KnownPixelFormat, Color32, Byte) Method

Creates an IReadWriteBitmapData instance with the specified size and pixelFormat.
See the Remarks section of the CreateBitmapData(Size, KnownPixelFormat, WorkingColorSpace, Color32, Byte) overload for details.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.0.0
C#
public static IReadWriteBitmapData CreateBitmapData(
	Size size,
	KnownPixelFormat pixelFormat = KnownPixelFormat.Format32bppArgb,
	Color32 backColor = default,
	byte alphaThreshold = 128
)

Parameters

size  Size
The size of the bitmap data to create in pixels.
pixelFormat  KnownPixelFormat  (Optional)
The desired pixel format of the bitmap data to create. This parameter is optional.
Default value: Format32bppArgb.
backColor  Color32  (Optional)
For pixel formats without alpha gradient support specifies the BackColor value of the returned IReadWriteBitmapData instance. It does not affect the actual returned bitmap content. See the Remarks section for details. The alpha value (Color32.A field) of the specified background color is ignored. This parameter is optional.
Default value: The default value of the Color32 type, which has the same RGB values as Black.
alphaThreshold  Byte  (Optional)
For pixel formats without alpha gradient support specifies the AlphaThreshold value of the returned IReadWriteBitmapData instance. See the Remarks section for details. This parameter is optional.
Default value: 128.

Return Value

IReadWriteBitmapData
An IReadWriteBitmapData instance with the specified size and pixelFormat.

Exceptions

ArgumentOutOfRangeExceptionsize has a zero or negative width or height
-or-
pixelFormat is not one of the valid formats.

See Also