Admin Production ni-theme
Current Publication

AllocBitmapData

LabWindows/CVI

AllocBitmapData

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

Purpose

Note Note  This function has been superseded by AllocBitmapDataEx. If you pass the bitmap ID for an image that has alpha-channel transparency to AllocBitmapData, you receive an error.

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 obtain the ID of the bitmap object from functions such as GetCtrlBitmap.

Parameters

Input
Name Type Description
bitmapID int ID of the bitmap object that contains the image. You can obtain the ID from functions such as NewBitmap and GetCtrlBitmap.
Output
Name Type Description
colorTable int * 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 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 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 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

Examples

Refer to the following examples that use the AllocBitmapData function:

  • userint\alphablend.cws

    Open example
  • userint\imagedit.cws

    Open example