Mail Archives: djgpp/1999/03/08/06:46:18
| From:  | ian_dunbar AT my-dejanews DOT com
 | 
| Newsgroups:  | comp.os.msdos.djgpp
 | 
| Subject:  | ALLEGRO: problem with bitmap palette from datafile
 | 
| Date:  | Mon, 08 Mar 1999 11:26:18 GMT
 | 
| Organization:  | Deja News - The Leader in Internet Discussion
 | 
| Lines:  | 40
 | 
| Message-ID:  | <7c0c4k$q57$1@nnrp1.dejanews.com>
 | 
| NNTP-Posting-Host:  | 193.120.210.2
 | 
| X-Article-Creation-Date:  | Mon Mar 08 11:26:18 1999 GMT
 | 
| X-Http-User-Agent:  | Mozilla/4.05 [en] (WinNT; I)
 | 
| X-Http-Proxy:  | 1.0 ns.euristix.ie:80 (Squid/1.NOVM.20), 1.0 x5.dejanews.com:80 (Squid/1.1.22) for client unknown, 193.120.210.2
 | 
| To:  | djgpp AT delorie DOT com
 | 
| DJ-Gateway:  | from newsgroup comp.os.msdos.djgpp
 | 
| Reply-To:  | djgpp AT delorie DOT com
 | 
Hi,
I have a problem displaying a 256 color bitmap. It is displayed as all the
wrong colors. I store the bitmap and palette in the datafile using the
following commands:
dat -a -h images/cardata.h images/cardata.dat images/car.bmp -t BMP
dat -u -h images/cardata.h images/cardata.dat CAR_BMP NAME=CAR_BMP_BMP
dat -a -h images/cardata.h images/cardata.dat images/car.bmp -t PALETTE
dat -u -h images/cardata.h images/cardata.dat CAR_BMP NAME=CAR_BMP_PAL
Then here's how I display the bitmap (more or less anyway, I've removed all
the irellevant code):
// Initialize the screen buffer
m_buffer = create_bitmap (320, 200);
clear_to_color (m_buffer, 0);
DATAFILE *dat = load_datafile ("images/cardata.dat");
if (dat == 0) return 0;
m_sprite = (BITMAP *)dat[CAR_BMP_BMP].dat;
set_palette ((RGB *)dat[CAR_BMP_PAL].dat);
// blit the car onto the buffer
masked_blit (m_sprite , m_buffer, 0, 0, 0, 0, 32, 20);
// Blit the buffer to the screen
blit (m_buffer, screen, 0, 0, 0, 0, 320, 200);
The set_palette definitely changes the palette from the default one, but not
to the one that will display the bitmap correctly. Any idea what I'm doing
wrong?
Thanks,
Ian.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
- Raw text -