Share via


Image.createImage(Int32, Int32, Int32) Method

Definition

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

public:
 virtual int createImage(int _Width, int _Height, int _BitsPerPixel);
public virtual int createImage (int _Width, int _Height, int _BitsPerPixel);
abstract member createImage : int * int * int -> int
override this.createImage : int * int * int -> int
Public Overridable Function createImage (_Width As Integer, _Height As Integer, _BitsPerPixel As Integer) As Integer

Parameters

_Width
Int32

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

_Height
Int32

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

_BitsPerPixel
Int32

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

Returns

0 indicates success; otherwise, failure.

Remarks

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

Applies to