2016-04-07 11:52 GMT+02:00 Aliaksei Syrel <[email protected]>: > > 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). >
Do we need an AthensCanvas>>#isVisible: ? > > 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. > Even if it would not speed up extent calculations, I would prefer too, to have EllipsePath, PolygonPath, ..., It is much more convenient to work with explicit classes than to define everything with a Path, even if everything is just a Path :-) > > 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 >
