Board index » delphi » I am looking for a tutorial on using palettes

I am looking for a tutorial on using palettes

Delphi help file says about Tcolor:
If the highest-order byte is zero ($00), the color obtained is the closest
matching color in the system palette. If the highest-order byte is one
($01), the color obtained is the closest matching color in the currently
realized palette. If the highest-order byte is two ($02), the value is
matched with the nearest color in the logical palette of the current device
context.

Apparently palettes are used in all modes also in 24bits per a pixel mode
as I tried changing the highest-order byte of a component color from $00 to
$01, and the component color changed. I was in true color mode.
   I noticed that using palettes can make quick changes on screen. How and
when do I use that ? Also, if I want to avoid changes of color, how do I
make sure that colors on all surfaced used in my application have the
highest-order byte $00 (a part of my application is being made by somebody
else, especially drawings in emf type files) ?

 

Re:I am looking for a tutorial on using palettes


Quote
Mariusz Jdrzejowski <mruc...@kki.net.pl> wrote in message

news:01bf09a4$04b328c0$LocalHost@humanizm...

Hardware palettes are ONLY used in 256 color display mode.  In high/true color
display modes (pf15bit and above) there is no need for a palette since each
pixel contains complete color information.

You can find a number of links about palettes at
http://www.efg2.com/Lab/Library/Delphi/Graphics/Algorithms.htm#Color
In particular, look a the link to the "Microsoft Windows Palette Manager"
article
and "The Palette Manager:  How and Why It Does What It Does."

I have found working with Windows palettes is in general a real pain, and
working with pf24bit images is much easier since palettes are no longer needed.

Quote
> Delphi help file says about Tcolor:

The help file doesn't explain much about when the high order byte is
either $80 or $FF.  See some info about this under TColor at
http://www.efg2.com/Lab/Library/Delphi/Graphics/VCLRTL.htm

Quote
> Apparently palettes are used in all modes also in 24bits per a pixel mode
> as I tried changing the highest-order byte of a component color from $00 to
> $01, and the component color changed. I was in true color mode.

If you have a pf8bit bitmap in high/true color display modes, the palette for
the pf8bit is used to display the bitmap's colors.  However, if you have
pf15bit/pf24bit/pf32bit bitmaps in high/true display modes, then palettes
are NOT used by Windows to display such bitmaps.

Quote
>    I noticed that using palettes can make quick changes on screen. How and
> when do I use that ?

This may be true on some systems, and especially in 256 color display mode,
but on other systems it can take longer to work with palettes than directly
with 24 bits/pixel bitmaps.

I work in 256 color display mode only if absolutely necessary.  Otherwise,
working with 24 bits/pixel data is much easier to program.

___
efg

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

efg's Computer Lab:  http://www.efg2.com/Lab

Other Threads