CImage Class Reference

The CImage class is used to hold graphical image data. More...

#include <CImage.h>

Inheritance diagram for CImage:
CGraphicsMono CGraphics

List of all members.

Public Member Functions

CGraphicsGetGraphics ()
 Gets a CGraphics object that renders to this image.
INT16 GetWidth ()
 Gets the width of the image in pixels.
INT16 GetHeight ()
 Gets the height of the image in pixels.
void GetRGB (INT32 *rgbData, INT32 length, INT32 offset, INT16 scanlength, INT16 x, INT16 y, INT16 width, INT16 height)
 Obtains ARGB pixel data from the specified region of this image and stores it in the provided array of integers.

Static Public Member Functions

static CImageCreateImage (INT16 width, INT16 height)
 Creates a new, mutable image for off-screen drawing.
static CImageCreateImage (void *mem_addr, INT16 width, INT16 height)
 Creates a new, mutable image for off-screen drawing.
static CImageCreateXBMImage (UINT8 *data, INT16 width, INT16 height)
 Creates an mutable image which is decoded from the data stored in the specified byte array at the specified offset and length.

Detailed Description

The CImage class is used to hold graphical image data.

Image objects exist independently of the display device. They exist only in off-screen memory and will not be painted on the display unless an explicit command is issued by the application.

Images are mutable. The application may render on a image by calling GetGraphics() on the CImage to obtain a Graphics object expressly for this purpose.


Member Function Documentation

CImage * CImage::CreateImage ( void *  mem_addr,
INT16  width,
INT16  height 
) [static]

Creates a new, mutable image for off-screen drawing.

Every pixel within the newly created image is white. The width and height of the image must both be greater than zero.

Parameters:
mem_addr - the memory address of a exist image. Pixel format must be conformed pixel format in current using frame buffer device.
width - the width of the new image, in pixels
height - the height of the new image, in pixels
Returns:
the created image or null if width or height less or equal zero
CImage * CImage::CreateImage ( INT16  width,
INT16  height 
) [static]

Creates a new, mutable image for off-screen drawing.

Every pixel within the newly created image is white. The width and height of the image must both be greater than zero.

Parameters:
width - the width of the new image, in pixels
height - the height of the new image, in pixels
Returns:
the created image or null if width or height less or equal zero
CImage * CImage::CreateXBMImage ( UINT8 *  data,
INT16  width,
INT16  height 
) [static]

Creates an mutable image which is decoded from the data stored in the specified byte array at the specified offset and length.

The data must be in the XBM format.

Parameters:
data - the array of image data in a supported image format
width - the width of the new image, in pixels
height - the height of the new image, in pixels
Returns:
the created image or null if width or height less or equal zero
CGraphics * CImage::GetGraphics (  ) 

Gets a CGraphics object that renders to this image.

The CGraphics object has the following properties:

the destination is this CImage object; the clip region encompasses the entire Image; the current color is black; the font is the same as the font returned by CFont::GetDefaultFont(); the origin of the coordinate system is located at the upper-left corner of the Image.

Returns:
a CGraphics object with this image as its destination
INT16 CImage::GetHeight (  ) 

Gets the height of the image in pixels.

The value returned must reflect the actual height of the image when rendered.

Returns:
height of the image
void CImage::GetRGB ( INT32 *  rgbData,
INT32  length,
INT32  offset,
INT16  scanlength,
INT16  x,
INT16  y,
INT16  width,
INT16  height 
)

Obtains ARGB pixel data from the specified region of this image and stores it in the provided array of integers.

Each pixel value is stored in 0xAARRGGBB format, where the high-order byte contains the alpha channel and the remaining bytes contain color components for red, green and blue, respectively. The alpha channel specifies the opacity of the pixel, where a value of 0x00 represents a pixel that is fully transparent and a value of 0xFF represents a fully opaque pixel.

The returned values are not guaranteed to be identical to values from the original source. Color values may be resampled to reflect the display capabilities of the device (for example, red, green or blue pixels may all be represented by the same gray value on a grayscale device). On devices that do not support alpha blending, the alpha value will be 0xFF for opaque pixels and 0x00 for all other pixels. On devices that support alpha blending, alpha channel values may be resampled to reflect the number of levels of semitransparency supported.

The scanlength specifies the relative offset within the array between the corresponding pixels of consecutive rows. In order to prevent rows of stored pixels from overlapping, the absolute value of scanlength must be greater than or equal to width. Negative values of scanlength are allowed. In all cases, this must result in every reference being within the bounds of the rgbData array.

Consider P(a,b) to be the value of the pixel located at column a and row b of the Image, where rows and columns are numbered downward from the top starting at zero, and columns are numbered rightward from the left starting at zero. This operation can then be defined as:

 rgbData[offset + (a - x) + (b - y) * scanlength] = P(a, b);
 
for
 x <= a < x + width
 y <= b < y + height
 

The source rectangle is required to not exceed the bounds of the image.

This means:
 x >= 0
 y >= 0
 x + width <= image width
 y + height <= image height
 

If any of these conditions is not met an copying is not doing.

Parameters:
rgbData - an array of integers in which the ARGB pixel data is stored
length - the size of the rgdData array
offset - the index into the array where the first ARGB value is stored
scanlength - the relative offset in the array between corresponding pixels in consecutive rows of the region
x - the x-coordinate of the upper left corner of the region
y - the y-coordinate of the upper left corner of the region
width - the width of the region
height - the height of the region
INT16 CImage::GetWidth (  ) 

Gets the width of the image in pixels.

The value returned must reflect the actual width of the image when rendered.

Returns:
width of the image

The documentation for this class was generated from the following files:
Generated on Tue Jun 29 18:34:06 2010 for guilib by  doxygen 1.6.3