示例#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));
        }
示例#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));
        }
示例#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);
                 }
             }
         }
     }
 }
示例#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));
        }
示例#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));
                }
            }
        }
示例#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));
        }
示例#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));
        }
示例#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()));
        }
示例#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;
            }
        }
示例#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;
            }
        }
示例#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));
        }
示例#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));
        }
示例#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));
            }
        }
示例#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;
            }
        }
示例#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;
            }
        }
示例#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;
            }
        }
示例#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;
            }
        }
示例#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;
            }
        }
示例#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;
                }
            }
        }
示例#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;
            }
        }
示例#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;
                }
            }
        }
示例#24
0
		public override void Handle(IIntentState<PositionValue> obj)
		{
			EvaluatorValue = new _16BitCommand(PSC.RangeLow + obj.GetValue().Position*PSC.RangeWidth);
		}
示例#25
0
 public Color GetFullColor(IIntentState state)
 {
     _color = Color.Transparent;
     state.Dispatch(this);
     return _color;;
 }
示例#26
0
 public override void Handle(IIntentState<RGBValue> obj)
 {
     var value = obj.GetValue();
     HandleColor(value.FullColor, value.Intensity);
 }
示例#27
0
 public override void Handle(IIntentState<Value.CommandValue> obj)
 {
     EvaluatorValue = new Vixen.Commands.UnknownValueCommand(obj.GetValue());
 }
示例#28
0
 public override void Handle(IIntentState<DiscreteValue> obj)
 {
     EvaluatorValue = new _8BitCommand((byte)(byte.MaxValue * obj.GetValue().Intensity));
 }
示例#29
0
 public virtual void Handle(IIntentState<CommandValue> obj)
 {
 }
示例#30
0
 public override void Handle(IIntentState<DiscreteValue> obj)
 {
     DiscreteValue lightingValue = obj.GetValue();
     EvaluatorValue = new ColorCommand(lightingValue.FullColor);
 }
示例#31
0
 public Color GetFullColor(IIntentState state)
 {
     _color = Color.Transparent;
     state.Dispatch(this);
     return(_color);;
 }
示例#32
0
 public override void Handle(IIntentState <IntensityValue> obj)
 {
     EvaluatorValue = new _8BitCommand((byte)(byte.MaxValue * obj.GetValue().Intensity));
 }
示例#33
0
 public override void Handle(IIntentState<IntensityValue> obj)
 {
     EvaluatorValue = new _16BitCommand((ushort)(ushort.MaxValue * obj.GetValue().Intensity));
 }
示例#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());
 }
示例#35
0
 public virtual void Handle(IIntentState<LightingValue> obj)
 {
 }
示例#36
0
 public IIntentState Filter(IIntentState intentValue)
 {
     intentValue.Dispatch(this);
     return(_intentValue);
 }
示例#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));
 }
示例#38
0
 public override void Handle(IIntentState<LightingValue> obj)
 {
     _color = obj.GetValue().FullColorWithAlpha;
 }
示例#39
0
 public void Handle(IIntentState <CommandValue> state)
 {
 }
示例#40
0
 public override void Handle(IIntentState<PositionValue> obj)
 {
     EvaluatorValue = new _8BitCommand((byte) (byte.MaxValue*obj.GetValue().Position));
 }
示例#41
0
 public override void Handle(IIntentState <LightingValue> obj)
 {
     _color = obj.GetValue().FullColorWithAlpha;
 }
示例#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);
 }
示例#43
0
 public override void Handle(IIntentState<LightingValue> obj)
 {
     EvaluatorValue = new _64BitCommand((ulong)(ulong.MaxValue * obj.GetValue().Intensity));
 }
示例#44
0
 public virtual void Handle(IIntentState<PositionValue> obj)
 {
 }
 public override void Handle(IIntentState<ColorValue> obj)
 {
     _intentValue = new StaticIntentState<ColorValue>(obj, FilterColorValue(obj.GetValue()));
 }
示例#46
0
 public override void Handle(IIntentState<RGBValue> obj)
 {
     EvaluatorValue = new ColorCommand(obj.GetValue().FullColor);
 }
示例#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);
        }
示例#48
0
 public override void Handle(IIntentState<LightingValue> obj)
 {
     var value = obj.GetValue();
     HandleColor(value.Color, value.Intensity);
 }
示例#49
0
 public virtual void Handle(IIntentState<DiscreteValue> obj)
 {
 }
 public override void Handle(IIntentState<LightingValue> obj)
 {
     _intentValue = new StaticIntentState<LightingValue>(obj, FilterLightingValue(obj.GetValue()));
 }
示例#51
0
 public virtual void Handle(IIntentState<IntensityValue> obj)
 {
 }
示例#52
0
 public virtual void Handle(IIntentState<RGBValue> obj)
 {
 }
示例#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);
 }
示例#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;
 }