BitmapDataFactoryCreateBitmapData(Int32, Int32, KnownPixelFormat, WorkingColorSpace, Color32, Byte) Method

Creates an IReadWriteBitmapData instance with the specified width, height 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.2.0
C#
public static IReadWriteBitmapData CreateBitmapData(
	int width,
	int height,
	KnownPixelFormat pixelFormat,
	WorkingColorSpace workingColorSpace,
	Color32 backColor = default,
	byte alphaThreshold = 128
)

Parameters

width  Int32
The width of the bitmap data to create in pixels.
height  Int32
The height of the bitmap data to create in pixels.
pixelFormat  KnownPixelFormat
The desired pixel format of the bitmap data to create.
workingColorSpace  WorkingColorSpace
Specifies the preferred color space that should be used when working with the result bitmap data.
See the Remarks section of the WorkingColorSpace enumeration for more details.
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 dimensions and pixelFormat.

Exceptions

ArgumentOutOfRangeExceptionwidth or height is zero or negative
-or-
pixelFormat is not one of the valid formats.
-or-
workingColorSpace is not one of the defined values.

See Also