CreateImage()

Syntax

Result = CreateImage(#Image, Width, Height [, Depth [, BackColor]])
Description
Create an empty image (with black background) which can be used to do rendering on it.

Parameters

#Image A number to identify the new image. #PB_Any can be specified to auto-generate this number.
Width, Height The dimensions of the new image. Both the width and height must be greater than zero.
Depth (optional) The color depth for the new image. Valid values can be: 24 and 32. The default is 24-bit if no depth is specified.
BackColor (optional) The back RGB() color used when the image is created. This color can be set to #PB_Image_Transparent to create an image with the alpha channel set to full transparent. This only has an effect on 32-bit images. The default backcolor is black if not specified.

Return value

Returns nonzero if the image was created successfully and zero if the image could not be created. If #PB_Any was specified as the #Image parameter then the auto-generated number is returned on success.

Remarks

The limit for the image size that can be handled depends on the operating system and the available amount of memory. If enough memory is available, then images up to at least 8192x8192 are can be handled by all operating systems supported by PureBasic.

You can use the several other functions for acting with the created image:
StartDrawing() with ImageOutput() to draw on the created image
StartVectorDrawing() with ImageVectorOutput() to draw on the created image using vector drawing
CopyImage() to create another image from the actual one
GrabImage() to create another image from a given area of the actual one
DrawImage() with ImageID() to draw the image on actual output channel.
ImageGadget() for displaying image on an application window
ButtonImageGadget() for creating an image button on an application window

See Also

LoadImage(), CatchImage(), FreeImage()

Supported OS

All

<- CopyImage() - Image Index - EncodeImage() ->