|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: Converting 24bit image to 16bit
Didn't pay attention to the start of this thread, but there are two different 16-bit color formats that have been supported, the 565 format that Ender alluded to, and a 555 format. Depending on your platform and image type, it could be either... Kevin Wolfskill JADE Solutions Office US (303) 583-4123 Fax US (303) 449-1548 Kevin.Wolfskill@jadesolutions.com ______________________________________ WARNING - THIS E-MAIL TRANSMISSION IS CONFIDENTIAL. This e-mail transmission (including any accompanying attachments) contains confidential information which is intended for the named addressee only. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution or reproduction of this e-mail is prohibited. If you have received this e-mail in error please contact me immediately. Thank you. _______________________________________ -----Original Message----- From: Mike Main [mailto:anime6@earthlink.net] Sent: Thursday, October 05, 2000 7:56 PM To: gameprogrammer@gameprogrammer.com Subject: Re: Converting 24bit image to 16bit That worked :). Thank you so much!!! I sent an email to Andre LaMothe, and he admitted his error :). He said each color had 5 bits. ----- Original Message ----- From: <EnderWiggenRules@aol.com> To: <gameprogrammer@gameprogrammer.com> Sent: Thursday, October 05, 2000 8:07 PM Subject: Re: Converting 24bit image to 16bit > In a message dated 10/5/00 5:58:25 PM Central Daylight Time, > anime6@earthlink.net writes: > > << Someone help me please. I need to write code to load a 24 bit, bitmap > into a 16 bit buffer. How do I do this. Usually it doesn't work. >> > > OK. If I'm remembering right, I think 24-bit images are stored with one byte > for Red, Green, and Blue, and 16-bit is just the three attributes split over > two bytes. So, if you load a 24-bit image in this order: > RRRRRRRR GGGGGGGG BBBBBBBB > Each color attribute is 8-bit, meaning that it is in the range 0 to 255. > 16-bit (correct me if I'm wrong) is stored in this fashion: > RRRRR GGGGGG BBBBB > The red and blue color attributes are in the range 0 to 31, and the green > attribute is in the range 0 to 63, so what you need to do is convert the 0 to > 255 range to 0 to 31 or 63. This can be done easily by bit shifting. Here's > pseudo-code: > 5BitRed=8BitRed>>3; // 8BitRed/8 > 6BitGreen=8BitGreen>>2; // 8BitGreen/4 > 5BitBlue=8BitBlue>>3; // 8BitBlue/8 > Color=5BitBlue+(6BitGreen<<5)+(5BitRed<<11) > This is the conversion, though depending on the library/video card/driver you > are using, the red and blue may be reversed in positioning. > > -Ender Wiggin > ================================================================= > The GameProgrammer.Com mailing list is for the open discussion > of any topic related to the art, science, and business of > programming games. This list is especially tolerant of beginners. > We were all beginners once > > To SUBSCRIBE or UNSUBSCRIBE please visit: > http://gameprogrammer.com/mailinglist.html > > ================================================================= The GameProgrammer.Com mailing list is for the open discussion of any topic related to the art, science, and business of programming games. This list is especially tolerant of beginners. We were all beginners once To SUBSCRIBE or UNSUBSCRIBE please visit: http://gameprogrammer.com/mailinglist.html ================================================================= The GameProgrammer.Com mailing list is for the open discussion of any topic related to the art, science, and business of programming games. This list is especially tolerant of beginners. We were all beginners once To SUBSCRIBE or UNSUBSCRIBE please visit: http://gameprogrammer.com/mailinglist.html
|
|