Find the Mask of an image

BlitzPlus Forums/BlitzPlus Programming/Find the Mask of an image

Mordax_Praetorian(Posted 2005) [#1]
I was wondering if its possible to get the RGB values for an images transparent colour


Shagwana(Posted 2005) [#2]
Aa i recall there is no native way to do this in b+. However someone might have hacked it into b+ by now.

Other then that, you will have to store that information yourself someplace and retrieve it when you need it.


Grey Alien(Posted 2005) [#3]
one tip is to leave the top left pixel always blank in you images, then you can read the mask value from that.


CS_TBL(Posted 2005) [#4]
Perhaps it's a lousy solution, but I figure one can't see the difference between 0,0,0 and 1,1,1 ..so I stick to 0,0,0 as mask-always. If I need nonmask-black in my images then I use 1,1,1 .. see no evil.
This way I *never* have to think about maskcolors.. it's always 0,0,0 for me.. :P


JazzieB(Posted 2005) [#5]
If you're going to use that method use 8,8,8 instead, as 1,1,1 will turn into 0,0,0 in 16 bit graphics modes when you load the images. At least it does in Blitz3D, so I'm assuming the same will happen with BlitzPlus.


Grey Alien(Posted 2005) [#6]
I had that same 16 bit colour problem, but I think it was fixed as now I always use 255,0,255 (magenta, great for seeing what is background and not in paint package).


Mordax_Praetorian(Posted 2005) [#7]
Unfortunatly I cant use the top-left pixel method since the images I'm working with all tile to make backgrounds

The other method could show promise though, I'll have a look


Grey Alien(Posted 2005) [#8]
I should have said you only need to use the top pixel method if for some reason you haven't used a consistant mask on all you sprites. Using 0,0,0 or a bright colour like 255,0,255 on them all is good. Then you can write a mini function called MyMaskImage(image%) where you pass in the image and mask it to your standard colour like this: MaskImage image,255,0,255.


CS_TBL(Posted 2005) [#9]
..perhaps store the hex maskcolor in the filename?

FF00FF_dragon.bmp

etc.


Grey Alien(Posted 2005) [#10]
good idea. Still using the same one each time is easy too.