From: Shawn Hargreaves 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: References: 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. */