src/canvas/CanvasContext.js
function(polygon, options) {
        // Create new canvas where the polygon should be drawn
        this._drawOnCanvasContext(options, function(g) {
            options = options || {};
            g.beginPath();
            for (var i = 0; i < polygon.length; i++) {
                var ring = this._simplify(polygon[i]);
                if (ring && ring.length) {
                    var clockwise = (i === 0);
                    if (GeometryUtils.isClockwise(ring) !== !!clockwise) {
                        ring.reverse();
                    }
                }
                this._trace(g, ring);
            }
            g.closePath();
            this._setFillStyles(g, options);
            g.fill();
            this._setStrokeStyles(g, options);
            g.stroke();
            return true;
        });
    }
function(polygon, options) {
        // Create new canvas where the polygon should be drawn
        this._drawOnCanvasContext(options, function(g) {
            options = options || {};
            g.beginPath();
            for (var i = 0; i < polygon.length; i++) {
                var ring = this._simplify(polygon[i]);
                if (ring && ring.length) {
                    var clockwise = (i === 0);
                    if (GeometryUtils.isClockwise(ring) !== !!clockwise) {
                        ring.reverse();
                    }
                }
                this._trace(g, ring);
            }
            g.closePath();
            this._setFillStyles(g, options);
            g.fill();
            this._setStrokeStyles(g, options);
            g.stroke();
            return true;
        });
    }
function ( polygon , options ) { // Create new canvas where the polygon should be drawn this . _drawOnCanvasContext ( options , function ( g ) { options = options || { } ; g . beginPath ( ) ; for ( var i = 0 ; i < polygon . length ; i ++ ) { var ring = this . _simplify ( polygon [ i ] ) ; if ( ring && ring . length ) { var clockwise = ( i === 0 ) ; if ( GeometryUtils . isClockwise ( ring ) !== ! ! clockwise ) { ring . reverse ( ) ; } } this . _trace ( g , ring ) ; } g . closePath ( ) ; this . _setFillStyles ( g , options ) ; g . fill ( ) ; this . _setStrokeStyles ( g , options ) ; g . stroke ( ) ; return true ; } ) ; }
Draws polygons with holes on the canvas.
Draws polygons with holes on the canvas .