Setcolormask problem

BlitzMax Forums/BlitzMax Programming/Setcolormask problem

Sanctus(Posted 2008) [#1]
SetMaskColor(255, 0, 0) 
image:Timage = LoadAnimImage("Data/player.bmp",128,128,0,31)

I have this code...
The image I load has a red background (255,0,0) but somehow when I draw it it also draws the red part...
I don't get it... Is the mask and drawing affected by some functions? (my code is preety large so something there might cause that)


GfK(Posted 2008) [#2]
Have you remembered to use SetBlend MASKBLEND before you draw the image?


Sanctus(Posted 2008) [#3]
SetScale 1,1
SetColor 255, 255, 255
SetAlpha 1
SetBlend MASKBLEND
SetRotation 0
DrawImage image,x,y,frame
this is the code with the drawing


tonyg(Posted 2008) [#4]
In addition, you say your code is large. What happens when you run a simple program such as :
graphics 800,600
setmaskcolor 255,0,0
local image:timage=loadanimimage("data/player.bmp",128,128,0,31)
drawimage image,100,100,0
flip
waitkey()

? (obviously adjust if you're using GL driver etc)?
Also try it with graphics 800,600,32 mode plus load the image into a 32bit image viewer and check the colour. I have been caught out thinking something is 255,0,0 when it was 250,5,5 (or similar).


Sanctus(Posted 2008) [#5]
the color 255,0,0 indeed but... in your example it still draw the red surround.
So I guess the problem is from the image... but the bmp are not supossed to have alpha informations?
Btw If I use png... I won't have to think about mask colors as the alpha value will take care of this right? (can they be generated in 3d max?)


Sanctus(Posted 2008) [#6]
Nevermind... I used GlueIt to put the frames next to each other and that messed up the alpha thing... now I used game maker (the only thing its good at) to do that and it works perfectly :)


FBEpyon(Posted 2008) [#7]
local image:timage=loadanimimage("data/player.bmp",128,128,0,31)

that command is missing the flag for the Mask

setmaskcolor 255,0,255
loadanimimage("data/player.bmp",128,128,0,31,MASKEDIMAGE)



GfK(Posted 2008) [#8]
local image:timage=loadanimimage("data/player.bmp",128,128,0,31)

that command is missing the flag for the Mask
It isn't needed.

MASKEDIMAGE is included in the default AutoImageFlags (as is FILTEREDIMAGE).


FBEpyon(Posted 2008) [#9]
It never was for me...

I always had to run the loadimage command like that..


tonyg(Posted 2008) [#10]
It never was for me...

Never 'was'? What about now?