W3C home > Mailing lists > Public > www-svg@w3.org > July 2003

Specifying the minimal boundingbox/viewport for paths

From: Steve Schwarz <saschwarz@hotmail.com>
Date: Tue, 01 Jul 2003 13:18:17 +0000
To: www-svg@w3.org
Message-ID: <1057787334.IAA22192@phantom.w3.org>

I've searched the archives/read some of the SVG specs and can't really
find a solution for this problem:

I'm using Cocoon/Batik to extract/repurpose SVG paths contained in an
XML doc via XSLT to generate individual SVG docs containing only the
path. A single path is primarilly long strings of multiple bezier cubics; 
but can contain
moves and lines too.

I can't figure out: given a set of arbitrary points and control
points within a complex path what the minimal bounding box would be so I can
set it in the svg element's width/height/viewBox attributes.

There is a programmatic solution:
I have found/modified some code to interpolate the bezier cubic, etc
to determine points on the paths; I could then determine min/max
points...but this is screaming for a better way (I would effectively
have to "render" the path to determine the bounding box).

But I'm hoping the SVG spec might support a means for specifiying to the 
rendering engine that the boundingBox is to contain the path for me?

It looks like clippingPaths and masks can be configured to be applied to an 
object's boundingBox - so the rendering engines need to support this type of 

Can I specify in the svg element (or some other element) that the
viewBox be the minimal size (i.e. a boundingBox-like argument) of the
contained element(s) (in this case a path element) w/o changing the scale or 
aspect ratio of the
contained elements?

Thank you for you assistance

The new MSN 8: advanced junk mail protection and 2 months FREE*  
Received on Tuesday, 1 July 2003 09:19:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:56 UTC