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)

Syntax

C#
public FreeImageBitmap(
	int width,
	int height,
	int stride,
	PixelFormat format,
	IntPtr scan0
)
Visual Basic (Declaration)
Public Sub New ( _
	width As Integer, _
	height As Integer, _
	stride As Integer, _
	format As PixelFormat, _
	scan0 As IntPtr _
)
Visual C++
public:
FreeImageBitmap(
	int width, 
	int height, 
	int stride, 
	PixelFormat format, 
	IntPtr scan0
)

Parameters

width
Type: System..::.Int32
The width, in pixels, of the new FreeImageBitmap.
height
Type: System..::.Int32
The height, in pixels, of the new FreeImageBitmap.
stride
Type: System..::.Int32
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.Imaging..::.PixelFormat
The PixelFormat enumeration for the new FreeImageBitmap.
scan0
Type: System..::.IntPtr
Pointer to an array of bytes that contains the pixel data.

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.

Exceptions

ExceptionCondition
System..::.ExceptionThe operation failed.
System..::.ArgumentException format is invalid.
System..::.ArgumentOutOfRangeException width or height are less or equal zero.

Version Information

FreeImage.NET

Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also