/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Symbology
 */
import { ColorDef } from "./ColorDef";
import { LinePixels } from "./LinePixels";
/** Flags indicating whether and how the interiors of closed planar regions is displayed within a view.
 * @public
 * @extensions
 */
export var FillFlags;
(function (FillFlags) {
    /** No fill */
    FillFlags[FillFlags["None"] = 0] = "None";
    /** Use the element's fill color when fill is enabled in the view's [[ViewFlags]]. */
    FillFlags[FillFlags["ByView"] = 1] = "ByView";
    /** Use the element's fill color even when fill is disabled in the view's [[ViewFlags]]. */
    FillFlags[FillFlags["Always"] = 2] = "Always";
    /** Render the fill behind other geometry belonging to the same element.
     * For example if an element's geometry contains text with background fill, the text always renders in front of the fill.
     */
    FillFlags[FillFlags["Behind"] = 4] = "Behind";
    /** Combines Behind and Always flags. */
    FillFlags[FillFlags["Blanking"] = 6] = "Blanking";
    /** Use the view's background color instead of the element's fill color. */
    FillFlags[FillFlags["Background"] = 8] = "Background";
})(FillFlags || (FillFlags = {}));
/** The "cooked" material and symbology for a [[RenderGraphic]]. This determines the appearance
 * (e.g. texture, color, width, linestyle, etc.) used to draw Geometry.
 * @public
 */
export class GraphicParams {
    constructor() {
        /** Describes how fill is applied to planar regions in wireframe mode. */
        this.fillFlags = FillFlags.None;
        /** The line pattern applied to curves and edges. */
        this.linePixels = LinePixels.Solid;
        /** The width, in pixels, of curves and edges. Values are clamped to [1..31] at display time. */
        this.rasterWidth = 1;
        /** The color of curves and edges. */
        this.lineColor = ColorDef.black;
        /** The color of surfaces. */
        this.fillColor = ColorDef.black;
    }
    /** Set the transparency of the line color, where 0=fully opaque and 255=full transparent. */
    setLineTransparency(transparency) { this.lineColor = this.lineColor.withTransparency(transparency); }
    /** Set the transparency of the fill color, where 0=fully opaque and 255=full transparent. */
    setFillTransparency(transparency) { this.fillColor = this.fillColor.withTransparency(transparency); }
    clone(out) {
        out = out ?? new GraphicParams();
        out.fillFlags = this.fillFlags;
        out.linePixels = this.linePixels;
        out.rasterWidth = this.rasterWidth;
        out.lineColor = this.lineColor;
        out.fillColor = this.fillColor;
        out.material = this.material;
        out.gradient = this.gradient;
        return out;
    }
    /** Conveniently create a GraphicParams the most commonly-used properties. */
    static fromSymbology(lineColor, fillColor, lineWidth, linePixels = LinePixels.Solid) {
        const graphicParams = new GraphicParams();
        graphicParams.lineColor = lineColor;
        graphicParams.fillColor = fillColor;
        graphicParams.rasterWidth = lineWidth;
        graphicParams.linePixels = linePixels;
        return graphicParams;
    }
    /** Create a GraphicParams with blanking fill of the specified color.
     * @see [[FillFlags.Blanking]].
     */
    static fromBlankingFill(fillColor) {
        const graphicParams = new GraphicParams();
        graphicParams.fillColor = fillColor;
        graphicParams.fillFlags = FillFlags.Blanking;
        return graphicParams;
    }
}
//# sourceMappingURL=GraphicParams.js.map