BitmapDataFactoryCreateBitmapDataT(T, Int32, CustomIndexedBitmapDataConfig) Method

Creates an IReadWriteBitmapData instance with a custom indexed pixel format for a preallocated two-dimensional array with the specified parameters.
See the Remarks section of the CreateBitmapDataT(T, Size, Int32, CustomIndexedBitmapDataConfig) 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<T>(
	T[,] buffer,
	int pixelWidth,
	CustomIndexedBitmapDataConfig customBitmapDataConfig
)
where T : struct, new()

Parameters

buffer  T
A preallocated array to be used as the underlying buffer for the returned IReadWriteBitmapData.
pixelWidth  Int32
The width of the bitmap data to create in pixels.
customBitmapDataConfig  CustomIndexedBitmapDataConfig
The configuration for the custom pixel format. Either the getter or the setter delegate must be specified. If you can ensure that the delegates don't capture buffer make sure you set the BackBufferIndependentPixelAccess property to .

Type Parameters

T
The type of the elements in buffer.

Return Value

IReadWriteBitmapData
An IReadWriteBitmapData instance wrapping the specified buffer and using the provided parameters.

Exceptions

ArgumentNullExceptionbuffer or customBitmapDataConfig is .
ArgumentOutOfRangeExceptionpixelWidth is too large for the specified buffer and PixelFormat.
ArgumentExceptionbuffer is empty
-or-
Palette in customBitmapDataConfig is too large for the specified PixelFormat
-or-
PixelFormat in customBitmapDataConfig is not indexed or its BitsPerPixel is not between 1 and 16.
-or- Neither the getter nor the setter delegate is specified in customBitmapDataConfig.

See Also