Example usage for com.google.gwt.canvas.dom.client Context2d setStrokeStyle

List of usage examples for com.google.gwt.canvas.dom.client Context2d setStrokeStyle

Introduction

In this page you can find the example usage for com.google.gwt.canvas.dom.client Context2d setStrokeStyle.

Prototype

public final void setStrokeStyle(String strokeStyleColor) 

Source Link

Document

Convenience method to set the context's strokeStyle to a CssColor .

Usage

From source file:stroom.widget.htree.client.RoundedRectangle.java

License:Apache License

public void draw(final Context2d ctx, final double x, final double y, final double width, final double height,
        final double radius, final FillStrokeStyle fill, final FillStrokeStyle stroke) {
    ctx.beginPath();// www . j  a  v a 2s.c  o  m
    ctx.moveTo(x + radius, y);
    ctx.lineTo(x + width - radius, y);
    ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
    ctx.lineTo(x + width, y + height - radius);
    ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
    ctx.lineTo(x + radius, y + height);
    ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
    ctx.lineTo(x, y + radius);
    ctx.quadraticCurveTo(x, y, x + radius, y);
    ctx.closePath();

    if (fill != null) {
        ctx.setFillStyle(fill);
        ctx.fill();
    }

    if (stroke != null) {
        ctx.setStrokeStyle(stroke);
        ctx.stroke();
    }
}