"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Rendering
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Hilite = void 0;
const ColorDef_1 = require("./ColorDef");
/** Contains types related to display of hilited elements within a [[Viewport]].
 * @public
 */
var Hilite;
(function (Hilite) {
    /**  Describes the width of the outline applied to hilited geometry. The outline is drawn around the union of all hilited geometry and is visible behind non-hilited geometry.
     * @see [[Hilite.Settings]]
     */
    let Silhouette;
    (function (Silhouette) {
        /** No outline. */
        Silhouette[Silhouette["None"] = 0] = "None";
        /** 1-pixel-wide outline. */
        Silhouette[Silhouette["Thin"] = 1] = "Thin";
        /** 2-pixel-wide outline. */
        Silhouette[Silhouette["Thick"] = 2] = "Thick";
    })(Silhouette = Hilite.Silhouette || (Hilite.Silhouette = {}));
    /**
     * Describes how the hilite effect is applied to elements within a [[Viewport]].
     * The hilite effect is applied to elements contained in the [[IModelConnection]]'s [[SelectionSet]].
     * It is designed to draw attention to those elements. The effect is produced as follows:
     *  1. All hilited elements are drawn as normal, except that their element color is mixed with the hilite color.
     *  2. The union of the regions of the screen corresponding to hilited elements is computed.
     *  3. A silhouette is drawn using the hilite color around the boundaries of the hilited region. This silhouette is visible behind other geometry.
     *  4. The hilite color is mixed with the color of each pixel within the hilited region. This enables surfaces of hilited geometry to be visible behind other geometry.
     *
     * The Settings allow an application to customize how this effect is applied.
     * @see [[Viewport.hilite]]
     */
    class Settings {
        static clamp(value) { return Math.min(1.0, Math.max(0.0, value)); }
        constructor(color = ColorDef_1.ColorDef.from(0x23, 0xbb, 0xfc), visibleRatio = 0.25, hiddenRatio = 0.0, silhouette = Silhouette.Thin) {
            this.color = color;
            this.silhouette = silhouette;
            this.visibleRatio = Settings.clamp(visibleRatio);
            this.hiddenRatio = Settings.clamp(hiddenRatio);
        }
    }
    Hilite.Settings = Settings;
    /** Compare two Settings objects for equivalence. */
    function equalSettings(lhs, rhs) {
        return lhs.color.equals(rhs.color)
            && lhs.visibleRatio === rhs.visibleRatio
            && lhs.hiddenRatio === rhs.hiddenRatio
            && lhs.silhouette === rhs.silhouette;
    }
    Hilite.equalSettings = equalSettings;
    /** Create a copy of a Settings object. */
    function cloneSettings(settings) {
        return new Settings(settings.color, settings.visibleRatio, settings.hiddenRatio, settings.silhouette);
    }
    Hilite.cloneSettings = cloneSettings;
})(Hilite || (exports.Hilite = Hilite = {}));
//# sourceMappingURL=Hilite.js.map