Masked Fonts
Monday, November 26, 2007 12:59:11 AM
This post is a response to a blog by Sean Howard on SQRL Graphics.
So I advise that you wander over there and read it first: (Find it Here)
I was thinking about the Tileset problem Sean was having with coloring his font images. The difficulty was that any Tileset you import has a single face color. He wasn't too concerned with it, but it was bugging him enough to mention it in his post. I think I have come up with one possible solution.
Double Transparency
Unfortunately I am unsure how Sean's program is currently handling transparencies. It appears that he is using PNG images and so he may be using the image's own transparency and not depending on his program to manage it. If that is the case then this solution will take a bit more work.
If instead he is already handling transparency in the program, well then, the font colors can be handled by running two transparency methods on the Tileset.
The Tileset
Ok so let’s say this is a single tile from our Tileset (grossly enlarged). This one is made up of three colors. What we want to do is have the program treat the color white as a transparent color while loading in the Tileset. We could specify the color in load command, or we could have the program find the pixel in position [1,1] on the Tileset, and we could just always put the font transparency color in that pixel.
So now we have a big ol' Red Block with some black in it, and a few transparent blocks.
The Colorset

The program can have a default colorset, but you should have the option to load your own in with each object.
So this is one color from our colorset. Color tiles have to match the size of our tilesets or we'll get some really funky colouring.
We are going to place our chosen color underneath each of our tiles in our tileset.
The ColorTileset

The idea is that the program stores the new ColorTileset in runtime memory (for the graphics creator, not for the running game itself)
Lastly, the the tileset is actually used and the Red color (or color found in [1,2]) is now the transparent color. (And we would take this time to get rid of that pixel in [1,1] that was white)
And the set is used just like before, except now you have the option of changing the color.
Extras in the the Colorset

We could even store images in our colorset. These images would then be used the same way.

Obviously this brings up a few other problems, but those can be dealt with as they come.
Well there's a possible solution from an amateur. Talk is cheap, hopefully Sean will find some way of implementing font colors. I, for one, look forward to working with his stuff in the future. (We hope he lets us play with it)


So I advise that you wander over there and read it first: (Find it Here)
I was thinking about the Tileset problem Sean was having with coloring his font images. The difficulty was that any Tileset you import has a single face color. He wasn't too concerned with it, but it was bugging him enough to mention it in his post. I think I have come up with one possible solution.
Double Transparency
Unfortunately I am unsure how Sean's program is currently handling transparencies. It appears that he is using PNG images and so he may be using the image's own transparency and not depending on his program to manage it. If that is the case then this solution will take a bit more work.
If instead he is already handling transparency in the program, well then, the font colors can be handled by running two transparency methods on the Tileset.
The Tileset
Ok so let’s say this is a single tile from our Tileset (grossly enlarged). This one is made up of three colors. What we want to do is have the program treat the color white as a transparent color while loading in the Tileset. We could specify the color in load command, or we could have the program find the pixel in position [1,1] on the Tileset, and we could just always put the font transparency color in that pixel.
So now we have a big ol' Red Block with some black in it, and a few transparent blocks.
The Colorset

The program can have a default colorset, but you should have the option to load your own in with each object.
So this is one color from our colorset. Color tiles have to match the size of our tilesets or we'll get some really funky colouring.
We are going to place our chosen color underneath each of our tiles in our tileset.
The ColorTileset

The idea is that the program stores the new ColorTileset in runtime memory (for the graphics creator, not for the running game itself)
Lastly, the the tileset is actually used and the Red color (or color found in [1,2]) is now the transparent color. (And we would take this time to get rid of that pixel in [1,1] that was white)
And the set is used just like before, except now you have the option of changing the color.
Extras in the the Colorset

We could even store images in our colorset. These images would then be used the same way.

Obviously this brings up a few other problems, but those can be dealt with as they come.
Well there's a possible solution from an amateur. Talk is cheap, hopefully Sean will find some way of implementing font colors. I, for one, look forward to working with his stuff in the future. (We hope he lets us play with it)











