Beispiel #1
0
        public override void Handle(IIntentState <LightingValue> obj)
        {
            LightingValue lightingValue = obj.GetValue();
            double        newIntensity  = _curve.GetValue(lightingValue.Intensity * 100.0) / 100.0;

            _intentValue = new StaticIntentState <LightingValue>(new LightingValue(lightingValue, newIntensity));
        }
Beispiel #2
0
        public override void Handle(IIntentState <DiscreteValue> obj)
        {
            DiscreteValue discreteValue = obj.GetValue();
            double        newIntensity  = _curve.GetValue(discreteValue.Intensity * 100.0) / 100.0;

            _intentValue = new StaticIntentState <DiscreteValue>(new DiscreteValue(discreteValue.Color, newIntensity));
        }
Beispiel #3
0
 private void _DiscoverIntentsFromEffects()
 {
     // For each effect in the in-effect list for the context...
     //Parallel.ForEach(_currentEffects, effectNode =>
     foreach (var effectNode in CurrentEffects)
     {
         var           layer = GetLayerForNode(effectNode);
         TimeSpan      effectRelativeTime = _currentTime - effectNode.StartTime;
         EffectIntents effectIntents      = effectNode.Effect.Render();
         if (effectIntents == null)
         {
             continue;
         }
         foreach (var effectIntent in effectIntents)
         {
             foreach (IIntentNode intentNode in effectIntent.Value)
             {
                 if (TimeNode.IntersectsInclusively(intentNode, effectRelativeTime))
                 {
                     IIntentState intentState = intentNode.CreateIntentState(effectRelativeTime - intentNode.StartTime,
                                                                             layer);
                     _elementStateBuilder.AddElementState(effectIntent.Key, intentState);
                 }
             }
         }
     }
 }
Beispiel #4
0
        public override void Handle(IIntentState <LightingValue> obj)
        {
            LightingValue lightingValue = obj.GetValue();
            int           alphaValue    = (int)(lightingValue.Intensity * byte.MaxValue);

            EvaluatorValue = new ColorCommand(Color.FromArgb(alphaValue, lightingValue.Color));
        }
Beispiel #5
0
        public override void Handle(IIntentState <RGBValue> obj)
        {
            RGBValue value = obj.GetValue();

            if (_mixColors)
            {
                float maxProportion = _getMaxProportion(value.Color);
                Color finalColor    = Color.FromArgb((int)(_breakdownItem.Color.R * maxProportion),
                                                     (int)(_breakdownItem.Color.G * maxProportion),
                                                     (int)(_breakdownItem.Color.B * maxProportion));
                _intentValue = new StaticIntentState <RGBValue>(obj, new RGBValue(finalColor));
            }
            else
            {
                // if we're not mixing colors, we need to compare the input color against the filter color -- but only the
                // hue and saturation components; ignore the intensity.
                HSV inputColor = HSV.FromRGB(value.Color);
                if (Math.Abs(inputColor.H - _breakdownColorAsHSV.H) < Tolerance && Math.Abs(inputColor.S - _breakdownColorAsHSV.S) < Tolerance)
                {
                    _intentValue = new StaticIntentState <RGBValue>(obj, value);
                }
                else
                {
                    // TODO: return 'null', or some sort of empty intent state here instead. (null isn't handled well, and we don't have an 'empty' state class.)
                    _intentValue = new StaticIntentState <RGBValue>(obj, new RGBValue(Color.Black));
                }
            }
        }
Beispiel #6
0
        public override void Handle(IIntentState <LightingValue> obj)
        {
            LightingValue lightingValue = obj.GetValue();

            if (_mixColors)
            {
                _intentValue = new StaticIntentState <LightingValue>(obj,
                                                                     new LightingValue(_breakdownItem.Color,
                                                                                       lightingValue.Intensity *
                                                                                       _getMaxProportion(lightingValue.HueSaturationOnlyColor)));
            }
            else
            {
                // if we're not mixing colors, we need to compare the input color against the filter color -- but only the
                // hue and saturation components; ignore the intensity.
                if (Math.Abs(lightingValue.Hue - _breakdownColorAsHSV.H) < Tolerance && Math.Abs(lightingValue.Saturation - _breakdownColorAsHSV.S) < Tolerance)
                {
                    _intentValue = new StaticIntentState <LightingValue>(obj, lightingValue);
                }
                else
                {
                    // TODO: return 'null', or some sort of empty intent state here instead. (null isn't handled well, and we don't have an 'empty' state class.)
                    _intentValue = new StaticIntentState <LightingValue>(obj, new LightingValue(_breakdownItem.Color, 0));
                }
            }
        }
        public override void Handle(IIntentState <LightingValue> obj)
        {
            LightingValue lightingValue = obj.GetValue();
            double        newValue      = _curve.GetValue(lightingValue.Intensity * 100.0) / 100.0;

            _intentValue = new StaticIntentState <LightingValue>(obj, new LightingValue(lightingValue.Color, (float)newValue));
        }
