wasm4
wasm4 copied to clipboard
Add alpha blit functions for sprites
The alpha could be 1bpp, and both 1bpp and 2bpp color versions would be nice.
Isn't this already supported just be using one of the 4 colors as the alpha channel and then setting DRAW_COLORS appropriately? (ie, 2 bit allows for easy 3 colors + 1 alpha channel)
Or are you asking for 4 colors PLUS an alpha channel?
I was meaning a separate alpha channel entirely, although maybe it's a rare enough need that people wouldn't really use. And of course, people can already make their own functions for this.
But I also don't see an option for color 0 (or whatever) as transparent in the current blit (or text) function. Maybe ok again, since people can also do this on their own if they want. Or maybe nice to have directly in the standard api.
And yes, this was motivated by gingerBill's demo in the old discord.
But I also don't see an option for color 0 (or whatever) as transparent in the current blit (or text) function.
It's not color 0, it's ANY color... just set DRAW_COLOR for that palette color to 0 and it's treated as transparent - this is documented somewhere - try it. So one can make any one of the 4 colors (or all 4) transparent... that eliminates the need for alpha UNLESS you need it JUST for masking of arbitrary boundaries separately from color... ie, 4 colors plus transparency... ie "this black pixel is opaque" AND "this black pixel is transparent".
I'm not sure that edge case is worth adding to the API with our philosophy on keeping things minimal.
Awesome. Thanks for the info! The separate alpha mask could still be fun, but yeah, maybe let people do that on their own if they want it. If folks want to close this issue, that's fine.