# AllocBitmapData

int AllocBitmapData (int bitmapID, int **colorTable, unsigned char **bits, unsigned char **mask);

## Purpose

Allocates the buffers you pass to GetBitmapData. If you use GetBitmapInfo, you must allocate the buffers yourself. You must free the buffers when you are done with them. Use the ANSI C free function to free the buffers.

You can use this function with bitmaps created with NewBitmap, GetBitmapFromFile, GetCtrlBitmap, ClipboardGetBitmap, GetCtrlDisplayBitmap, GetPanelDisplayBitmap, GetScaledPanelDisplayBitmap, GetScaledCtrlDisplayBitmap, or DuplicateBitmap.

| Note This function returns an error if you pass the bitmap ID for an image that has alpha-channel transparency. You must use AllocBitmapDataEx instead.

## Parameters

Input
Name | Type | Description
bitmapID | integer | ID of the bitmap object that contains the image. Obtain the ID from NewBitmap, GetBitmapFromFile, GetCtrlBitmap, ClipboardGetBitmap, GetCtrlDisplayBitmap, GetPanelDisplayBitmap, GetScaledPanelDisplayBitmap, GetScaledCtrlDisplayBitmap, or DuplicateBitmap.
Output
Name | Type | Description
colorTable | pointer to integer | Pointer variable in which to store the address of the allocated color table buffer. If the pixel depth of the image is greater than 8, this function sets colorTable to NULL. If you do not want this function to allocate the color table buffer, pass NULL for this parameter.
bits | pointer to unsigned char | Pointer variable in which to store the address of the allocated bits data buffer. If you do not want this function to allocate the bits data buffer, pass NULL for this parameter.
mask | pointer to unsigned char | Pointer variable in which to store the address of the allocated mask buffer. If the image does not have a mask, this function sets mask to NULL. If you do not want this function to allocate the mask buffer, pass NULL for this parameter.

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
Code | Error Message String
xx | Success