Link to home
Start Free TrialLog in
Avatar of sarrazip
sarrazip

asked on

Converting 65536/256-color bitmap to 16 colors under Win16

Under Win16, I have a 65536-color or 256-color bitmap
(of size 32x32 because it's an icon's XOR mask) and I
want to convert it to a 16-color bitmap (I need to write
a 16-color XOR mask into a .ICO file). I am using Visual
C++ 1.52c under Windows 95/3.1.

What is the algorithm in C/C++ to do this?
ASKER CERTIFIED SOLUTION
Avatar of jnewlin
jnewlin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sarrazip
sarrazip

ASKER

The original bitmap has 16-bit entries. I try to use
GetSystemPaletteEntries() to obtain a COLORREF
from a 16-bit entry, using the HDC returned by GetDC(),
but it fails.

Anyway, I have found a different method that involves
GetBitmapBits() and CreateBitmap() and no HDCs, assuming
that the goal is to produce a .ICO file.

Thanks.