001package polaris.sdk.ui;
002
003/**
004 * Named material-only presets used by the demo settings panel.
005 * The label "Morden" intentionally preserves the requested spelling.
006 * Applying a preset changes exactly the eight material values; it does not
007 * replace the Theme, palette, type settings, geometry, motion, or background.
008 */
009public enum MaterialPreset {
010    /** Sigma 15, refraction 15, dispersion 1, opacity 1, shine 1.5, blur 1, tint .5, selected tint .5. */
011    MORDEN("Morden", 15f, 15f, 1f, 1f, 1.5f, 1f, .5f, .5f),
012    /** Sigma 1.5, refraction 30, dispersion 2, opacity 1, shine 1.5, blur 1, tint .5, selected tint .5. */
013    LIQUID_GLASS("LiquidGlass", 1.5f, 30f, 2f, 1f, 1.5f, 1f, .5f, .5f),
014    /** Sigma/refraction/dispersion/blur 0, opacity/tint/selected tint 1, shine 1.5. */
015    NORMAL("Normal", 0f, 0f, 0f, 1f, 1.5f, 0f, 1f, 1f);
016
017    private final String displayName;
018    private final float sigma,refraction,dispersion,opacity,shine,blur,tint,selectedTint;
019
020    MaterialPreset(String name,float sigma,float refraction,float dispersion,float opacity,
021                   float shine,float blur,float tint,float selectedTint){
022        displayName=name;this.sigma=sigma;this.refraction=refraction;this.dispersion=dispersion;
023        this.opacity=opacity;this.shine=shine;this.blur=blur;this.tint=tint;this.selectedTint=selectedTint;
024    }
025    /** Exact label displayed by the settings panel. */
026    public String displayName(){return displayName;}
027    /**
028     * Apply the eight stored values to an existing theme, on its UI thread.
029     * No values are inherited from the previously selected preset.
030     * @param theme the current mutable theme; must not be null
031     * @return the same theme instance, for chaining
032     */
033    public Theme applyTo(Theme theme){
034        if(theme==null)throw new NullPointerException("theme");
035        return theme.sigma(sigma).refraction(refraction).dispersion(dispersion).opacity(opacity)
036            .shine(shine).blur(blur).tint(tint).selectedTint(selectedTint);
037    }
038}