Image Masking
Blitz3D Forums/Blitz3D Programming/Image Masking
| ||
Probably been asked before but I was wondering how do you do those image masking things where you take a square image and apply a cutout image or alpha transparent as mask. Do I just use the command MaskImage? |
| ||
Just nominate a colour, usually magenta (255, 0, 255), and use MaskImage ;) |
| ||
I'm sure everyone quite possibly has their prefered way though. |
| ||
thanks steve, I'll post my results when I give this a try. |
| ||
Make sure the MaskImage parameters are set the same as the colour that you used to fill in the chosen transparent areas on your image, the colour picker tool in MS Paint will get the RGB values. |
| ||
MaskImage ignores alpha...if you are talking about 2d in 3d with textures maskimage won't do it....you will have to manually set transparency of each pixel. |
| ||
Thanks Matty. I was really looking for something functional like a mini map with a masked shape other than square/rect. I thought this was the function I was looking for. I would also like to know if there's a blitzmax 2d mod that can handle this, maybe freeimage? |
| ||
I forgot about lack of alpha control in 2D, thanks for the reminder Matty. ;) |
| ||
If it is a small texture then simply writing each pixel alpha is potentially fast enough. |
| ||
You can't do this with vanilla Blitz3D, but there's a texture combination mode that modulates the alpha from a texture layer with the alpha values of the texture layer below (essentially, the square texture would inherit the alpha from your soft transparency mask texture). It was made available with Blitz3D with that FastExt library, but you can do this with BlitzMax since you can use API commands. |