From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Background colour for text using Allegro Date: Wed, 22 Apr 1998 19:20:38 +0100 Organization: None Message-ID: References: <6h50av$f3s AT news DOT network DOT com> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 30 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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= where palette.pcx contains the palette your program is using, and 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