[fpc-devel] TFPCustomCanvas Expanded Clipping

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Nov 30 09:41:43 CET 2011


Hello,

I am facing a problem with clipping in TFPCustomCanvas because it has
these properties:

    property ClipRect : TRect read GetClipRect write SetClipRect;
    property Clipping : boolean read GetClipping write SetClipping;

Which obviously is not extensible for non-rectangular formats. I
already have written my own extensible and object oriented clipper,
but I'm unsure how to properly integrate it into TFPCustomCanvas. To
diminish code duplication and to allow fpvectorial to use
TFPCustomCanvas it would be good if TFPCustomCanvas and it's
descendents are at least aware that someone might use a different kind
of Clipping.

So I am thinking of adding these properties in TFPCustomCanvas:
  property ClipRegion: TObject read GetClipRegion write SetClipRegion;
  property RegionClipping: Boolean read GetRegionClipping write
SetRegionClipping;

So TFPCustomCanvas would be aware that we are can have an extended
clipping, although it by itself does not know how to process it. Here
I see 2 options of how to interprete the 2 clipping systems:
1> Make them independent, so if you set both Clipping and
RegionClipping you might get 2 clippings done o.O
2> Make them dependent, so RegionClipping only sets if ClipRect or
ClipRegion should be used. Instead of checking for Clipping it would
check for (Clipping and not RegionClipping) to apply the ClipRect

The generic object TObject is utilized here for ClipRegion because
TCanvas and TLazCanvas will use different regions, which match only in
LCL-CustomDrawn.

what do you think?

-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list