From: Sergio Masci (sergio@titan.demon.co.uk)
Date: Sun 09 Jul 2000 - 17:59:56 IDT
> I'm writing a simple little program that displays a bitmap file using > svgalib. For the sake of simplicity, I am using only non-compressed, > 8-bit Windows bitmaps. > For some reason, I cannot get the color settings right when displaying the > image. I was hoping someone might be familiar with the bitmap file > format. > > In the image, the color map starts at 0x36, and contains 1024 bytes: 256 > blue-green-red settings with a dummy byte at the end of each. e.g. > byte b; > byte g; > byte r; > byte dummy; > > So, I read all of those into this arrayn, then iterate through each, > calling vga_setpalette for each bgr triplet (and I am remembering to > reverse the b and r when I call it). > > It seems as though it should be as simple as that, but the colors are > always off. Does anyone have any ideas why this is? > > thanks, > > -pat > > Before applying the BMP colours to the hardware colour palette (via vga_setpalette) try the following mystical incantation - it may help. svgalib_red = (bmp_red >> 2) & 0x3f; svgalib_green = (bmp_green >> 2) & 0x3f; svgalib_blue = (bmp_blue >> 2) & 0x3f; Regards Sergio
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST