Admin Production ni-theme
Current Publication

AllocImageBits

LabWindows/CVI

AllocImageBits

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

Purpose

Note Note  This function has been superseded by AllocBitmapDataEx, which supports alpha-channel transparency.

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.

Supported Controls

You can use AllocImageBits with the following controls:

Parameters

Input
Name Type Description
panelHandle int Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel.
controlID int 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 functions such as NewCtrl and DuplicateCtrl.
imageID int 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 int * 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 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 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 int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later