Mail Archives: djgpp/1998/04/22/21:45:38
Michal Mertl writes:
>> To show at what speed a line should be typed, a coloured bar moves
>> along the text line making a background for the text, changing the
>> original white background to, for example, green. I would like to do
>> this without rewriting the text,
>
> Do you mean to draw the text only once? If so you can't do that with
> any Allegro function.
Actually it could be done using a translucent drawing mode. Set up a
custom color_map table that will map every source/dest combination to an
unmodified copy of the source color, except when the destination value
is your text color, in which case the table should contain a copy of
this dest color. Call drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0), and
your rectfill() calls will skip over the text.
If you don't like to generate the mapping table in code, it can be
produced using the colormap utility, eg:
colormap trans palette.pcx colormap.bin 255 255 255 ds=<col>
where palette.pcx contains the palette your program is using, and <col>
is the color of your text. This will produce the colormap.bin file,
which can be loaded by your program and referenced by the global
color_map pointer.
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa
- Raw text -