Beispiel #8
0
        public override void Handle(IIntentState <IntensityValue> obj)
        {
            IntensityValue intensityValue = obj.GetValue();
            double         newIntensity   = _curve.GetValue(intensityValue.Intensity * 100.0) / 100.0;

            _intentValue = new StaticIntentState <IntensityValue>(new IntensityValue(newIntensity));
        }
        public override void Handle(IIntentState <ColorValue> obj)
        {
            ColorValue colorValue    = obj.GetValue();
            float      maxProportion = _getMaxProportion(colorValue.Color);
            Color      finalColor    = Color.FromArgb((int)(_breakdownItem.Color.R * maxProportion), (int)(_breakdownItem.Color.G * maxProportion), (int)(_breakdownItem.Color.B * maxProportion));

            _intentValue = new StaticIntentState <ColorValue>(obj, new ColorValue(finalColor));
        }
Beispiel #10
0
        public override void Handle(IIntentState <RGBValue> obj)
        {
            RGBValue rgbValue     = obj.GetValue();
            HSV      hsv          = HSV.FromRGB(rgbValue.FullColor);
            double   newIntensity = _curve.GetValue(rgbValue.Intensity * 100.0) / 100.0;

            hsv.V        = newIntensity;
            _intentValue = new StaticIntentState <RGBValue>(new RGBValue(hsv.ToRGB()));
        }
Beispiel #11
0
        public override void Handle(IIntentState <DiscreteValue> obj)
        {
            DiscreteValue discreteValue = obj.GetValue();

            // if we're not mixing colors, we need to compare the input color against the filter color -- but only the
            // hue and saturation components; ignore the intensity.
            if (discreteValue.Color.ToArgb() == _breakdownItem.Color.ToArgb())
            {
                _intensityValue = discreteValue.Intensity;
            }
            else
            {
                _intensityValue = 0;
            }
        }
Beispiel #12
0
        public override void Handle(IIntentState <LightingValue> obj)
        {
            LightingValue lightingValue = obj.GetValue();

            if (lightingValue.Intensity > 0)
            {
                double newIntensity = _curve.GetValue(lightingValue.Intensity * 100.0) / 100.0;
                _lvState.SetValue(new LightingValue(lightingValue, newIntensity));
                _intentValue = _lvState;
            }
            else
            {
                _intentValue = null;
            }
        }
Beispiel #13
0
        private static Dictionary <Color, DiscreteValue> ProcessDiscreteIntentNodes(KeyValuePair <Guid, IntentNodeCollection> effectIntent, TimeSpan effectRelativeTime)
        {
            IntentStateList states = new IntentStateList();

            foreach (IIntentNode intentNode in effectIntent.Value)
            {
                if (TimeNode.IntersectsInclusively(intentNode, effectRelativeTime))
                {
                    IIntentState intentState = intentNode.CreateIntentState(effectRelativeTime - intentNode.StartTime, SequenceLayers.GetDefaultLayer());
                    states.Add(intentState);
                }
            }

            return(GetAlphaDiscreteColorsForIntents(states));
        }
Beispiel #14
0
        private static Color ProcessIntentNodes(KeyValuePair <Guid, IntentNodeCollection> effectIntent, TimeSpan effectRelativeTime)
        {
            IntentStateList states = new IntentStateList();

            foreach (IIntentNode intentNode in effectIntent.Value)
            {
                if (TimeNode.IntersectsInclusively(intentNode, effectRelativeTime))
                {
                    IIntentState intentState = intentNode.CreateIntentState(effectRelativeTime - intentNode.StartTime, SequenceLayers.GetDefaultLayer());
                    states.Add(intentState);
                }
            }

            return(IntentHelpers.GetOpaqueRGBMaxColorForIntents(states));
        }
