On Thu, Apr 7, 2016 at 11:15 AM, Igor Stasenko <[email protected]> wrote:

> That may, indeed make accessing such properties like clipRect impossible
> to get, since clipped area cannot be represented by a simple rectangle
> anymore.
> But then you could, perhaps instead provide a protocol to tell if given
> point/bounds/shape is fully outside currently clipped region(s) or not.
> And thus, you don't have to worry about cliprect anymore.
>

In Sparta I use cairo_clip_extents to get current clip rect in local
coordinates. Together with cairo_path_extents, implementation of
AthensCanvas#>>#isVisible: becomes trivial even for arbitrary path (+
assuming that Rectangle is polymorphic with Path).

Btw, for simple paths (circle, ellipse, text, rectangle) it is an overkill
to ask cairo for path extent that is why it makes sense for optimisation to
have subclasses of Path like EllipsePath, PolygonPath and calculate extent
in Pharo. If user uses Factory than extent detection degrades to
cairo_path_extents.

So, in Sparta (now it is still BlPath) there is Path>>#bounds that by
default uses cairo_path_extents, still allowing user to override it and
implement optimised Pharo version :)

Cheers,
Alex

Reply via email to