Something I don't understand, when using colorize effects any pixels that are full white are untouched so there appears to be no way to get any full bright colors (ie RGB:255, 255, 255). And vice versa since white is untouched by tinting I have to use a grey base image to get a solid color, and then there is no way to get back to white when needed.
This has arisen again now that I am trying to use the new text features and get some colored fonts. I am trying a grey font, and I can get acceptable colors with that, but then there is no way I can get back to white. So it appears to be a choice with either colors or white...
So the heart of my question is, how do I get full bright colors using colorize, and/or how do I get white.
Hi,
The colorize function was never meant to be performed in real-time. It's actually quite advanced and operates in two different color scales in the HSV color spectrum. The gray color you found is the V breakpoint between these two scales.
If you simply want to change the color of your font I would recommend simply using GetBuffer() and then just loop through the pixels. You would probably have to pre-render the fonts in different colors for this to work. But it will be much faster than colorizing in real time..
I'm not overly concerned about speed at this point. I just want to be able to draw a number of different font colors, too many to prerender I feel.
Using GetBuffer on a duplicate font and then storing it in memory may be faster but its a waste of memory. Its important for my needs to use some colored fonts, but its not something that is always happening, and as I mentioned speed is not a concern. Its been plenty fast so far.
My last post kinda mixed up tint and colorize a bit, its colorize that I was talking about.
You could always have your own bitmapped font and load that into a surface.
Then you can do your own DrawText functions and colorise at will.
The thing to remenber with colourise is that it take the hue and saturation from the colour supplied, and the luminance from the surface.
Draw all you chars in 100% red, or 100% green then colorise.
Or you could draw the font in white and use multiply.
I don't know your requirements exactly, but one option you might consider is the DrawVGAText function I added to PocketFrog.
This function allows you to use any standard VGA font (non-proportional) to draw with, and it's a trivially simple function that accepts an RGB value to draw in. I've already ported it to GD, I'd be happy to share if it would be helpful.
You of course can't get as fancy a font as you can with a bitmap approach, but depending on your needs it may be sufficient (and it actually looks rather nice on a PocketPC screen, as well as smoothed out by DX on a desktop).