[fpc-devel] Correlation between TFPColor and RGB values (possible inconsistencies)

Michael Van Canneyt michael at freepascal.org
Wed Feb 17 11:45:23 CET 2010



On Wed, 17 Feb 2010, Graeme Geldenhuys wrote:

> Luiz Americo Pereira Camara wrote:
>>
>> The point is that the TFPColor constants are inconsistently defined.
>
> I see your point and agree. Some colors have both high and low byte set,
> some other colors do not.
>
>
> @Mattias
> What is the 48bit value for Maroon (#800000)?  R = $8000 or R = $8080 and

Within 256-bit precision, you cannot say which one is correct.

You MUST provide a 48 bit definition of Maroon, only then you can decide
which one is correct.

This is what Mattias is trying to say. Normal 256-bit colors correspond
to a single type. 48-bit colors correspond to double type.

You cannot say anything sensible about double values if your initial
definition is based on a single value.

> assuming all the other values are $0000
>
>
> As defined by fpImage unit.
>
>  colMaroon     : TFPColor = (Red: $8000; Green: $0000; Blue: $0000; Alpha:
> alphaOpaque);
>
>
> This is *incorrect*. It should be:
>
>  colMaroon     : TFPColor = (Red: $8080; Green: $0000; Blue: $0000; Alpha:
> alphaOpaque);

This is not so.

Both definitions are - within the 256-bit color plane - 100% equivalent.
Even the following would be maroon in the 256-bit color plane.

   colMaroon     : TFPColor = (Red: $80FF; Green: $0000; Blue: $0000; Alpha: alphaOpaque);

Compare:
1.2 and 1.0 are, when considered with 0 decimal precision, the same value.

Michael.



More information about the fpc-devel mailing list