Prevent bluring when using SetMaskColor

BlitzMax Forums/BlitzMax Beginners Area/Prevent bluring when using SetMaskColor

Ranoka(Posted 2011) [#1]
Hey, for some reason when I set the maskColor it makes things I scale up go blurry, but I'm trying to create that square pixel look.

I've done a quick example which re-creates the problem I'm having. The actual code here doesn't have much reason, but is just an example.

'SetGraphicsDriver(D3D7Max2DDriver())
SetGraphicsDriver(GLMax2DDriver())

Graphics 640, 480, 0, 60
SetMaskColor 123, 123, 123
SetBlend MASKBLEND

DrawRect(20, 20, 20, 20)

Local LevelImage:TImage = CreateImage(640, 480)

GrabImage LevelImage, 0, 0

Cls

SetScale 2.0, 2.0

DrawImage LevelImage, 0, 0

Flip

WaitMouse


If I comment out the SetMaskColor line, then I get crispy pixels. But if I uncomment it, then I get blurring, which I don't currently want.

The blend mode doesn't seem to affect it, I'm putting it there 'cos I'm using it in my project. Switching drivers doesn't seem to change the behaviour)

I'm guessing that another setting is being changed without me knowing about it when I set the mask color.

Also, is the "draw -> grabImage -> cls -> setScale -> Draw -> Flip" the correct way to do this.
At first I tried to find a way to draw to a new image, but the examples I found seem to draw to the back buffer, grab and then cls.

Hopefully someone can shed some light on this, and help point me in the right direction. Thanks!


Jesse(Posted 2011) [#2]
create the image as a masked image:
createimage(640,640,1,MASKEDIMAGE)



Ranoka(Posted 2011) [#3]
Thank you, that worked!
A small detail, but you have saved me a lot of time.