w3c / svgwg

SVG Working Group specifications
Other
710 stars 133 forks source link

Proposal for addition of new commands in the Path Data language #572

Open ratishphilip opened 6 years ago

ratishphilip commented 6 years ago

The SVG path data language provides a simple way for describing complex geometries.

I have authored the Win2d Mini Language specification (which is based on the SVG Path data language). It has been implemented to create geometries using the Win2d library and the Windows 10 Composition layer. The Win2d Mini Language specification consists of several other commands (apart from the SVG path commands) which can be used to specify geometries of common figures and color and brushes etc.

I would like to propose the addition of the following commands in the Path data for SVG which can be useful for creating figures easily

Ellipse Figure

Command Parameter
O (absolute) or o (relative) (radiusX radiusY x y)+

Adds an Ellipse figure to the path. The radiusX and radiusY parameters denote the elliptical radii on the x-axis and y-axis respectively. (x y) denotes the center of the ellipse. The current point remains unchanged.

Polygon Figure

Command Parameter
P (absolute) or p (relative) (numSides radius x y)+

Adds a n-sided Polygon figure to the path. The radius parameter denotes the elliptical radii on the x-axis and y-axis respectivelyhe radius of the circle circumscribing the polygon vertices. (x y) denotes the center of the polygon. The current point remains unchanged.

Rectangle Figure

Command Parameter
R (absolute) or r (relative) (x y width height)+

Adds a Rectangle figure to the path. (x y) denotes the top-left corner of the rectangle. The current point remains unchanged.

RoundedRectangle Figure

Command Parameter
U (absolute) or u (relative) (x y width height radiusX radiusY)+

Adds a RoundedRectangle figure to the path. (x y) denotes the top-left corner of the rectangle. radiusX and radiusY denote the radii of the corner curves on the x-axis and y-axis respectively. The current point remains unchanged.

litherum commented 6 years ago

Why can't the author use elliptical arcs, horizontal and vertical lines, and a mixture of the two, to achieve the desired effects?

ratishphilip commented 6 years ago

It is just for the convenience of the author. For example, creating a Rectangle would require one command instead of providing two horizontal and two vertical line commands.

Rectangle, RoundedRectangle and Ellipse are commonly used geometries. It would be great if a convenient command was provided which would encapsulate the creation of the required horizontal lines, vertical lines or arcs.