W3C home > Mailing lists > Public > www-svg@w3.org > November 2013

RE: New path primitive

From: honyk <j.tosovsky@email.cz>
Date: Sat, 16 Nov 2013 00:48:37 +0100
To: <www-svg@w3.org>
Message-ID: <00f401cee25d$3466a0a0$9d33e1e0$@tosovsky@email.cz>
On 2013-09-21 honyk wrote:
> in my svg files I use lot of circles and render a text on them. As the
> circle itself cannot be used as the textPath target, the final code is
> quite complicated.
> 
> By that new primitive I mean the simple circle. With the center in the
> last coord, with the specified diameter and starting at Ymin. 
> The direction (clockwise/ccw) would be defined by diameter sign (+/-). 
> I propose 'D' symbol as 'd'iameter. It would be case insensitive 
> (relative/absolute doesn't matter here).
> 
> Please compare:
> <circle cx="200" cy="200" r="150"/>
> <path d="M200 50A150 150 0 1 1 200 350A150 150 0 1 1 200 50"/>
> <path d="M200 200D300"/>
> 
> donut:
> <path d="M200 50A150 150 0 1 1 200 350A150 150 0 1 1 200 50M200 100A100
> 100 0 1 0 200 300A100 100 0 1 0 200 100"/>
> <path d="M200 200D300 D-200"/>
> 
> The main difference between A and D is the final coord, which in case
> of D stays in the center.

I've noticed a discussion around a new 'B'earing path primitive so I am
refreshing this topic again.

I went a bit further and 'implemented' an optional angle parameter.

M0 0D5 - circle with the center at 0,0 with a diameter of 5 rendered
clock-wise
M0 0D5 90 - circular arc starting at 0,0 with a diameter of 5 rendered
clock-wise, but only first 90 degrees. Rendering is performed in the I.
quadrant.

Both modes differs in the way of connecting to prev/next path segments.

The direction is specified by the sign of diameter (D5 vs. D-5).
The quadrant is defined with doubled signs, but it could be simplified
(I):   ++ <=> + <=> null
(II):  -+
(III): --
(IV):  +- <=> -

Several examples:
(1) Donut
http://drifted.in/other/donut.png
M0 0D16D-8

(2) Arcs
http://drifted.in/other/arcs.png

(3) Button - rounded rectangle with a cut out
http://drifted.in/other/button.png

Rounded rectangle: M-6 8h16D4-90v-16D4--90h-16D4-+90v16D4 90 (clock-wise)
Cut out: M0 6D-4--90v-2v-2D-4-+90D-4-90h4v-4D-4-90D-4 90v4h4D-4
90D-4-+90h-4v4D-4-+90 (ccw)

What do you think?

>From my experience circular arcs/objects are dominant and I believe this
syntax simplification could help in many use cases. For other cases
(elliptical objects, rotated arcs) there is IMHO no need for this. 

Jan
Received on Friday, 15 November 2013 23:49:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:47 UTC