import '../../../assert/js/assert.js';
import '../../../globals.js';
// Copyright 2020-2024, University of Colorado Boulder
/**
 * DropShadow filter
 *
 * EXPERIMENTAL! DO not use in production code yet
 *
 * TODO: preventFit OR handle bounds increase (or both) https://github.com/phetsims/scenery/issues/1581
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import toSVGNumber from '../../../dot/js/toSVGNumber.js';
import { ColorDef, Filter, PaintDef, scenery } from '../imports.js';
export default class DropShadow extends Filter {
    /**
     * @param offset
     * @param blurRadius
     * @param color
     * @param [filterRegionPercentage]
     */
    constructor(offset, blurRadius, color, filterRegionPercentage = 15) {
        assert && assert(offset.isFinite(), 'DropShadow offset should be finite');
        assert && assert(isFinite(blurRadius), 'DropShadow blurRadius should be finite');
        assert && assert(blurRadius >= 0, 'DropShadow blurRadius should be non-negative');
        assert && assert(ColorDef.isColorDef(color), 'DropShadow color should be a ColorDef');
        super();
        // TODO: consider linking to the ColorDef (if it's a Property), or indicating that we need an update https://github.com/phetsims/scenery/issues/1581
        this.offset = offset;
        this.blurRadius = blurRadius;
        this.color = color;
        this.colorCSS = PaintDef.toColor(color).toCSS();
        this.filterRegionPercentageIncrease = filterRegionPercentage;
    }
    /**
     * Returns the CSS-style filter substring specific to this single filter, e.g. `grayscale(1)`. This should be used for
     * both DOM elements (https://developer.mozilla.org/en-US/docs/Web/CSS/filter) and when supported, Canvas
     * (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter).
     */
    getCSSFilterString() {
        return `drop-shadow(${toSVGNumber(this.offset.x)}px ${toSVGNumber(this.offset.y)}px ${toSVGNumber(this.blurRadius)}px ${this.colorCSS})`;
    }
    isDOMCompatible() {
        return true;
    }
    applyCanvasFilter() {
        throw new Error('unimplemented');
    }
    applySVGFilter(svgFilter, inName, resultName) {
        throw new Error('unimplemented');
    }
}
scenery.register('DropShadow', DropShadow);
//# sourceMappingURL=DropShadow.js.map