[racket] Bounding Boxes

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Aug 8 22:26:08 EDT 2013

Those bindings do not already exist, as far as I know, but I think
they'd make fine additions to either `dc-path%' or `dc%'.

The implementation of `region%' uses `cairo_clip_extents', so if you'd
like to try the change (it will be a while before I could get to it),
that might be useful code to look at.

At Mon, 5 Aug 2013 18:37:33 +0200, Jens Axel Søgaard wrote:
> Hi All,
> 
> The dc-path% method get-bounding-box computes the bounding box not only for
> the points on the path, but also for the control points defining the path.
> This implies
> that a bounding box can be much larger than the actual path.
> 
> Cairo supports computation of tighter bounding boxes. Some take the
> pen in consideration and some do not:
> 
>     cairo-path-extents  cairo-stroke-extents  cairo-fill-extents
> 
> Am I so lucky that there already exists bindings to these?
> 
> /Jens Axel
> 
> Links to Cairo documentation:
> 
> 
> http://www.cairographics.org/manual/cairo-Paths.html#cairo-path-extents
> Computes a bounding box in user-space coordinates covering the points on
> the current path. If the current path is empty, returns an empty rectangle
> ((0,0), (0,0)). Stroke parameters, fill rule, surface dimensions and
> clipping are not taken into account.
> 
> http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-stroke-extents
> Computes a bounding box in user coordinates covering the area that would be
> affected, (the "inked" area), by a
> cairo_stroke()<http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-stro
> ke>
> operation
> given the current path and stroke parameters.
> 
> http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-fill-extents
> Computes a bounding box in user coordinates covering the area that would be
> affected, (the "inked" area), by a
> cairo_fill()<http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-fill>
> operation
> given the current path and fill parameters.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.