Image.createImage Method

Creates an empty bitmap image with the width, height, and color depth as specified by the parameters.

Syntax

public int createImage(
    int Width, 
    int Height, 
    int BitsPerPixel)

Run On

Client

Parameters

  • Width
    Type: int
    The width of the image in pixels.
  • Height
    Type: int
    The height of the image in pixels.
  • BitsPerPixel
    Type: int
    The color depth of the image. Possible values are 1, 4, 8, 16, 24, and 32.

Return Value

Type: int
0 indicates success; otherwise, failure.

Examples

The following example creates an image with a height and width of 16 pixels, and a color depth of 32 bits per pixel.

int i;
int j;
Image image;
 
image.createImage(
    Imagelist::smallIconWidth(),
    Imagelist::smallIconHeight(),
    32);

for (i=0; i < Imagelist::smallIconWidth(); i++)
{
    for (j=0; j < Imagelist::smallIconHeight(); j++)
    {
        if (i >= Imagelist::smallIconWidth()-2)
        {
            image.setPixel(i, j, WinAPI::RGB2int(0, 255, 255));
        }
        else
        {
            image.setPixel(i, j, WinAPI::imageTransparentColor());
        }
    }
}

See Also

Reference

Image Class