png mask help!

BlitzPlus Forums/BlitzPlus Programming/png mask help!

Caton(Posted 2015) [#1]
How do I mask alpha channel? on a png image.


Grisu(Posted 2015) [#2]
Load the image and then use MaskImage(Image,0,0,0)?


Caton(Posted 2015) [#3]
did't work!


Yasha(Posted 2015) [#4]
BlitzPlus (and Blitz3D) doesn't support PNG alpha in its 2D engine. It only supports masking on a selected RGB colour (which is what Grisu suggests, masking out 0,0,0).

If you want you can use bOGL with the Draw2D addon to get a more powerful 2D engine that supports alpha blending. Otherwise you'll probably have to use something other than BlitzPlus.


Grisu(Posted 2015) [#5]
Just reinstalled BP. The easiest way is you set your own transparency color. Most people use "pink" (rgb:255,0,255)

Tested it. Works fine.

image = LoadImage ("monkey_24px.png")
MaskImage (image, 255,0,255)


Here's another example: http://www.blitzbasic.com/bpdocs/command.php?name=MaskImage&ref=2d_cat


Caton(Posted 2015) [#6]
Is there any userlib that do it?


Grisu(Posted 2015) [#7]
Not that I know of. I used to "convert" each image by hand to the same "alpha mask". It's not that hard, you wouldn't need a userlib for this.


xlsior(Posted 2015) [#8]
Is there any userlib that do it?


There used to be -- many years ago I came across a DLL that could add support for alphablended graphics in blitzplus at a reasonable speed, but for the life of me I don't remember the name, and haven't seen anything about it in a LONG time.