but but..why? Masking pixelmaps

BlitzMax Forums/BlitzMax Programming/but but..why? Masking pixelmaps

Drakim(Posted 2008) [#1]
SuperStrict

Const WIDTH:Int = 640,HEIGHT:Int = 480, DEPTH:Int = 0

Graphics WIDTH,HEIGHT,DEPTH
SetBlend MASKBLEND

Local test1:TPixmap = LoadPixmap("sprite/test.png")
Local test2:TPixmap = MaskPixmap(test1,255,255,255)

SetClsColor(255,255,255)

While Not KeyDown(KEY_ESCAPE)
  Cls
  DrawPixmap(test1,200,300)
  DrawPixmap(test2,300,300)
  Flip
Wend


here is my result:
Click here!

I thought that by using maskpixmap, I could make a color (255,255,255 in this case) to become transparent. But, to me in my example, it becomes black, and the other colors become thicker. o0

Please explain this to me, I am at a loss, and I found very little information about pixmaps when I tried to search around.


tonyg(Posted 2008) [#2]
I always thought it was a bug but never got it answered
MaskPixmap - pixel bug .There was a suggestion here that the increase in pixel size is due to the neighbouring pixels being checked.
I do remember another couple of reports but nobody was really used pixmaps to display images so it was never followed up.


Drakim(Posted 2008) [#3]
Ah, okay.

Michael Reitzenstein says that:
"The increase in size thing is likely to do with MaskPixmap setting invisible pixels to the average colour of their neighbours, which stops any scaling artifacts."

Which makes sense at to why they become thicker.

I tried loading it into a TImage before displaying it. Fixed all issues.

But really, this should be fixed. It's not exactly a minor bug. -_-


tonyg(Posted 2008) [#4]
The was an across the board purge where all bug reports were put in the bin and Mark asked for them to be reported again after 1.20 (I think). This just never got reported again because, I guess, people who changed the pixmap then went on to reload as an image.
Using pixmaps to actually draw to the backbuffer is a bit 'off' as it's so slow.


Xip(Posted 2008) [#5]
uhm... this looks almost exactly like the problem i reported a while back (about pixels getting HUGE), and the only reply i got was - 'learn how mask's work' ...


Drakim(Posted 2008) [#6]
Hah, that's unfortunate Xip.

It looks to me as if the transparency issue was just fixed, then this wouldn't be a problem, because the "overflowing" pixels are not supposed to be seen, being transparent. The pixels getting huge is working as intended, but appears very ugly because something else exposes it.

Anyways, I am happy, because my bloom and blur functions works perfectly. ^^

And it's pretty~