[webkit-dev] new APIs for strokes with dash in Canvas

Young Han Lee joybro201 at gmail.com
Thu Sep 22 19:31:54 PDT 2011

Hi all,

I have a patch to add webkitLineDash and webkitLineDashOffset APIs on
CanvasRenderingContext2D on https://bugs.webkit.org/show_bug.cgi?id=63933

The purpose of these APIs is to support for strokes with dash in Canvas.

Although the API is not specified in the HTML Canvas specification yet, I
believe it would be great to support the API. As Dirk said in the above bug,
Mozilla already implemented the APIs named mozDash and mozDashOffset[1], and
there seems to be many needs for the API. Some people even implemented their
own javascript functions to draw strokes with dash in Canvas[2,3].

As GraphicsContext already have an interface for strokes with dash,
setLineDash, all we have to do is exposing it to the JS level. So the syntax
and meaning of the new APIs is the same with the arguments of the
setLineDash. webkitLineDash is an array of float, and webkitLineDashOffset
is a float.

I uploaded a patch for JSC first. After the patch is landed, I will make a
follow-up patch for V8.

Any thought?

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=662038
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110923/fa484b65/attachment.html>

More information about the webkit-dev mailing list