Hi,
I have created a font system using images. The image consists of black letters with anti-aliasing. I would know like to change the colour of the image at runtime from black to say orange. The problem I'm having is to do with anti-aliasing. I worked out a quick way to subtract the differences between pixels, and the result is not bad... however, it is still not good enough.
How can I change the colour of my black anti-aliased image to another colour?
Thanks
Change image colour
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
You need to use MODULATE. See my pgeFont library for more details.
http://insomniac.0x89.org/index.php?id=77
http://insomniac.0x89.org/index.php?id=77
The canonical way of doing this is to save the entire charset as a whole image with the chars monospaced and drawn in white on a white background, delineated only with alpha. In your rendering functions you can use sprites (what in standard openGL is called billboarding or impostoring) with the desired letter (portion of the charset texture) mapped onto it and the desired color specified as the "vertex" color. Be sure to set the GE state machine properly (i.e. texture mapping on, alpha channel on, z-buffer off, etc..)
Thanks everyone for your input.
I am definitely using an image including all possible characters. I've already done all the work in regards to grabbing characters for the image and displaying...
So, essentially regardless of whether the image I'm displaying has a character in it or some other interesting picture, I need to accomplish the same thing, i.e.in layman terms transform the main colour of the image.
Jean, I will give this a try. I'm new to graphics so I'll probably get back with a 'how do I...'.
Thanks so far.
Josh
I am definitely using an image including all possible characters. I've already done all the work in regards to grabbing characters for the image and displaying...
So, essentially regardless of whether the image I'm displaying has a character in it or some other interesting picture, I need to accomplish the same thing, i.e.in layman terms transform the main colour of the image.
Jean, I will give this a try. I'm new to graphics so I'll probably get back with a 'how do I...'.
Thanks so far.
Josh
Hi Jean,
I managed to get a sample working on its own using sprites.
I currently draw png graphics on screen as GU_TRIANGLE_STRIP. So what I did was draw my image as normal, then after draw the sprite on top. The sprite would appear and the whole screen would suddenly go blank.
Is there some problem in using the two drawing methods together?
Thanks,
Josh
I managed to get a sample working on its own using sprites.
I currently draw png graphics on screen as GU_TRIANGLE_STRIP. So what I did was draw my image as normal, then after draw the sprite on top. The sprite would appear and the whole screen would suddenly go blank.
Is there some problem in using the two drawing methods together?
Thanks,
Josh
I really don't have time to get this working as I have loads of other tasks to do in this app. I'm willing to pay someone to create a few functions that will:
1. accept an image (with black characters on a white background) as an input and convert it to:
- White characters on an orange background
- Orange characters on a white background
- Black characters on a grey background
Now, the image has anti-aliasing, so this must be converted as well. I'm using the graphics.h library for basic image png loading and image drawing. I can provide the framework for you. If anyone can do this for me please contact me.
Thanks,
Josh
1. accept an image (with black characters on a white background) as an input and convert it to:
- White characters on an orange background
- Orange characters on a white background
- Black characters on a grey background
Now, the image has anti-aliasing, so this must be converted as well. I'm using the graphics.h library for basic image png loading and image drawing. I can provide the framework for you. If anyone can do this for me please contact me.
Thanks,
Josh