Board index » delphi » 256 Color problem

256 Color problem

I have two problems, both related.

1. How do I obtain the machine dependent colorpalette that is currently in
use? Is there a simple way to obtain the RGB values? Lets say a machine is
set up to 256 colors, then not all RGB values have a valid meaning. And when
a machine has 32768 colors? or 65535? I would like to have something that
says $00.00.00, $00.00.40, $00.00.80, $00.00.C0, $00.00.FF , $00.40.00 and
so forth.

2. I'm using several colors in my app. However when I run my app on 256C
setting the colors all get weard (of course) because there is no 256C
equivalent for the color $803C6E; only an estimation. How do I get Delphi
(or windows) to change those colors to normal 256C equivalents?

I mean three problems
3. When I'm using an image at 65536 colors I get a normal looking picture.
When I'm using a paintbox at 65536 colors I get a normal looking picture.
When I'm using a paintbox at 256 colors I get a weard looking picture,
covered with colored dots (probable the equivalent of the original colors)
How do I get even in 256C mode a normal picture?

Thanks, Camiel

 

Re:256 Color problem


Quote
"Camiel Wijffels" <C.Wijff...@BluePrintST.com> wrote in message

news:8772j4$3vu2@bornews.borland.com...

Quote
> I have two problems, both related.

You might want to study some background material on the use of Palettes in
Windows and Delphi.  In the Color section of this page, look for
"Palettes, Background Information"
http://www.efg2.com/Lab/Library/Delphi/Graphics/Algorithms.htm

Quote
> 1. How do I obtain the machine dependent colorpalette that is currently in
> use? Is there a simple way to obtain the RGB values? Lets say a machine is
> set up to 256 colors, then not all RGB values have a valid meaning.

You might take a look at the Palette Lab Report project:
http://www.efg2.com/Lab/Graphics/Colors/PaletteLab.htm

Quote
>And when
> a machine has 32768 colors? or 65535? I would like to have something that
> says $00.00.00, $00.00.40, $00.00.80, $00.00.C0, $00.00.FF , $00.40.00 and
> so forth.

Palettes are used in pf8bit bitmaps (and below).   In a palettized bitmap,
each "pixel" is really an index into the palette color table.

High color (15/16-bit) and True color (24/32-bit) bitmaps have complete
color information in each pixel.  No palette is necessary for display
of such bitmaps in high color or true color display modes.  However,
with thousands of colors in such images, you need a palette to
display such a bitmap properly in 256 color display mode.  Neither
Windows nor Delphi will help get the "right" palette to display such
a bitmap.  To deal with this, take a look at these Lab Reports:

One Image on Form
http://www.efg2.com/Lab/Graphics/Colors/ShowDemoOne.htm

Multiple Images on Form
http://www.efg2.com/Lab/Graphics/Colors/ShowDemoMany.htm

Quote
> 2. I'm using several colors in my app. However when I run my app on 256C
> setting the colors all get weard (of course) because there is no 256C
> equivalent for the color $803C6E; only an estimation. How do I get Delphi
> (or windows) to change those colors to normal 256C equivalents?

This very much depends on what you're doing.  Even the colors in the
various icons you're using can cause you to exceed the 236 colors you
have in 256 color mode.  (20 colors are reserved by Windows for
display of buttons, panels, icons, etc.)  You must be careful with
every component that isn't using these fixed system colors.

Quote
> 3. When I'm using an image at 65536 colors I get a normal looking picture.
> When I'm using a paintbox at 65536 colors I get a normal looking picture.
> When I'm using a paintbox at 256 colors I get a weard looking picture,
> covered with colored dots (probable the equivalent of the original colors)
> How do I get even in 256C mode a normal picture?

Your weird looking picture is caused with a high color/true color bitmap
is displayed in 256 color mode using a "halftone" palette -- which rarely
looks right.  Perhaps the ShowDemoOne Lab Report mentioned above
will help, but it depends on what else is on your screen.

Palette problems are not fun.

--
efg

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

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

Re:256 Color problem


"Earl F. Glynn" <EarlGl...@att.net> schreef in bericht
news:8777if$jn2@bornews.borland.com...

Quote
> You might want to study some background material on the use of Palettes in
> Palette problems are not fun.

Thank you. Camiel.

Other Threads