win32.graph.freeimage.FreeImage_Allocate

FreeImage_Allocate is available since version 1.0.

Prototype:

number FreeImage_Allocate(number width, number height, number bpp, number red_mask, number green_mask, number blue_mask)

Description:

If you want to create a new bitmap in memory from scratch, without loading a pre-made bitmap from disc, you use this function. FreeImage_Allocate takes a width and height parameter, and a bpp parameter to specify the bit depth of the image and returns a FIBITMAP. The optional last three parameters (red_mask, green_mask and blue_mask) are used to tell FreeImage the bit-layout of the color components in the bitmap, e.g. where in a pixel the red, green and blue components are stored. To give you an idea about how to interpret the color masks: when red_mask is 0xFF000000 this means that the last 8 bits in one pixel are used for the color red. When green_mask is 0x000000FF, it means that the first 8 bits in a pixel are used for the color green.

FreeImage_Allocate allocates an empty bitmap, e.g. a bitmap that is filled completely with zeroes. Zero in a bitmap is usually interpreted as black. This means that if your bitmap is palletised it will contain a completely black palette. You can access, and hence populate the palette by using the function FreeImage_GetPalette.

Return value:

Returns a new image handle if succeeded, or null if failed.