GetBitmapFromFile
- Updated2023-02-21
- 2 minute(s) read
GetBitmapFromFile
int GetBitmapFromFile (char filename[], int *bitmapID);
Purpose
Reads a bitmap image from a file and creates a bitmap object. You can pass the bitmap ID this function outputs to any function that accepts a bitmap, such as CanvasDrawBitmap or ClipboardPutBitmap.
You can discard the bitmap object by passing its ID to DiscardBitmap.
You can use the following image types: .tif, .pcx, .bmp, .dib, .rle, .ico, .jpg, .png, .wmf, and .emf.
Regardless of the original color depth of the image file, the bitmap that GetBitmapFromFile creates matches the color depth of the display screen.
Parameters
Input | ||
Name | Type | Description |
filename | char [] | Pathname of the file that contains the image. You can use a complete pathname or a simple filename. If the name is a simple filename, the file is loaded from the directory that contains the executable. |
Output | ||
Name | Type | Description |
bitmapID | int | ID that serves as a handle to the bitmap object. You can pass the ID to functions that accept a bitmap, such as CanvasDrawBitmap and ClipboardPutBitmap. To discard the bitmap, pass the ID to DiscardBitmap. Zero is not a valid bitmap ID. |
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 GetBitmapFromFile function: