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

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Feb 17 11:21:04 CET 2010


On Wed, 17 Feb 2010 06:52:25 -0300
Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:

> Mattias Gaertner escreveu:
> > On Wed, 17 Feb 2010 04:39:26 -0300
> > Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:
> >
> >   
> >> Mattias Gaertner escreveu:
> >>     
> >>> On Tue, 16 Feb 2010 17:15:37 -0300
> >>> Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:
> >>>
> >>>   
> >>>       
> >>>> or
> >>>>
> >>>> colGray be redefined as colGray       : TFPColor = (Red: $8080; Green: 
> >>>> $8080; Blue: $8080; Alpha: alphaOpaque) ??
> >>>>     
> >>>>         
> >>> Yes, although this rarely makes a difference.
> >>>   
> >>>       
> >> It does.
> >> See below.
> >>
> >>     
> >>>  
> >>>   
> >>>       
> >>>> This info will help to fix http://bugs.freepascal.org/view.php?id=15793
> >>>>     
> >>>>         
> >>> IMO the bug report is misleading. Converting a TFPColor to RGB looses
> >>> bits. 
> >>>       
> >> The bug is not about converting to RGB. See the attached example in 
> >> bugreport.
> >>
> >>   SetCol := colGray;
> >>   Img.Colors[0,0] := SetCol;
> >>   GetCol := Img.Colors[0,0];
> >>
> >>   SetCol <> GetCol
> >>     
> >
> > That's exactly what my long response explained. 
> > Why do you expect that the 48bit color constants can be assigned to
> > 24bit images without loss? Is this somewhere wrongly documented?
> >   
> 
> fpimage is not documented at all AFAIK.
> 
> It's not loosing bits if your information, in previous mail, about 
> TFPColor format is correct.
> 
> Defining colGray, and related, as TFPColor = (Red: $8080; Green: $8080; 
> Blue: $8080; Alpha: alphaOpaque) would make it work.

... would make it work with a 24bit color image that uses one pixel
color conversion *$101, div $100.
It won't work on a 24bit color image that uses color conversion *$100,
div $100 or on any other format.

 
> The point is that the TFPColor constants are inconsistently defined.

$8000 is exactly the middle. It is the right value for gray.

Your comparison is wrong. It is as wrong as:

ASingle := ADouble;
if ASingle<>ADouble then ...


Mattias



More information about the fpc-devel mailing list