From: Grant Byers (messiah777@dingoblue.net.au)
Date: Thu 19 Jul 2001 - 18:27:50 IDT
Hi curious reader, I hope you can help ;-) I have a problem as per the subject, 24 to 16bit RGB conversion. Using svgalib-1.4.3 I use the code below to mask and shift to the apropriate values but my colors come out totally screwed, although the image outline is quite sharp. Have tried both RGB and BGR combinations. vga_modeinfo->colors reports 65536 colors, so i assume 565 16bit color. Not sure if it's relevant, but video card is nVidia TNT2 M64. Machine is AMD K7-T-Bird. Have searched high and low for a solution and tried many different combinations (tried the 555 15bit combo also). Just about at my witts end with this. Has anyone any clue? for ( i = 1; i < bmpinfo.height*bmpinfo.width; i++ ) { /* mask and shift 3 byte RGB values, store as 2 byte RGB */ red = *(WORD *)bitmap24++; red &= 0x00F8, red <<= 8; green = *(WORD *)bitmap24++; green &= 0x00FC, green <<= 3; blue = *(WORD *)bitmap24++; blue &= 0x00F8, blue >>= 3; rgb16 = red | green | blue; *(BYTE *)bmpinfo.image++ = rgb16; /* if complete scanline converted */ if ( i % bmpinfo.width == 0 ) /* point to one above */ bitmap24 -= 6 * bmpinfo.width; } Cheers, Grant -- Before criticising someone, walk a mile in their shoes. Then when you do criticise them, you will be a mile away and you'll have their shoes. ------------------------------------------------------------------ Unsubscribe: To: listbot@svgalib.org Body: unsubscribe linux-svgalib
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST