Board index » delphi » A 24bit Color bitmap

A 24bit Color bitmap

Hello,

I need to have a DC with a 24bit color bitmat in any windows screen modes
(16 Color, 256 Color, 16bit color, ...) then draw my drawing (with 24bit
color pens) in it. I can create a 24bit color bitmat and select it for any
DC (CreateBitmap, SelectObject). But when I finish my drawing and save this
bitmat to disk, there is no drawing in it! I don't want this DC be visible.
Drawings is in background.

I mean, how can a program produce a 24bit color image file while is running
under 256 colors Windows mode?

Thanks very much.

Bob Daneshfar
b...@dpi.net.ir

 

Re:A 24bit Color bitmap


Bob:

Quote
bob wrote in message <9812109132.AA913266...@dpi.net.ir>...
>I mean, how can a program produce a 24bit color image file while is running
>under 256 colors Windows mode?

It's easy to create a pf24bit TBitmap in memory in any color mode, but it's a bit of a pain to display such a bitmap in 256 color
mode.

A 24-bit bitmap has all the color information stored in each pixel -- it doesn't need a palette.  A 24-bit image can have thousands
of colors in it.  So the challenge is to pick the best 236 colors for display in 256 color mode.  (In 256 color mode, Windows
normally reserves 20 colors for its use.)

So you need a palette to display your pf24bit bitmap in 256 color mode.  See the Show Demo One Lab Report for an example of how to
do this.  This only create a palette for display of the 24-bit bitmap, it doesn't reduce the pf24bit bitmap to a pf8bit bitmap.
http://www.efg2.com/lab/Graphics/Colors/ShowDemoOne.htm

For other info about palettes in Delphi, look for "Palettes" in the Color section of
http://www.efg2.com/lab/library/Delphi/Graphics/Algorithms.htm

For general info about palettes in Windows, look at the "Palettes" section of
http://www.efg2.com/lab/Library/Color.htm   In particular, look at the links to the Microsoft "Q" reports "Palette Manager:  How and
Why It Does What it Does" and "Palettes Self-Study Module."

Happy Holidays,
efg
_________________________________
efg's Computer Lab:       www.efg2.com/lab
Delphi Books:  www.efg2.com/lab/TechBooks/Delphi.htm

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

Other Threads