[SDL] pixels vs blit
emulynx at delfi.lv
Fri Jan 24 02:39:01 PST 2003
Thursday, January 23, 2003, 9:39:03 PM, you wrote:
>>JE> Doesn't that mean that you can't draw text in different colours though?
>>JE> (Not the original question I know, but still of interest maybe.)
>>JE> Unless you can somehow apply a bitmask while blitting. If your font was
>>JE> stored as white (0xFFFFFF), you could AND with 0xFF0000 while blitting to
>>JE> get red text, for example. Is this possible? Otherwise, how would you draw
>>JE> text of arbitrary colours without plotting pixels individually?
>>Yes, that's the only problem I'm aware of. However I don't need
>>multiple font colors right now so I'm thinking what should I do...
ME> Actually, I use the technique too. If you don't mind using a bit of extra
ME> memory, some preparation and don't want to use all color possibilities you
ME> can do this: I have stored the font in white in a bitmap. When the game
ME> starts I then simply load the bitmap four times, and go along the surfaces
ME> pixel by pixel once to change the color (the masking takes into account the
ME> brightness of each pixel, so that my fonts do display reasonably
ME> anti-aliassed as long as the background is dark ;-).
ME> I know it takes up a lot of video (or system) memory, but it seemed the
ME> best solution at the time for me since I did not have access to any
ME> (useable) font-routines.
Well, my pixel-by-pixel font drawing routine seems to be much more
customisable... It's possible to create any color font surfaces out of
internal fonts which are stored as arrays. And destroy them... I think
I'll leave both options or combine that together, that seems to be
ME> The main disadvantage I am running into at the
ME> moment though, is that it's almost impossible to add support for other
ME> charactersets (e.g. russian, chinese, etc.) without rewriting large parts
ME> of my code. Fortunately I already have most accented characters so that
ME> translation to languages like english, french, german, spanish are possible...
I'm storing characters in array (ASCII 30-127). I can fill that array
with anything I want ;)
http://dotNet.lv mailto:emulynx at delfi.lv
More information about the SDL