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:
Hi,

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

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

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

Thanks



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/e5_3EDLYqxoJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment