[fpc-devel] TFPCustomCanvas Expanded Clipping

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Nov 30 11:24:00 CET 2011



On Wed, 30 Nov 2011, zeljko wrote:

> On Wednesday 30 of November 2011 10:35:59 michael.vancanneyt at wisa.be wrote:
>
>> Create TBaseClipRegion with abstract method PointIsInRegion(P : TPoint)
>> (and maybe some others, like line intersections or so).
>>
>> Create a descendent TRectClipRegion with property ClipRect: TRect.
>> It can implement the abstract method(s).
>>
>> Then implement the ClipRegion property, as you propose.
>>
>> Setting the ClipRect property just sets ClipRegion to a TRectClipRegion
>> instance with the Rect filled in. (TFPCustomCanvas should own this
>> instance, i.e. destroy when canvas is destroyed)
>>
>> Property clipping just determines whether the ClipRegion object
>> is used, yes or no.
>>
>> Seems pretty straightforward to me, backwards compatible, and only a single
>> extra property is introduced (ClipRegion).
>
> +1. That's how qt organized it's painting (QPainter)
> ClipRect = bounding rect of clip region (region can have more than 1 rect eg.
> poly region).

For the record: I am not affiliated with Qt in any way ;-)

Michael.



More information about the fpc-devel mailing list