import { ImageFiltering } from './Filtering';
import { Raster } from './Raster';
/**
 * A circle [[Graphic]] for drawing circles to the [[ExcaliburGraphicsContext]]
 *
 * Circles default to [[ImageFiltering.Blended]]
 */
export class Circle extends Raster {
    get radius() {
        return this._radius;
    }
    set radius(value) {
        this._radius = value;
        this.width = this._radius * 2;
        this.height = this._radius * 2;
        this.flagDirty();
    }
    constructor(options) {
        var _a, _b, _c;
        super(options);
        this._radius = 0;
        const lineWidth = (_a = options.lineWidth) !== null && _a !== void 0 ? _a : (options.strokeColor ? 1 : 0); // default lineWidth in canvas is 1px
        this.padding = (_b = options.padding) !== null && _b !== void 0 ? _b : 2 + lineWidth / 2; // default 2 padding for circles looks nice
        this.radius = options.radius;
        this.filtering = (_c = options.filtering) !== null && _c !== void 0 ? _c : ImageFiltering.Blended;
        this.rasterize();
    }
    clone() {
        return new Circle({
            radius: this.radius,
            ...this.cloneGraphicOptions(),
            ...this.cloneRasterOptions()
        });
    }
    execute(ctx) {
        if (this.radius > 0) {
            ctx.beginPath();
            ctx.arc(this.radius, this.radius, this.radius, 0, Math.PI * 2);
            if (this.color) {
                ctx.fill();
            }
            if (this.strokeColor) {
                ctx.stroke();
            }
        }
    }
}
//# sourceMappingURL=Circle.js.map