Board index » delphi » How do I create a 16 color bitmap?

How do I create a 16 color bitmap?

I just found out that a TBitmap.Create always creates a 24-bit bitmap.
while i only use 16 color bitmaps to display/assign button glyphs, and
save a bitmap cache (which is saved as 24-bit), this is not desireable.

What do I have to do to create 16 color (4-bit) bitmaps, and save them
as such? (I can't make head or tales of palettes...)

Using Delphi 1 and WfW 3.11.

-- Erwin Dokter
   mailto:erwin.dok...@tip.nl
   http://www.tip.nl/users/erwin.dokter

 

Re:How do I create a 16 color bitmap?


Quote
Erwin Dokter wrote in message <361A26E8.7...@tip.nl>...
>I just found out that a TBitmap.Create always creates a 24-bit bitmap.
>while i only use 16 color bitmaps to display/assign button glyphs, and
>save a bitmap cache (which is saved as 24-bit), this is not desireable.

>What do I have to do to create 16 color (4-bit) bitmaps, and save them
>as such? (I can't make head or tales of palettes...)

>Using Delphi 1 and WfW 3.11.

In D1, I guess you'll have to study the Windows API calls and do this
yourself.  It would be far easier to upgrade to D3.

In D3/D4, Scanline and PixelFormat give you control over this.  For a
pf4bit code example, take a look at
www.infomaster.net/external/efg/Library/Delphi/Graphics/pf4bit.txt

For information about Scanline and PixelFormat, look under TBitmap on
www.infomaster.net/external/efg/Library/Delphi/Graphics/VCLRTL.htm

efg
_________________________________________
efg's Computer Lab:  http://infomaster.net/external/efg

Earl F. Glynn                 E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

Other Threads