Wednesday, August 29, 2012

Re: How to set stroke width for Canvas Context2d?

To set the width of the stroke, use ctx.setLineWidth(double)

In general, FillStrokeStyle currently has three subclasses:

- CanvasGradient
- CanvasPattern
- CssColor

They don't have public constructors. CanvasGradient can be created by using ctx.createLinearGradient() or ctx.createRadialGradient().

CanvasPatterns can be created with ctx.createPattern().

CssColors can be created with CssColor.make(). There's also a shortcut: A CssColor object is created in the background, when you use some of the overloaded methods of Context2d like ctx.setStrokeStyle(String color) or ctx.setFillStyle(String color).

On Thursday, August 30, 2012 12:44:22 AM UTC+2, mark wrote:

I'd like to change the stroke width but am not clear how to do this:

    Context2d context = ...;
    context.setStrokeStyle(FillStrokeStyle ?);

I'm not sure how to create a FillStrokeStyle object (or specifically how to create one where I can control its width). Anyone know?


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment