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

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

Introduction

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

Prototype

public final native void setMiterLimit(double miterLimit) ;

Source Link

Document

Sets the miter-limit.

Usage

From source file:com.sencha.gxt.chart.client.draw.engine.Canvas2d.java

License:sencha.com license

protected void appendPath(Context2d ctx, PathSprite sprite) {
    ctx.beginPath();//  w ww.ja  v a  2 s  . c  om
    sprite.toAbsolute();
    //    sprite = sprite.copy().toCurve();

    PrecisePoint currentPoint = new PrecisePoint();
    PrecisePoint movePoint = new PrecisePoint();
    PrecisePoint curvePoint = new PrecisePoint();
    PrecisePoint quadraticPoint = new PrecisePoint();

    appendPathCommands(ctx, sprite.getCommands(), currentPoint, movePoint, curvePoint, quadraticPoint);

    double opacity = Double.isNaN(sprite.getOpacity()) ? 1.0 : sprite.getOpacity();
    if (sprite.getFill() != null && sprite.getFill() != Color.NONE) {
        ctx.setGlobalAlpha(Double.isNaN(sprite.getFillOpacity()) ? opacity : opacity * sprite.getFillOpacity());
        ctx.fill();
    }
    if (sprite.getStroke() != null && sprite.getStroke() != Color.NONE && sprite.getStrokeWidth() != 0) {
        ctx.setLineCap(sprite.getStrokeLineCap() == null ? LineCap.BUTT : sprite.getStrokeLineCap());
        ctx.setLineJoin(sprite.getStrokeLineJoin() == null ? LineJoin.MITER : sprite.getStrokeLineJoin());
        ctx.setMiterLimit(sprite.getMiterLimit() == Double.NaN ? 4 : sprite.getMiterLimit());
        ctx.setGlobalAlpha(
                Double.isNaN(sprite.getStrokeOpacity()) ? opacity : opacity * sprite.getStrokeOpacity());
        ctx.stroke();
    }
}