Esempio n. 1
0
 public GammaPalette Build()
 {
     if (Secondary.HasValue)
     {
         return(Method switch
         {
             PaletteMixMethod.Merge => GammaPalette.Merge(GraphicsService.GetPalette(Primary), GraphicsService.GetPalette(Secondary.Value), 0.5f),
             _ => GammaPalette.Smear(GraphicsService.GetPalette(Primary), GraphicsService.GetPalette(Secondary.Value))
         });
Esempio n. 2
0
        public static GammaPalette FromHour(float hour) // TODO: Incorporate offsets, and incorporate Range.Markers (when ready).
        {
            TimeCycle cycle = Utc;

            if (hour <= cycle.NightEnd || hour > cycle.NightStart)
            {
                return(NightPalette);
            }

            if (hour > cycle.NightEnd && hour <= cycle.Dawn)
            {
                return(GammaPalette.Merge(NightPalette, SunrisePalette, GetHourStrength(cycle.NightEnd, cycle.Dawn, hour)));
            }

            if (hour > cycle.Dawn && hour <= cycle.Sunrise)
            {
                return(GammaPalette.Merge(SunrisePalette, DuskPalette, GetHourStrength(cycle.Dawn, cycle.Sunrise, hour)));
            }

            if (hour > cycle.Sunrise && hour <= cycle.Meridian)
            {
                return(GammaPalette.Merge(DuskPalette, MeridianPalette, GetHourStrength(cycle.Sunrise, cycle.Meridian, hour)));
            }

            if (hour > cycle.Meridian && hour <= cycle.Sunset)
            {
                return(GammaPalette.Merge(MeridianPalette, DuskPalette, GetHourStrength(cycle.Meridian, cycle.Sunset, hour)));
            }

            if (hour > cycle.Sunset && hour <= cycle.Dusk)
            {
                return(GammaPalette.Merge(DuskPalette, SunrisePalette, GetHourStrength(cycle.Sunset, cycle.Dusk, hour)));
            }

            if (hour > cycle.Dusk && hour <= cycle.NightStart)
            {
                return(GammaPalette.Merge(SunrisePalette, NightPalette, GetHourStrength(cycle.Dusk, cycle.NightStart, hour)));
            }

            throw new Exception("The hour float value given is out of range.");
        }