Xbasic
UI_BITMAP_LOAD Function
Syntax
Result_Flag as L = UI_BITMAP_LOAD(C name,B bitmap_data)
Arguments
- name
The name of the bitmap to create.
- bitmap_data
The blob variable containing the image data.
Description
UI_BITMAP_LOAD() creates a new bitmap in memory from the data in a blob variable.
Example
Get the original color image, then extract the color data and the alpha channel data.
png_data = file.to_blob("c:\documents\Xbasic Reference\Images\toucan.png") rgb_data = png_to_bitmap(png_data, "R") trans_data = png_to_bitmap(png_data, "A")
Create two bitmaps from the color data and the alpha channel data.
ui_bitmap_load("rgb", rgb_data) ui_bitmap_load("trans", trans_data)
Calculate the positions of the three images.
pixsize = ui_bitmap_info_get(rgb_data, "w,h") xpix = valpixsize, 1, ","? ypix = valpixsize, 2, ","? xperin = ui_info(4) yperin = ui_info(5) width = xpix/xperin height = ypix/yperin
Combine the three images.
ui_bitmap_create("combine", width, height) stone_data = file.to_blob("C:\WINDOWS\Greenstone.bmp") ui_bitmap_load("Stone", stone_data) ui_bitmap_draw("combine", <<%code% bitmap("stone", 0, 0) bitmap_alpha("rgb", 0, 0, "trans") %code%)
Display the three images.
Limitations
Desktop applications only.
See Also