BitmapDataFactoryCreateBitmapData(Int32, Int32, KnownPixelFormat, Palette) Method

Creates an IReadWriteBitmapData instance with the specified width, height, 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(
	int width,
	int height,
	KnownPixelFormat pixelFormat,
	Palette? palette
)

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.
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 dimensions, pixelFormat and palette.

Exceptions

ArgumentOutOfRangeExceptionwidth or height is zero or negative
-or-
pixelFormat is not one of the valid formats.
ArgumentExceptionpalette is too large for the specified pixelFormat.

See Also