Hello
I'm working on a new game port for the CMM2, that I'll reveal soon. I'm playing a lot with the blit command to use in this new game. I have a question for the experts

. Is there a way to make the blit command only copy the non transparent pixels? Something like in Gimp or Photoshop, when I paste an image over other one and I can see the original image through transparent areas of the pasted image.
I know I can used page 0 and 1 to apply transparencies, but if I have 5 or 10 images that I want to stack to compose another image, I think using these two pages will not work.
I also know that I can use sprites, but in this case, it is a little hard to control the sprites layers, because there is no way to specify the z order. It needs to be controller by the way the sprites are shown.
Here a wrote a small example. I want to render the circle over the rectangle making the rectangle visible through the circle centre, and also making the black parts disappear.
Let's use this PNG. The black area is transparent in the PNG, and it is saved as 8 bpc RGBA
When I run this program...
option explicit
mode 7,12 ' 320x240 / 12 bits
page write 2: cls 0
load png "test.png", 2
page write 0: cls rgb(255, 243, 185)
blit 84,0, 46,46, 96,96, 2
blit 0,0, 52,54, 84,82, 2
the result is:

The transparent areas from the PNG are copied as black by the blit command, overwriting the back image and background.
Edited 2025-11-17 15:46 by LeoNicolas