- From: Dirk Schulze <dschulze@adobe.com>
- Date: Thu, 4 Sep 2014 18:29:00 +0000
- To: Rik Cabanier <cabanier@gmail.com>
- CC: "Dr. Olaf Hoffmann" <Dr.O.Hoffmann@gmx.de>, "public-fx@w3.org" <public-fx@w3.org>
On Sep 4, 2014, at 5:35 PM, Rik Cabanier <cabanier@gmail.com> wrote: > > > > On Thu, Sep 4, 2014 at 6:59 AM, Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de> wrote: > Dirk Schulze: > > “Inflate a rectangle” is an often used expression in computer science and > > means that a rectangle is enlarged by a specified amount. The rectangle and > > the amount are defined in the spec. > > > > Greetings, > > Dirk > > > > As already mentioned in the question about the draft, it is not obvious, how > to 'Inflate box with the value of delta.' > In this email I already guessed some method, how to enlarge the rectangle, > but not sure, whether this is correct or that this results somehow in the > intended box with some intuitive relation to the stroke of the shape (if this > is really the task, not described at all in the CR for this feature). > > The current prose can result in different implementations for such an > inflation - those may contain additive operations or multiplicative or even > complex approximations or a mixture of all of this. > The result is not necessarily always related to what I assume is intended: > The smallest box aligned horizontally and vertically in the local coordinate > system, that contains a stroked object or group of stroked objects (not > excluding objects without stroke). > Because there is no prose about such a purpose or functionality of a > stroke bounding box, it is not even obvious, that my assumption is > correct or that others may have other assumptions about this, > especially due to the complexity of the problem to render combinations > of stroke properties, even if stroke dashing is explicitly excluded. > > The canvas 2d spec defines how to convert a stroked path into outlines: http://www.w3.org/TR/2014/CR-2dcontext-20140821/#trace-a-path > Does that algorithm suffice? We've talked about referring to it to define stroking in SVG. That algorithm does not seem suitable for the use case of a stroke bounding box. It creates the outline path of a stroked path which is a different topic. The stroke bounding box algorithm here computes an approximation of the rectangular boundaries of a stroked path, not taking dash array into account — on purpose. > > I still have a lot of fun examples with strange rendering results > for objects where the width of a stroke is bigger than the typical > diameter of the object - therefore I assume, that if there is no precise > prose or formula for this, here we can get soon some more test-fun > and surprises with non trivial examples for paths. No, just inflate the box with the computed delta as described in the spec. Your suggested algorithm should work just fine. Even simpler: 1) Subtract delta from the rectangle's horizontal and vertical position. 2) Double delta and add it to the rectangle’s width and height. So we have different algorithms but the same outcome arithmetically. The used algorithm may depend on the user agent’s internal representation of rectangles. Greetings, Dirk > 'Inflate box with the value of delta.' is in general not testable, at least > not with quantitative tests. > > Olaf > > > >
Received on Thursday, 4 September 2014 18:29:28 UTC