www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/20/01:16:48

From: "LSC" <liausc AT pl DOT jaring DOT my>
Newsgroups: comp.os.msdos.djgpp
Subject: ALLEGRO:converting color from 24-bit to 18-bit
Date: 20 Jul 1998 05:14:03 GMT
Organization: Unconfigured
Lines: 20
Message-ID: <01bdb3a5$7d5a7d60$1d6e8ea1@a>
NNTP-Posting-Host: j15.jrc25.jaring.my
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi people.

I'm trying to read a win95 bmp image file but fail because I cannot get the
original color pallete. I think the problem is because bmp file use 24-bit
color and allegro uses 18-bit color. So I need help on how to convert
24-bit color to 18-bit color.

Or maybe my code is wrong. Here's the code that I use to get the pallete, I
read the bmp file into file_buf(unsigned char).

	pallete color_pal;
	pp=55; cc=0;
	do {
		color_pal[cc].b=file_buf[pp];pp++;
		color_pal[cc].g=file_buf[pp];pp++;
		color_pal[cc].r=file_buf[pp];
		cc++; pp+=2;
	} while (cc<256);

Thnx for any help.

- Raw text -


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