Beispiel #15
0
        public override void Handle(IIntentState <IntensityValue> obj)
        {
            IntensityValue intensityValue = obj.GetValue();
            double         newIntensity   = _curve.GetValue(intensityValue.Intensity * 100.0) / 100.0;

            if (obj is StaticIntentState <IntensityValue> state)
            {
                intensityValue.Intensity = newIntensity;
                state.SetValue(intensityValue);
                _intentValue = state;
            }
            else
            {
                _intentValue = new StaticIntentState <IntensityValue>(new IntensityValue(newIntensity));
            }
        }
Beispiel #16
0
        public override void Handle(IIntentState <LightingValue> obj)
        {
            LightingValue lightingValue = obj.GetValue();

            // if we're not mixing colors, we need to compare the input color against the filter color -- but only the
            // hue and saturation components; ignore the intensity.
            if (Math.Abs(lightingValue.Color.R - _breakdownItem.Color.R) < Tolerance &&
                Math.Abs(lightingValue.Color.G - _breakdownItem.Color.G) < Tolerance &&
                Math.Abs(lightingValue.Color.B - _breakdownItem.Color.B) < Tolerance)
            {
                _intensityValue = lightingValue.Intensity;
            }
            else
            {
                _intensityValue = 0;
            }
        }
Beispiel #17
0
        public override void Handle(IIntentState <RGBValue> obj)
        {
            RGBValue rgbValue = obj.GetValue();
            var      i        = rgbValue.Intensity;

            if (i > 0)
            {
                double newIntensity = _curve.GetValue(i * 100.0) / 100.0;
                HSV    hsv          = HSV.FromRGB(rgbValue.R, rgbValue.G, rgbValue.B);
                hsv.V = newIntensity;
                _rgbState.SetValue(new RGBValue(hsv.ToRGB()));
                _intentValue = _rgbState;
            }
            else
            {
                _intentValue = null;
            }
        }
Beispiel #18
0
        public override void Handle(IIntentState <RGBValue> obj)
        {
            RGBValue value = obj.GetValue();

            // if we're not mixing colors, we need to compare the input color against the filter color -- but only the
            // hue and saturation components; ignore the intensity.
            if (Math.Abs(value.FullColor.R - _breakdownItem.Color.R) < Tolerance &&
                Math.Abs(value.FullColor.G - _breakdownItem.Color.G) < Tolerance &&
                Math.Abs(value.FullColor.B - _breakdownItem.Color.B) < Tolerance)
            {
                var i = HSV.VFromRgb(value.FullColor);
                //the value types are structs, so modify our copy and then set it back
                _intensityValue = i;
            }
            else
            {
                _intensityValue = 0;
            }
        }
Beispiel #19
0
        public override void Handle(IIntentState <DiscreteValue> obj)
        {
            //Handles mixing the DiscreteValue type intents within the same layer all togther in a highest intensity
            //per color fashion
            var discreteValue = obj.GetValue();
            var argbColor     = discreteValue.Color.ToArgb();

            LazyInitializer.EnsureInitialized(ref _tempDiscreteColors, () => new Dictionary <int, DiscreteValue>(4));
            if (_tempDiscreteColors.TryGetValue(argbColor, out var value))
            {
                if (value.Intensity < discreteValue.Intensity)
                {
                    _tempDiscreteColors[argbColor] = discreteValue;
                }
            }
            else
            {
                _tempDiscreteColors[argbColor] = discreteValue;
            }
        }
Beispiel #20
0
        public override void Handle(IIntentState <DiscreteValue> obj)
        {
            //Handles mixing the DiscreteValue type intents within the same layer all togther in a highest intensity
            //per color fashion
            var           discreteValue = obj.GetValue();
            var           argbColor     = discreteValue.Color.ToArgb();
            DiscreteValue value;

            if (_tempDiscreteColors.TryGetValue(argbColor, out value))
            {
                if (value.Intensity < discreteValue.Intensity)
                {
                    _tempDiscreteColors[argbColor] = discreteValue;
                }
            }
            else
            {
                _tempDiscreteColors[argbColor] = discreteValue;
            }
        }
