BitmapDataFactoryCreateBitmapDataT(T, Int32, CustomBitmapDataConfig) Method

Creates an IReadWriteBitmapData instance with a custom non-indexed pixel format for a preallocated two-dimensional array with the specified parameters.
See the Remarks section of the CreateBitmapDataT(T, Size, Int32, CustomBitmapDataConfig) 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,
	CustomBitmapDataConfig 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  CustomBitmapDataConfig
The configuration for the custom pixel format. At least one getter or 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.
-or-
WorkingColorSpace in customBitmapDataConfig is not one of the defined values.
ArgumentExceptionbuffer is empty
-or-
PixelFormat in customBitmapDataConfig is indexed or its BitsPerPixel is 0.
-or- None of the pixel getter/setter delegates are specified in customBitmapDataConfig.

See Also