typedef unsigned short ushort;#pragma pack(push)#pragma pack(1)struct Color555 { ushort red : 5; ushort green : 5; ushort blue : 5;};struct Color565 { ushort red : 5; ushort green : 6; ushort blue : 5;};#pragma pack(pop)void convert(Color555 &from, Color565 &to){ to.red = from.red; to.green = from.green; to.blue = from.blue;}
BTW: I assumed your pixelformat was RGB. If its BGR you need to reverse red and blue.
You can also use bitshifts. Perhaps someone else will explain them to you, my fingers hurt.
ALL YOUR BASE ARE BELONG TO US
Edited by - Countach on February 19, 2001 9:37:15 AM