- From: Paul LeBeau <paul.lebeau@gmail.com>
- Date: Wed, 28 May 2014 02:01:57 +1200
- To: "Dr. Olaf Hoffmann" <Dr.O.Hoffmann@gmx.de>
- Cc: www-svg <www-svg@w3.org>
- Message-ID: <CACfsppB=e5ss-he895u07wHud2Ojqg2nB2ghgw4k6DN9xs6=uw@mail.gmail.com>

I'm not saying that there aren't potentially large variations between the cheat and the correct bbox. Just that in most cases where you are applying a pattern or gradient, the shape probably has an aspect ration that is not far from 1:1. The fact that it appears not a lot of people have complained about it probably indicates that either: (a) people don't care (b) haven't noticed the difference (c) use userSpaceOnUse coords most of the time I'm also definitely not arguing that it shouldn't be fixed. :) Paul On 28 May 2014 00:37, Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de> wrote: > Paul LeBeau: > > It seems that pretty much all of the browsers, except FF, cheat and > return > > the extent of the transformed-bbox. Probably because calculating the > true > > bbox of some elements (like complicated paths) is a little tricky. > > Especially since the bbox needs to be calculated and available before > any > > rendering takes place. And in most cases it doesn't make a lot of > > difference if it is a little too big. > > > If you have for example: > <g stroke-width="10" stroke="url(#MyGradientUsingBoundingBoxUnits) red"> > <path d="M0,0 1000,1000" transform="rotate(-45)" /> > </g> > it would be a big difference. > If you determine the boundingBox before transformation: > '0 0 1000 1000' and apply the transformation to this rectangle: > '0 -1000/sqrt(2) 1000*sqrt(2) 1000*sqrt(2)' > correct: > '0 0 1000*sqrt(2) 0', this means, that one cannot apply for example > gradients and patterns with objectBoundingBox units to this - here > the stroke will be red instead of the gradient. > > Indeed, even for rect elements the difference can be relevant: > <rect width="100" height="100" rx="50" transform="rotate(-45)" /> > This is as well a circle, the size in width and height of the boundingBox > is > always 100 and not sqrt(2)*100. > > And what about scaling? > <path d="M0,0 1000,1000" transform="scale(1,-1)" /> > Will this 'cheating' result in '0 0 1000 -1000'? ;o) > > More problems with skewing and general matrix transforms. > The difference can be of several orders of magnitude - or as > shown for the gradient example - arbitrary. > The cases, where the difference is not relevant, seem to be > the exceptions ;o) > > > > > If one has a good algorithm to determine the boundingBox of an object > without transformation, the extension to get it right for transformed > objects > should be a solvable problem (because one only has to transform all points > and control points of the equivalent paths of the objects and analyse this > instead). > Obviously this is more difficult for the stroke of an object. > > > Olaf > >

Received on Tuesday, 27 May 2014 14:02:48 UTC