Beispiel #21
0
        public override void Handle(IIntentState <LightingValue> obj)
        {
            LightingValue lightingValue = obj.GetValue();

            if (_mixColors)
            {
                _intensityValue = lightingValue.Intensity * _getMaxProportion(lightingValue.Color);
            }
            else
            {
                // if we're not mixing colors, we need to compare the input color against the filter color -- but only the
                // hue and saturation components; ignore the intensity.
                if (Math.Abs(lightingValue.Hue - _breakdownColorAsHSV.H) < Tolerance && Math.Abs(lightingValue.Saturation - _breakdownColorAsHSV.S) < Tolerance)
                {
                    _intensityValue = lightingValue.Intensity;
                }
                else
                {
                    _intensityValue = 0;
                }
            }
        }
Beispiel #22
0
        public override void Handle(IIntentState <DiscreteValue> obj)
        {
            DiscreteValue discreteValue = obj.GetValue();

            if (discreteValue.Intensity > 0)
            {
                double newIntensity = _curve.GetValue(discreteValue.Intensity * 100.0) / 100.0;
                if (obj is StaticIntentState <DiscreteValue> state)
                {
                    discreteValue.Intensity = newIntensity;
                    state.SetValue(discreteValue);
                    _intentValue = state;
                }
                else
                {
                    _intentValue = new StaticIntentState <DiscreteValue>(new DiscreteValue(discreteValue.Color, newIntensity));
                }
            }
            else
            {
                _intentValue = null;
            }
        }
Beispiel #23
0
        public override void Handle(IIntentState <RGBValue> obj)
        {
            RGBValue value = obj.GetValue();

            if (_mixColors)
            {
                float maxProportion = _getMaxProportion(value.FullColor);
                if (maxProportion > 0)
                {
                    Color finalColor = Color.FromArgb((int)(_breakdownItem.Color.R * maxProportion),
                                                      (int)(_breakdownItem.Color.G * maxProportion),
                                                      (int)(_breakdownItem.Color.B * maxProportion));
                    _intensityValue = HSV.VFromRgb(finalColor);
                }
                else
                {
                    _intensityValue = 0;
                }
            }
            else
            {
                // if we're not mixing colors, we need to compare the input color against the filter color -- but only the
                // hue and saturation components; ignore the intensity.
                HSV inputColor = HSV.FromRGB(value.FullColor);
                if (Math.Abs(inputColor.H - _breakdownColorAsHSV.H) < Tolerance && Math.Abs(inputColor.S - _breakdownColorAsHSV.S) < Tolerance)
                {
                    var i = HSV.VFromRgb(value.FullColor);
                    //the value types are structs, so modify our copy and then set it back
                    _intensityValue = i;
                }
                else
                {
                    _intensityValue = 0;
                }
            }
        }
Beispiel #24
0
		public override void Handle(IIntentState<PositionValue> obj)
		{
			EvaluatorValue = new _16BitCommand(PSC.RangeLow + obj.GetValue().Position*PSC.RangeWidth);
		}
Beispiel #25
0
 public Color GetFullColor(IIntentState state)
 {
     _color = Color.Transparent;
     state.Dispatch(this);
     return _color;;
 }
Beispiel #26
0
 public override void Handle(IIntentState<RGBValue> obj)
 {
     var value = obj.GetValue();
     HandleColor(value.FullColor, value.Intensity);
 }
Beispiel #27
0
 public override void Handle(IIntentState<Value.CommandValue> obj)
 {
     EvaluatorValue = new Vixen.Commands.UnknownValueCommand(obj.GetValue());
 }
Beispiel #28
0
 public override void Handle(IIntentState<DiscreteValue> obj)
 {
     EvaluatorValue = new _8BitCommand((byte)(byte.MaxValue * obj.GetValue().Intensity));
 }
Beispiel #29
0
 public virtual void Handle(IIntentState<CommandValue> obj)
 {
 }
Beispiel #30
0
 public override void Handle(IIntentState<DiscreteValue> obj)
 {
     DiscreteValue lightingValue = obj.GetValue();
     EvaluatorValue = new ColorCommand(lightingValue.FullColor);
 }
Beispiel #31
0
 public Color GetFullColor(IIntentState state)
 {
     _color = Color.Transparent;
     state.Dispatch(this);
     return(_color);;
 }
Beispiel #32
0
 public override void Handle(IIntentState <IntensityValue> obj)
 {
     EvaluatorValue = new _8BitCommand((byte)(byte.MaxValue * obj.GetValue().Intensity));
 }
Beispiel #33
0
 public override void Handle(IIntentState<IntensityValue> obj)
 {
     EvaluatorValue = new _16BitCommand((ushort)(ushort.MaxValue * obj.GetValue().Intensity));
 }
