Re: bounding box of inline SVG

2011/9/12 Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>

> Hello,
>
> what is the idea, how this should work to calculate it automatically,
> if neither the author of the SVG nor the embedding document gives
> information
> about the intended size of the graphics?
>

If the graphics use absolute coordinates, you can calculate their bounding
boxes.
Then by unionizing all the bboxes and account for the transformation
matrices, you would come up with the bounding box of the svg element itself.
If they use relative coordinates (like '%'), you would calculate the
absolute coordinate which allows you to calculate the bbox.


>
> Many of my SVG documents have parts of graphical objects out of the viewBox
> and for several of them it depends on the preserveAspectRatio, what is the
> intention to display, if the aspect ratio of the viewport does not fit to
> the
> viewBox. Obviously, if the embedding document does not provide information
> about size or at least aspect ratio of the viewport, I cannot see how to
> calculate this automatically.
>

With no 'width' or 'height', viewBox becomes meaningless.
It would also need to be calculated on the fly. Not to change the aspect
ratio but to change where the (0,0) point will be located.


>
> On the other hand, for an author of the embedding document it is typically
> simple to provide information about the available viewport, as well as for
> a browser to know the viewport size, if the SVG is not embedded at all.
> Or if size matters for the SVG, it should be simple for the SVG document
> author to provide information about width and height (apart from the
> practical problem, that typical browser do not manage to display absolute
> sizes properly anyway).


I believe that in the future, the author will typically create the HTML and
the inline SVG.
We shouldn't think about them as separate worlds. (I think there was
consensus about this at the Seattle F2F.)
If I move an inline SVG element, I don't want it to be clipped by the parent
SVG header unless I specified a 'width'/'height'

Rik

Received on Monday, 12 September 2011 19:05:43 UTC