# AllocImageBits

int AllocImageBits (int panelHandle, int controlID, int imageID, int **colorTable, unsigned char **bits, unsigned char **mask);

## Purpose

| Note This function is obsolete. National Instruments recommends that you use GetCtrlBitmap and AllocBitmapData instead.

Allocates the buffers you pass to GetImageBits. Call AllocImageBits instead of calling GetImageInfo and allocating the buffers yourself. You must free the buffers when you are done with them. To free the buffers, use the ANSI C Library free function.

If the image does not exist, this function sets the parameters to NULL.

## Parameters

Input
Name | Type | Description
panelHandle | integer | Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID | integer | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
imageID | integer | For picture rings, the zero-based index of an image in the ring. For graphs, the plot handle you obtain from PlotBitmap. For picture controls, picture buttons, and canvas controls, this parameter is ignored.
Output
Name | Type | Description
colorTable | pointer to integer | Pointer variable in which to store the address of the allocated color table buffer. If the image does not exist or 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 bitmap buffer. If the image does not exist, this function sets bits to NULL. If you do not want this function to allocate the bitmap 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 exist or 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