Beispiel #34
0
 public override void AddIntentState(IIntentState intentState)
 {
     // Clone the intent state so that outputs using the same elements don't
     // use the same intent and clobber each other.
     Add(intentState.Clone());
 }
Beispiel #35
0
 public virtual void Handle(IIntentState<LightingValue> obj)
 {
 }
Beispiel #36
0
 public IIntentState Filter(IIntentState intentValue)
 {
     intentValue.Dispatch(this);
     return(_intentValue);
 }
Beispiel #37
0
 public void Handle(IIntentState <LightingValue> state)
 {
     //System.Drawing.Color color = state.GetValue().GetOpaqueIntensityAffectedColor();
     //AddColorToNode(Color.FromArgb(color.A, color.R, color.G, color.B));
 }
Beispiel #38
0
 public override void Handle(IIntentState<LightingValue> obj)
 {
     _color = obj.GetValue().FullColorWithAlpha;
 }
Beispiel #39
0
 public void Handle(IIntentState <CommandValue> state)
 {
 }
Beispiel #40
0
 public override void Handle(IIntentState<PositionValue> obj)
 {
     EvaluatorValue = new _8BitCommand((byte) (byte.MaxValue*obj.GetValue().Position));
 }
Beispiel #41
0
 public override void Handle(IIntentState <LightingValue> obj)
 {
     _color = obj.GetValue().FullColorWithAlpha;
 }
Beispiel #42
0
 // Handling intents as an evaluator.
 public override void Handle(IIntentState<RGBValue> obj)
 {
     byte byteLevel = (byte)(byte.MaxValue * obj.GetValue().Intensity);
     EvaluatorValue = new _8BitCommand(byteLevel);
 }
Beispiel #43
0
 public override void Handle(IIntentState<LightingValue> obj)
 {
     EvaluatorValue = new _64BitCommand((ulong)(ulong.MaxValue * obj.GetValue().Intensity));
 }
Beispiel #44
0
 public virtual void Handle(IIntentState<PositionValue> obj)
 {
 }
 public override void Handle(IIntentState<ColorValue> obj)
 {
     _intentValue = new StaticIntentState<ColorValue>(obj, FilterColorValue(obj.GetValue()));
 }
Beispiel #46
0
 public override void Handle(IIntentState<RGBValue> obj)
 {
     EvaluatorValue = new ColorCommand(obj.GetValue().FullColor);
 }
Beispiel #47
0
        // Handling intents as an evaluator.
        public override void Handle(IIntentState <RGBValue> obj)
        {
            byte byteLevel = (byte)(byte.MaxValue * obj.GetValue().Intensity);

            EvaluatorValue = new _8BitCommand(byteLevel);
        }
Beispiel #48
0
 public override void Handle(IIntentState<LightingValue> obj)
 {
     var value = obj.GetValue();
     HandleColor(value.Color, value.Intensity);
 }
Beispiel #49
0
 public virtual void Handle(IIntentState<DiscreteValue> obj)
 {
 }
 public override void Handle(IIntentState<LightingValue> obj)
 {
     _intentValue = new StaticIntentState<LightingValue>(obj, FilterLightingValue(obj.GetValue()));
 }
Beispiel #51
0
 public virtual void Handle(IIntentState<IntensityValue> obj)
 {
 }
Beispiel #52
0
 public virtual void Handle(IIntentState<RGBValue> obj)
 {
 }
Beispiel #53
0
 public override void Handle(IIntentState<RGBValue> obj)
 {
     System.UInt64 level = (System.UInt64)(System.UInt64.MaxValue * obj.GetValue().Intensity);
     EvaluatorValue = new _64BitCommand(level);
 }
 protected internal virtual ICommand EvaluateIntentState(IIntentState intentState)
 {
     return _GetEvaluator().Evaluate(intentState);
 }
Beispiel #55
0
 public override void Handle(IIntentState<PositionValue> obj)
 {
     EvaluatorValue = new _64BitCommand((ulong)(ulong.MaxValue * obj.GetValue().Position));
 }
 // Not going to assume how the result is going to be used, so
 // we're not going to filter to a command and strip out
 // the intent.
 public IIntentState Filter(IIntentState intentValue)
 {
     intentValue.Dispatch(this);
     return _intentValue;
 }