C# / .Net API Library Reference  4.3.2-74-ge1d4cca
Public Functions | Public Static Functions | Static Package Functions | Properties
Image Class Reference

The Image class represents an aligned 2D image along with its underlying bitmap buffer. By default, it is compatible with Windows bitmap format.

Image objects are passed to RenderTarget for streaming to client-side views.

Public Functions

Image Clone ()
 
void CopyFrom (IntPtr scan0, int width, int height, int stride)
 
void CopyTo (ref Image other)
 
void Dispose ()
 
void Draw (System.Drawing.Image image)
 
void DrawUniform (System.Drawing.Image image, Color backgroundColor)
 
void DrawUnscaled (System.Drawing.Image image)
 
Constructors and Destructors
 Image (int width, int height, PixelFormat pixelFormat=System.Drawing.Imaging.PixelFormat.Format24bppRgb, ScanLineOrder scanLineOrder=ScanLineOrder.TopDown, int alignment=4)
 

Public Static Functions

static int GetBytesPerPixel (PixelFormat pixelFormat)
 

Static Package Functions

static void CopyBitmap (Bitmap source, Rectangle sourceRegion, Bitmap destination, Rectangle destinationRegion)
 

Properties

int Alignment [get, set]
 
Bitmap Bitmap [get]
 
Graphics Graphics [get]
 
int Height [get]
 
ScanLineOrder Orientation [get, set]
 
PixelFormat PixelFormat [get]
 
Rectangle Region [get]
 
int RowStride [get]
 
IntPtr Scan0 [get]
 
Size Size [get]
 
int Width [get]
 

Usage Description

Image Clone ( )
inline

Clones this instance.

static void CopyBitmap ( Bitmap  source,
Rectangle  sourceRegion,
Bitmap  destination,
Rectangle  destinationRegion 
)
inlinestaticpackage

Copies the image.

Parameters
sourceThe source
sourceRegionThe source region
destinationThe destination
destinationRegionThe destination region
void CopyFrom ( IntPtr  scan0,
int  width,
int  height,
int  stride 
)
inline

Copies data from the specified image memory.

Parameters
scan0The address of the first scan line
widthThe width
heightThe height
strideThe stride
void CopyTo ( ref Image  other)
inline

Copies this image into the supplied Image parameter.

void Dispose ( )
inline

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

void Draw ( System.Drawing.Image  image)
inline

Draws the specified image to the current instance. The image is positioned and scaled to fit within the size of the current instance.

void DrawUniform ( System.Drawing.Image  image,
Color  backgroundColor 
)
inline

Draws the specified image to the current instance. The image is centered and uniformly scaled to fit within the size of the current instance. The specified background color is used to fill any areas that are not covered by the uniformly stretched image.

Parameters
imageThe image.
backgroundColorThe color of the background; or use transpararent if no background color is desired
void DrawUnscaled ( System.Drawing.Image  image)
inline

Draws the specified image to the current instance. The image is positioned and clipped to fit within the size of the current instance, but is not scaled.

static int GetBytesPerPixel ( PixelFormat  pixelFormat)
inlinestatic

Returns the number of bytes per pixel in the image.

Property Documentation

int Alignment
getset

Returns the alignment of the image. By default, the value for alignment is 4.

Bitmap Bitmap
get

Returns the underlying image byte array.

Graphics Graphics
get

Gets a graphics that can draw to this image.

Note
Do not dispose of this graphics object!
int Height
get

Returns the height of the image, in pixels.

ScanLineOrder Orientation
getset

Returns the scan line order of the image; the default is TopDown.

PixelFormat PixelFormat
get

Returns the pixel format of the image; the default is Rgb24.

Rectangle Region
get

Returns the bounding region of the image, in pixels.

int RowStride
get

Returns the stride value for a row of pixels.

IntPtr Scan0
get

Returns the value for the Scan0 property of the image. This represents the pointer address of the first pixel data.

Size Size
get

Returns the size of the image, in pixels.

int Width
get

Returns the width of the image, in pixels.