BitmapDataFactoryCreateBitmapData(Size, KnownPixelFormat, Palette) Method

Creates an IReadWriteBitmapData instance with the specified size, pixelFormat and palette.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.2.0
C#
public static IReadWriteBitmapData CreateBitmapData(
	Size size,
	KnownPixelFormat pixelFormat,
	Palette? palette
)

Parameters

size  Size
The size of the bitmap data to create in pixels.
pixelFormat  KnownPixelFormat
The desired pixel format of the bitmap data to create.
palette  Palette
If pixelFormat represents an indexed format, then specifies the desired Palette of the returned IReadWriteBitmapData instance. It determines also the BackColor and AlphaThreshold properties of the result.

Return Value

IReadWriteBitmapData
An IReadWriteBitmapData instance with the specified size, pixelFormat and palette.

Exceptions

ArgumentOutOfRangeExceptionsize has a zero or negative width or height
-or-
pixelFormat is not one of the valid formats.
ArgumentExceptionpalette is too large for the specified pixelFormat.

See Also