UI_BITMAP_DRAW Function
Description
UI_BITMAP_DRAW() draws on a bitmap in memory.
Discussion
L UI_BITMAP_DRAW(C name,C drawing_code) name The name of the bitmap to modify. drawing_code One or more Xbasic commands that modify the image. The command string begins with an starting string, such as , and concludes with an ending string, such as %code%. Each command is on a separate line, starting with the line after .
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.
ui_dlg_box("image", <<%dlg% {image=rgb} {image=trans} {image=combine} %dlg%)
Limitations
Desktop applications only.
See Also