Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Fonts - Looking for Guidance

Author
Message
Red5
13
Years of Service
User Offline
Joined: 26th Aug 2011
Location:
Posted: 5th Sep 2011 16:19
Hi,

I have created a custom font using a custom font map (subimages.txt), the transparent colour is white and the font looks great most of the time; however, in certain scenario's (such as when a sprite goes under some text there is a nasty white edge creeping through at the edges of the font; I'm assuming this is related to the anti-aliasing that is applied to the font at design design.

In fact, the same fuzzy white edge can be seen on a lot of sprites I've created when they pass over other objects on screen.

I want to avoid using non-anti-aliased images (for font's and sprites) as they can tend to look a little jagged in places.

Anyone suffered with the same issue and have you got any good tips on how to reduce or eliminate this fuzzy edge problem?

Many thanks,

Red.
Red5
13
Years of Service
User Offline
Joined: 26th Aug 2011
Location:
Posted: 5th Sep 2011 16:56
See attached PDF for an example of what I mean.

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 5th Sep 2011 17:43
Quote: "the transparent colour is white "


If you will use a .png format, where the transparent pixels are transparent, then the white fringing should go away.

Red5
13
Years of Service
User Offline
Joined: 26th Aug 2011
Location:
Posted: 5th Sep 2011 18:02
Thank Rich for your suggestion.

I am currently using ".png's" for the sprite and FontMap, I've got the transparency set to white.

You suggested "...where the transparent pixels are transparent", is this different from "setting the transparent colour to white"?

Thanks.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 5th Sep 2011 19:15
Well, if you load a .png file that already has some transparency, then the sprite will automatically have that area transparent.

But that could be moot. Let's see your code...

Red5
13
Years of Service
User Offline
Joined: 26th Aug 2011
Location:
Posted: 5th Sep 2011 19:46
The transparency is clearly working (see the PDF I uploaded above), the issue is just this fringing thing. My code is part of quite a big project and much of the sprite creation is dynamic so is not so easy to post a code snippet, however, this is essentially what I am doing...



The sprites are all created from PNG's with a white background and white is set as the transparent colour and since sprites are created with transparency switched on by default then I can see that the transparency is working.
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 5th Sep 2011 23:33
It's working as designed.

All the white pixels in your image are transparent. Grey pixels (such as those around the edge of your image) are not transparent.

What you need to do is remove the white background and save the images as a PNG with an alpha channel. That way, you can have the grey pixels around your image at a reduced alpha and they will blend in properly.

Any image with a background colour that you then make transparent will have this problem. You should use the alpha channel that the PNG format gives you.

Login to post a reply

Server time is: 2024-11-24 00:17:25
Your offset time is: 2024-11-24 00:17:25