public IndexedGeneratedPalette(
            SpriteRamp ramp,
            PaletteParameters parameters)
        {
            BasePalette = ramp.GetColorPalette(parameters);

            ColorValues        = ramp.ColorValues.ToArray();
            PaletteAdjustments = ramp.Adjustments.ToArray();

#if DEBUG
            System.Diagnostics.Debug.Assert(ramp.Count == ColorValues.Length, "Palette and ramp size must match");
            System.Diagnostics.Debug.Assert(ramp.Count == PaletteAdjustments.Length, "Palette and ramp size must match");
#endif

            // Saturation of the adjustment is reduced if the generated palette
            // is itself low saturation
            var rawParameters = (PaletteParameters)parameters.Clone();
            rawParameters.YellowLight = 0;
            rawParameters.BlueShadow  = 0;
            var rawPalette = ramp.GetColorPalette(rawParameters);

            AdjustmentsSaturationMultiplier = SaturationMultiplier(
                rawPalette.BaseColor, new XnaHSL(ramp.BaseColor));

            //@Debug: per color saturation adjustments

            /*AdjustmentsSaturationMultipliers = PaletteAdjustments
             *  .Select(x => 1f)
             *  .ToArray();
             * for (int i = 0; i < AdjustmentsSaturationMultipliers.Length; i++)
             * {
             *  AdjustmentsSaturationMultipliers[i] = SaturationMultiplier(
             *      rawPalette, ramp, i);
             * }*/
        }
Esempio n. 2
0
 private SpriteRamp(SpriteRamp source)
 {
     Palette = source.Palette;
     Ramp    = (PaletteRamp)source.Ramp.Clone();
 }