Image.createImage Method

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


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

Client

Parameter

Description

Width

The width of the image in pixels.

Height

The height of the image in pixels.

BitsPerPixel

The color depth of the image. Possible values are 1, 4, 8, 16, 24, and 32.

0 indicates success; otherwise, failure.

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

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());
        }
    }
}

Community Additions

ADD
Show: