BitmapDataFactoryCreateBitmapDataT(ArraySectionT, Size, Int32, CustomIndexedBitmapDataConfig) Method

Creates an IReadWriteBitmapData instance with a custom indexed pixel format wrapping the specified buffer and using 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>(
	ArraySection<T> buffer,
	Size size,
	int stride,
	CustomIndexedBitmapDataConfig customBitmapDataConfig
)
where T : struct, new()

Parameters

buffer  ArraySectionT
An ArraySection<T> to be used as the underlying buffer for the returned IReadWriteBitmapData. It can be larger than it is required for the specified parameters.
size  Size
The size of the bitmap data to create in pixels.
stride  Int32
The size of a row in bytes. It allows to have some padding at the end of each row.
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 is Null
-or-
customBitmapDataConfig is .
ArgumentOutOfRangeExceptionsize has a zero or negative width or height
-or-
stride is too small for the specified width and PixelFormat.
ArgumentExceptionbuffer is too small for the specified size, PixelFormat and stride
-or-
stride is not a multiple of the size of T
-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