ToBitmap (C# .NET4)

Top  Previous  Next

Namespace Hierarchy

C# .NET4

PXCMImage.ImageData.ToBitmap

Syntax

C# .NET4

System.Drawing.Bitmap ToBitmap(Int32 width, Int32 height);

System.Drawing.Bitmap ToBitmap(Int32 plane, Int32 width, Int32 height);

Parameters

 

plane

The data plane index.

 

width, height

The bitmap resolution in width and height.

Description


The ToBitmap function creates a System.Drawing.Bitmap bitmap instance from the image data object.

The bitmap directly refers to image data in the image data object. The application must maintain the life cycle of the image data object before the bitmap is disposed.

The following color formats are supported by the .NET 4.0 framework natively:

COLOR_FORMAT_RGB32
COLOR_FORMAT_RGB24
COLOR_FORMAT_DEPTH
COLOR_FORMAT_DEPTH_RAW

The application may convert any native color format to one of above formats as follows:

PXCMImage.ImageData data;

image.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.ColorFormat.COLOR_FORMAT_DEPTH, out data);

Bitmap bitmap=data.ToBitmap(...);

...

image.ReleaseAccess(data);

Return Status

 

The System.Drawing.Bitmap bitmap instance, or null if there is any error.