SetMaskColor issue

BlitzMax Forums/BlitzMax Beginners Area/SetMaskColor issue

Kanati(Posted 2011) [#1]
I have a number of small images that I created in photoshop (though I've also opened and saved said images in graphics gale as well) with a mask color of hot pink (255,0,255).

I call setmaskcolor(255,0,255) before I load the images and it still shows the pink color when drawn.

Yet I have some other images I created in GGale that show just fine. I've verified the color is correct. The images are saved as png, though I've saved them as bmp as well just to test that. No idea what's going on here.


Zeke(Posted 2011) [#2]
hmm. are you using 32-bit images?

try:
img.SetPixmap(0 , MaskPixmap(LockImage(img) , 255 , 0 , 255) )

right after image is loaded. (img is TImage)

example:
Global img_Car:TImage = LoadImage("car.png")
img_Car.SetPixmap(0 , MaskPixmap(LockImage(img_Car) , 255 , 0 , 255) )



Kanati(Posted 2011) [#3]
That worked. Don't know WHY that worked as yet but it did indeed work. :D


Kanati(Posted 2011) [#4]
oh... the images are 8 bit color btw.


Zeke(Posted 2011) [#5]
if you look brl.mod/max2d.mod/image.bmx, there is TImage type and SetPixmap Method:
Method SetPixmap( index,pixmap:TPixmap )
	If (flags & MASKEDIMAGE) And AlphaBitsPerPixel[pixmap.format]=0
		pixmap=MaskPixmap( pixmap,mask_r,mask_g,mask_b )
	EndIf
	pixmaps[index]=pixmap
	seqs[index]=0
	frames[index]=Null
End Method

^^ "And AlphaBitsPerPixel[pixmap.format]=0" prevents images with alpha channel to be masked (8-bit and 32-bit)


Kanati(Posted 2011) [#6]
Thanks for the info. I'll keep all that in mind. :)


Czar Flavius(Posted 2011) [#7]
Can you have native 8-bit images in Blitz, that take up less video ram than the 32-bit formats?


B(Posted 2011) [#8]
did you set a MASKEDIMAGE flag when you loaded the image with loadimage("image.png",MASKEDIMAGE) ?

Last edited 2011