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 backcolor used when the image is created.
If the image is 24-bit, use RGB() to get a valid color.
If the image is 32-bit, use RGBA() to get a valid color. For 32-bit image, special constants can be used as well:
- #PB_Image_Transparent which is similar to RGBA(255,255,255,0), white background which can help for light antialiasing.
- #PB_Image_TransparentBlack which is similar to RGBA(0,0,0,0), black background which can help for dark antialiasing.
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 pixels 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