How to create a dynamic mask?

BlitzMax Forums/BlitzMax Programming/How to create a dynamic mask?

salric(Posted 2006) [#1]
Hi all,

It's been a while, so can someone please refresh me on how to draw a mask onto either a pixmap or image?

Thanks in advance.


René(Posted 2006) [#2]
If you have two pngs (one pixmap the image, and one pixmap the mask) and the mask is a greyscale with 256 different grey values you can read each pixmap pixel per pixel at the same time and copy the color value of any rgb channel of the mask to the alpha channel value of the target image.


ImaginaryHuman(Posted 2006) [#3]
Store your image as an RGB image(or RGBA). Store the mask image as an PF_A8 (alpha) image. DrawImage() to the backbuffer with your RGB image. DrawImage() to the backbuffer with your Alpha image. GrabImage from the backbufer.


salric(Posted 2006) [#4]
Thanks for your replies; I'll have to start another topic & be more specific about what I'm trying to achieve because writing to pixmaps is too slow for my application.