(fixed in 0.78) sys_render_other rendering woes. (0.77)
Posted: Mon Nov 02, 2020 1:44 pm
After finally getting my sys_render_other to behave for 0.77, I've discovered new problems with how alpha channels and blitting behave. I don't know if I'm doing something wrong, so here's some pseudo code to show various setups and the results. I've reduced down to the pertinent code for brevity. Note that the size of the bmp received by sys_render_other from the gui_info table is the full size of the viewport/inventory (448,272):
================================================================
#1 gives perfect results with non-alpha 8-bit bitmaps. My popup is rendered correctly over the inventory:
================================================================
#2 I replace my popup with a 32-bit bitmap which contains alpha transparency. It gets blended with the powerpink of the cleared "parent" bitmap:
================================================================
#3 I change the bitmap clearing method to use the alpha clearing method instead (that you previously suggested in a different thread). Now the popup renders its alpha correctly, but subsequent drawing onto this bitmap is also affected (the text is now transparent!). Note that other gui_zones are now not rendered at all (the red circle):
================================================================
#4 Let's repeat example #3, but BLIT the alpha popup rather than DRAW it. Same results as #3:
================================================================
#5 Let's repeat example #4, but clear the parent bitmap to powerpink again, rather than the alpha clear to black. Other gui_zones now show up again correctly (the main stats bottom left), but the popup is still mangling the text:
================================================================
Hopefully you can help me either (a) clear up my code to work correctly or (b) fix what might be a bug...? I'm pretty confused by all this now...!
================================================================
#1 gives perfect results with non-alpha 8-bit bitmaps. My popup is rendered correctly over the inventory:
Code: Select all
function sys_render_other(bmp, gui_name, frozen)
dsb_bitmap_clear(bmp, color.powerpink)
dsb_bitmap_draw(gfx.ui_stats_popup, bmp, 192, 38, false)
{render out the stats text}
end
================================================================
#2 I replace my popup with a 32-bit bitmap which contains alpha transparency. It gets blended with the powerpink of the cleared "parent" bitmap:
Code: Select all
function sys_render_other(bmp, gui_name, frozen)
dsb_bitmap_clear(bmp, color.powerpink)
dsb_bitmap_draw(gfx.ui_stats_popup_ALPHA, bmp, 192, 38, false)
{render out the stats text}
end
================================================================
#3 I change the bitmap clearing method to use the alpha clearing method instead (that you previously suggested in a different thread). Now the popup renders its alpha correctly, but subsequent drawing onto this bitmap is also affected (the text is now transparent!). Note that other gui_zones are now not rendered at all (the red circle):
Code: Select all
function sys_render_other(bmp, gui_name, frozen)
bitmap_clear_alpha(bmp, color.black)
dsb_bitmap_draw(gfx.ui_stats_popup_ALPHA, bmp, 192, 38, false)
{render out the stats text}
end
================================================================
#4 Let's repeat example #3, but BLIT the alpha popup rather than DRAW it. Same results as #3:
Code: Select all
function sys_render_other(bmp, gui_name, frozen)
bitmap_clear_alpha(bmp, color.black)
dsb_bitmap_blit(gfx.ui_stats_popup_ALPHA, bmp, 0, 0, 192, 38, 284, 262)
{render out the stats text}
end
================================================================
#5 Let's repeat example #4, but clear the parent bitmap to powerpink again, rather than the alpha clear to black. Other gui_zones now show up again correctly (the main stats bottom left), but the popup is still mangling the text:
Code: Select all
function sys_render_other(bmp, gui_name, frozen)
dsb_bitmap_clear(bmp, color.powerpink)
dsb_bitmap_blit(gfx.ui_stats_popup_ALPHA, bmp, 0, 0, 192, 38, 284, 262)
{render out the stats text}
end
================================================================
Hopefully you can help me either (a) clear up my code to work correctly or (b) fix what might be a bug...? I'm pretty confused by all this now...!