FreeImageBitmap Constructor (Int32, Int32, Int32, PixelFormat, Byte[])

FreeImage.NET

FreeImageBitmap Constructor (Int32, Int32, Int32, PixelFormat, Byte)
Initializes a new instance of the FreeImageBitmap class bases on the specified size, pixel format and pixel data.

Namespace: FreeImageAPI
Assembly: FreeImageNET (in FreeImageNET.dll) Version: 3.17.0.4 (3.17.0)
Syntax
C#
public FreeImageBitmap(
	int width,
	int height,
	int stride,
	PixelFormat format,
	byte[] bits
)

Parameters

width
Type: SystemInt32
The width, in pixels, of the new FreeImageBitmap.
height
Type: SystemInt32
The height, in pixels, of the new FreeImageBitmap.
stride
Type: SystemInt32
Integer that specifies the byte offset between the beginning of one scan line and the next. This is usually (but not necessarily) the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) multiplied by the width of the bitmap. The value passed to this parameter must be a multiple of four..
format
Type: System.Drawing.ImagingPixelFormat
The PixelFormat enumeration for the new FreeImageBitmap.
bits
Type: SystemByte
Array of bytes containing the bitmap data.
Exceptions
ExceptionCondition
ExceptionThe operation failed.
ArgumentExceptionformat is invalid.
ArgumentOutOfRangeExceptionwidth or height are less or equal zero.
ArgumentNullExceptionbits is null
Remarks
Although this constructor supports creating images in both formats Format32bppPArgb and Format64bppPArgb, bitmaps created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA images respectively. Currently, there is no support for automatic premultiplying images in FreeImageBitmap.
See Also