Does BlitzMax handle anti-alias masking?

BlitzMax Forums/BlitzMax Beginners Area/Does BlitzMax handle anti-alias masking?

AD(Posted 2009) [#1]
This is a newbie question, but does BlitzMax handle anti-alias masking of images?

Say you have an image with an anti alias outline/stroke, will BlitzMax be able to deal with the transparency issues or masking of the sprite without it making it look silly?

Thanks.


ImaginaryHuman(Posted 2009) [#2]
Yes. So long as you load your image in a format that supports an alpha channel - e.g. PNG, and so long as when you saved the image in your graphics application it also saves the alpha channel, and so long as when you created the image in the graphics application it had transparency as the background, it should bring in the alpha values. You then do SetBlend ALPHABLEND to switch on alphablending, and then DrawImage will correctly draw the semi-transparent pixels blended into the background.

Antialiasing is really a term that doesn't specifically relate to alphablended images. Antialiasing is an attempt to represent a higher resolution of spacial accuracy by combining multiple smaller samples within a pixel into a single approximate value, so that edges which were supposed to be at a given angle look approximately smooth rather than jagged. But you could be doing other operations in a graphics application that create alpha pixel values for semi-transparency, unrelated to trying to antialiase the edges of geometric shapes. But anyway. :-)


sswift(Posted 2009) [#3]
I have antialiased edges on all the sprites in my game.

To use them you need to do three things:

1. Save your images as 24bit PNG's with transparency.
2. Disable masked image loading with AutoImageFlags(MIPMAPPEDIMAGE|FILTEREDIMAGE) before you load everything, because you will be loadeding images with alpha maps, and you don't want color 0 to become transparent.
3. Setblend(ALPHABLEND) before drawing your images.