Usually on windows programming the color codes we use that belongs to 32bit color palate. It seems all fine when running the application on one platform devices as they have common specification. The problem arises when you switch your code from 32bit devices to 16bit where color code looks similar but it display differently. For example the color if RGB(145,23,59) would not look same when you simply covert this to 16bit values.
Here is the byte conversion from 32 bit color code to 16 bit code:-
Hope above code should resolve your issues.
Here is the byte conversion from 32 bit color code to 16 bit code:-
DWORD dwColor32;
//converting to WORD;
WORD r = (WORD) ( (dwColor32 & 0x00F80000) >> 19 );
WORD g = (WORD) ( (dwColor32 & 0x0000FC00) >> 5 );
WORD b = (WORD) ( (dwColor32 & 0x000000F8) << 8 );
WORD wColor16 = r | g | b; // converted color in 16bit having same color palate
Hope above code should resolve your issues.
No comments:
Post a Comment