A bitmap is a two-dimensional grid of pixels that represents an image. Use bitmap objects to display images on user interface controls such as canvas controls, picture controls, graph controls, and tree controls. You also can use bitmap objects to capture screenshot images of user interface controls and panels.
LabWindows/CVI provides functions such as PlotBitmap and DisplayImageFile that display the contents of an image file directly on a control. LabWindows/CVI also provides functions that create a bitmap or extract a bitmap from an existing file, store the bitmap in memory, and return a bitmap ID. You then can pass the bitmap ID to functions such as CanvasDrawBitmap and SetCtrlBitmap to display the image in a control. You also can pass a bitmap ID to SetBitmapDataEx to modify the image contents.
Use the following functions to create, extract, or discard bitmap objects.
Use the following functions to display a bitmap object in a control or copy an image from a bitmap object to a control.
Use the following functions to retrieve image data from bitmap objects.
You can save a bitmap image to a .bmp, .jpg, or .png file. The .png file format is the only format in which you can save binary or alpha-channel transparency data. Call SaveBitmapToBMPFile, SaveBitmapToJPEGFile, or SaveBitmapToPNGFile to save a bitmap object to file.
To display images that are not rectangular or have holes in them, use binary transparency. With binary transparency, you specify which pixels in an image to draw and which pixels to make transparent. Use the mask parameter in the NewBitmap, NewBitmapEx, SetBitmapData, and SetBitmapDataEx functions to specify binary transparency data. To create images that have partially transparent pixels, use alpha-channel transparency. With alpha-channel transparency, you specify a transparency level, ranging from fully transparent to fully opaque, for each pixel. Use the alpha parameter in the NewBitmapEx and SetBitmapEx functions to specify alpha-channel data.
If you pass a mask array and an alpha array, LabWindows/CVI incorporates the mask values into the alpha array and then sets the mask value to NULL. For each mask array bit that you set to 0 (pixel is not drawn), LabWindows/CVI sets the corresponding alpha array byte to 0 (pixel is fully transparent). For each mask array byte you set to 1 (pixel is drawn), the corresponding alpha array byte is retained.
A Windows metafile (.wmf or .emf) contains a description of an image that is scalable without distortion. The description consists of a set of drawing commands rather than a bitmap. Use GetBitmapFromFile to load a Windows metafile.
![]() |
Note You cannot use SetBitmapData to change the image contents of a bitmap that originated as a Windows metafile. |