Anti-aliased graphics

Community Forums/Developer Stations/Anti-aliased graphics

Drekinn(Posted 2004) [#1]
Hi all,

1) Is it possible to display anti-aliased graphics so that the semi-transparent edges blend smoothly with background images?

I ask this because I create my graphics in Illustrator, then cut and paste them directly to a transparent layer in Photoshop. Saving in .png format retains the transparency, but when displayed in Blitz the anti-aliased edges, instead of blending smoothly, are converted into 100% opaque, jagged edges.
Does Blitz not support semi-transparent images?

2) When I set a masking colour with the 'MaskImage' command why do I lose the transparency in my .png images? Is there a way of preventing this?


Any help with the above would be be appreciated.

Thanks,


CyberHeater(Posted 2004) [#2]
I'm far from export about this but isn't png a compressed format.

Don't you really need to use a uncompressed format to ensure that your mask is .. er ... pure.


Isaac P(Posted 2004) [#3]
PNG is a lossless compressed format.. what go's in is what comes out


jhocking(Posted 2004) [#4]
You need to use alpha transparency, not masking. PNG file format supports alpha transparency, although it could be tricky depending on which version of Photoshop you use.


CyberHeater(Posted 2004) [#5]
Marc White (Posted 2004-06-11 16:37:18)
PNG is a lossless compressed format.. what go's in is what comes out


Didn't know that. Cheers Mark.


Drekinn(Posted 2004) [#6]
jhocking: so it -is- possible to display semi-transparent images in .png format? Please tell me how! I need to know if anti-aliased images can display smoothly on a background.

Thanks,


Billamu(Posted 2004) [#7]
I know that you can edit a PNG file in GIMP and it will be semi-opaque (it will have an alpha-matte). In GIMP the layer that you're working on that doesn't have a picture is the semi-opaque bit. Easy as that.

In Photoshop 6 and 7(?) or whatever they're calling it now you can edit and save a PNG file with an alpha matte, but in Photoshop 5 you need to look for a PNG export plugin on the internet, as Photoshop 5's PNG exporter does not support alpha channels. I think it's called SuperPNG.

You have to make an alpha channel in Photoshop 5 to get your semi-opaque bits. I'm not sure whether Version 6 and up work like GIMP does.

I came across this problem before and it drove me up the wall so I wound up using GIMP instead. It's taken quite a while for Adobe to support PNG properly, while the rest of the world has moved on.


MrCredo(Posted 2004) [#8]
you need a workaround???

i think bb load alpha-values from png, but don't use this for alphablending. Analyze your image after loading (readpixelfast). Create a alphapixel-table with x,y,rgb values and overwrite this pixels with masked color. After you use drawimage, draw all alpha-pixels from your table and you have fast antialiased high quality graphic


Warren(Posted 2004) [#9]
Billamu

No, Jasc Software (PaintShop Pro) is right back there with Adobe. Actually, they're even further behind since they're at version 8.0 and they still don't handle alpha channels in a nice way. Insane, really ...


RusWilson(Posted 2004) [#10]
My PNG's with alpha created in PaintShop Pro look great.

Use 16.7 million colors, Alhpa transparency (with existing image/layer transparency).

I use LoadSprite with flag 2 for alpha mask. The edges blend with other graphics very nicely.

Not sure if this would work with AlphaBlending.


Drekinn(Posted 2004) [#11]
Thanks for the feedback guys.

Billamu: Where can I find this GIMP program? I'm using Photoshop 6 by the way. Any specific walk-through help would be appreciated.

RusWilson: Sounds promising, but it also sounds like you're using BlitzPlus, whereas I'm using Blitz3D, which does not use the 'LoadSprite' command. :( If you know how I can do this with Blitz3D then please teach me.

Thanks,


Billamu(Posted 2004) [#12]
gimp.org is a good place to start.
http://www2.arnes.si/~sopjsimo/gimp/stable.html if you want an installer to help set things up.

Blitz3D does too use the 'LoadSprite' command:

LoadSprite ( tex_file$[,tex_flag][,parent] )
maybe you're thinking of LoadImage.


Gabriel(Posted 2004) [#13]
There's a Photoshop plugin called SuperPNG ( free ) which dramatically improves the PNG export of PS6.

See if it helps any :

http://www.fnordware.com/superpng/


N(Posted 2004) [#14]
I'm using Blitz3D, which does not use the 'LoadSprite' command


S = LoadSprite( "image.extension", 1+2+8+16+32 ) ; Color + Alpha + MipMaps + Clamp U + Clamp V


Blitz3D does have LoadSprite. I think BlitzPlus doesn't.


jfk EO-11110(Posted 2004) [#15]
Yes, using Sprites or maybe better Quads is the best way to get antialiased 2D graphics. Platypus, the successful Game did it and it looks real good with all that lightnig fast Antialiasing.

You need a system, that will simulate Images using Sprites or Quads, then you need a constructor, that is creating all those Quads each Frame in the order you want them to be drawn on screen (this will prevent alpha zorder troubles).

Not a big deal at all. As a bonus you'll be able to zoom and rotate images in realtime.

I wouldn't use Loadsprite, because you need to rebuild the scene each frame (as I said above). Better use Createsprite and then Entitytexture them with some Textures you hold in Memory permanently.


Anthony Flack(Posted 2004) [#16]

Platypus, the successful Game did it and it looks real good with all that lightnig fast Antialiasing.



I guess it looks pretty good without it too, since it was written in blitz 2d and uses no transparency...

But I am using quads these days, and the antialiased edges are a huge improvement.


jfk EO-11110(Posted 2004) [#17]
Hu? Am I confusing things again? I thought the platypus gfx where antialiased? Or have there been multiple versions?


Anthony Flack(Posted 2004) [#18]
Nope, I think you're confusing things again :)


Drekinn(Posted 2004) [#19]
Thanks for the feedback all.

Ah yes, 'LoadSprite' is a Blitz3D command it seems, but it's a 3D command, whereas my program is 2D.

Anthony Flack: What are quads? How do I achieve anti-aliasing using them? Any info would be appreciated.

Thanks,


Anthony Flack(Posted 2004) [#20]
A quad is a 3d object made up of 2 triangles. A 3d rectangle, basically.

You can achieve anti-aliasing with them, because they use 3d hardware, which supports the alpha channel. You will need blitz 3d for this.

Check out 2d-in-3d or words to that effect in the code archives, there's some examples in there (link someone?)


Rob(Posted 2004) [#21]
My sig has some single surface stuff that illustrates this.


MrCredo(Posted 2004) [#22]
check this:
http://www.blitzbasic.com/Community/posts.php?topic=35539

OK, BB can load alpha-channel from png-file - but i don't know how to save this mith my photoimpact... So i wrote a app to find alpha-pixels...