[fpc-devel] TFPCustomCanvas Expanded Clipping

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Nov 30 14:15:05 CET 2011


On Wed, Nov 30, 2011 at 1:33 PM, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
> What's the purpose of your clipper?

I use/will use the same clipper (lcl/lazregions.pas) for a multitude
of purposes:

1> To prevent subcontrols from painting outside their area in LCL-CustomDrawn
2> To implement Canvas Region Clipping in lazcanvas (which is the
Canvas from LCL-CustomDrawn). This feature is utilized for example by
fpvectorial to be able to render PostScript correctly
3> To implement TWinControl.SetShape in LCL-CustomDrawn
4> To verify to which control a mouse/touch event bellongs to in
LCL-CustomDrawn.

> IMO the window manager uses an update region internally, from which one or
> more paint requests are generated, for rectangular ClipRects.

It looks like that you are confusing Invalidate Rect with canvas clip
regions. They are not the same thing.

> I'm not sure how far non-rectangular clipping regions are supported by all
> widgetsets, and wouldn't rely on such a capability.

I use canvas clip regions in fpvectorial so I know that at least
LCL-Win32, LCL-Qt and LCL-Gtk2 support rectangular, poligonal, rounded
rect and elliptical regions. From poligonal regions you can also
support arbitrary paths by using a transformation implemented in
fpvectorial. So summing up you can have pretty much any kind of region
that you imagine. I think that only rarely used corner cases like
internal holes in regions and poligons with lines which cross one
another are not currently implemented. LCL-Carbon is a bit behind from
what I remember, but I don't quite remember what exactly is missing or
if I already fixed it.

-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list