delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/14/22:56:19

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with Allegro
Date: Fri, 14 Mar 1997 19:54:43 +0000
Organization: None
Distribution: world
Message-ID: <p0HJaGAD0aKzEwCl@talula.demon.co.uk>
References: <Pine DOT BSI DOT 3 DOT 96 DOT 970310184517 DOT 22850A-100000 AT prg DOT traveller DOT cz>
<I0RB6HAXVaJzEw+l AT talula DOT demon DOT co DOT uk>
<Pine DOT BSI DOT 3 DOT 96 DOT 970314115651 DOT 27298A-100000 AT prg DOT traveller DOT cz>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Michal Mertl writes:
>  bmp=create_sub_bitmap(screen,0,0,800,600);
>  get_palette(pal);
>  save_bitmap(buf, bmp, pal);
>
>It seems like there is a bit more blue than red and green, cause white is
>very light blue and others also seems affected.

Aha. You've stumbled on an obscure 'feature' of the way Allegro handles
palette reads. I don't ever actually read data from the hardware palette
registers (mainly because the VBE/AF interface doesn't provide any way
to do that). Instead I just store a copy of the data every time you call
any palette setting functions, and return this to you when you later
query the current palette. Since your program doesn't ever set the
palette, my internal buffer won't match up with what the video hardware
is using, and you will get the wrong results.

The fix is easy: just call set_palette() after you select the graphics
mode. This is a good idea in any case: most video BIOS mode set
functions will also set up the palette, but there is some variation in
exactly what they set it to...


/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Beauty is a French phonetic corruption of a short cloth neck ornament.
 */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019