[fpc-pascal] TFPColor vs TColor

Michael Van Canneyt michael at freepascal.org
Tue May 5 11:57:27 CEST 2009



On Tue, 5 May 2009, Luca Olivetti wrote:

> En/na Graeme Geldenhuys ha escrit:
> > On Tue, May 5, 2009 at 9:30 AM, Michael Van Canneyt
> > <michael at freepascal.org> wrote:
> > > When designing FPCanvas and so on, streaming was not taken into
> > > consideration
> > > at all. The point was to be able to represent all possible colors,
> > > independent
> > > of a GUI system or streaming system.
> > 
> > Fair enough.... Design without any perceived limitations. ;-)
> > 
> > > > * Can the Reader/Writer support TFPColor
> > > No, because records cannot be published. To do this, you'd need something
> > > like a TGUIColor wrapper, which is a TPersistent:
> > 
> > 
> > Clever idea - I like that. A quick test revealed that streaming to LFM
> > will look like this:
> 
> I'm not sure, but I think that if it is a visual component, changing its color
> it should invalidate/redraw itself.
> With 4 properties it will be redrawn 4 times instead of just one.

There are various ways around this. beginupdate/endupdate for instance.
Setting .Color will set all 4 components at once, and should redraw only
once.

If, of course, you choose to set the RGB separately, then you'll redraw 4
times. But that is up to you. 

Michael.



More information about the fpc-pascal mailing list