W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2012

[whatwg] Canvas roundedRect

From: Igor Trindade Oliveira <itrindade.oliveira@gmail.com>
Date: Thu, 21 Jun 2012 09:59:07 -0700
Message-ID: <CAKonRCbeqoPf5BGhOmt95gWZMdL+bfovc6+SUw-Lq6Kvsp3Efw@mail.gmail.com>
To: whatwg@lists.whatwg.org
Currently, canvas2d does not have support for rounded rectangles and
the web developers are implementing rounded rectangles using arcs or
bezier curves.[1][2]
So i propose the addition of two new functions:

void fillRoundedRect(unrestricted double x, unrestricted double y,
unrestricted double w, unrestricted double h, unrestricted double
xRadius, unrestricted double yRadius);
void strokeRoundedRect(unrestricted double x, unrestricted double y,
unrestricted double w, unrestricted double h, unrestricted double
xRadius, unrestricted double yRadius);

Where the xRadius and yRadius arguments specify the radii of the
ellipses defining the corners of the rounded rectangle.

Additionally, if we know that the path is a rounded rectangle, we can
make optimizations in the graphics libraries reducing the amount of
tesselations.

[1] http://www.scriptol.com/html5/canvas/rounded-rectangle.php
[2] http://www.supercalifrigginawesome.com/Extending-Canvas-to-Draw-Rounded-Rectangles
Received on Thursday, 21 June 2012 17:03:25 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:43 UTC