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)); }
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)); }
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); } } } } }
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)); }
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)); } } }
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)); }
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)); }
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())); }
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; } }
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; } }
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)); }
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)); }
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)); } }
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; } }
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; } }
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; } }
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; } }
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; } }
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; } } }
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; } }
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; } } }
public override void Handle(IIntentState<PositionValue> obj) { EvaluatorValue = new _16BitCommand(PSC.RangeLow + obj.GetValue().Position*PSC.RangeWidth); }
public Color GetFullColor(IIntentState state) { _color = Color.Transparent; state.Dispatch(this); return _color;; }
public override void Handle(IIntentState<RGBValue> obj) { var value = obj.GetValue(); HandleColor(value.FullColor, value.Intensity); }
public override void Handle(IIntentState<Value.CommandValue> obj) { EvaluatorValue = new Vixen.Commands.UnknownValueCommand(obj.GetValue()); }
public override void Handle(IIntentState<DiscreteValue> obj) { EvaluatorValue = new _8BitCommand((byte)(byte.MaxValue * obj.GetValue().Intensity)); }
public virtual void Handle(IIntentState<CommandValue> obj) { }
public override void Handle(IIntentState<DiscreteValue> obj) { DiscreteValue lightingValue = obj.GetValue(); EvaluatorValue = new ColorCommand(lightingValue.FullColor); }
public Color GetFullColor(IIntentState state) { _color = Color.Transparent; state.Dispatch(this); return(_color);; }
public override void Handle(IIntentState <IntensityValue> obj) { EvaluatorValue = new _8BitCommand((byte)(byte.MaxValue * obj.GetValue().Intensity)); }
public override void Handle(IIntentState<IntensityValue> obj) { EvaluatorValue = new _16BitCommand((ushort)(ushort.MaxValue * obj.GetValue().Intensity)); }
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()); }
public virtual void Handle(IIntentState<LightingValue> obj) { }
public IIntentState Filter(IIntentState intentValue) { intentValue.Dispatch(this); return(_intentValue); }
public void Handle(IIntentState <LightingValue> state) { //System.Drawing.Color color = state.GetValue().GetOpaqueIntensityAffectedColor(); //AddColorToNode(Color.FromArgb(color.A, color.R, color.G, color.B)); }
public override void Handle(IIntentState<LightingValue> obj) { _color = obj.GetValue().FullColorWithAlpha; }
public void Handle(IIntentState <CommandValue> state) { }
public override void Handle(IIntentState<PositionValue> obj) { EvaluatorValue = new _8BitCommand((byte) (byte.MaxValue*obj.GetValue().Position)); }
public override void Handle(IIntentState <LightingValue> obj) { _color = obj.GetValue().FullColorWithAlpha; }
// Handling intents as an evaluator. public override void Handle(IIntentState<RGBValue> obj) { byte byteLevel = (byte)(byte.MaxValue * obj.GetValue().Intensity); EvaluatorValue = new _8BitCommand(byteLevel); }
public override void Handle(IIntentState<LightingValue> obj) { EvaluatorValue = new _64BitCommand((ulong)(ulong.MaxValue * obj.GetValue().Intensity)); }
public virtual void Handle(IIntentState<PositionValue> obj) { }
public override void Handle(IIntentState<ColorValue> obj) { _intentValue = new StaticIntentState<ColorValue>(obj, FilterColorValue(obj.GetValue())); }
public override void Handle(IIntentState<RGBValue> obj) { EvaluatorValue = new ColorCommand(obj.GetValue().FullColor); }
// Handling intents as an evaluator. public override void Handle(IIntentState <RGBValue> obj) { byte byteLevel = (byte)(byte.MaxValue * obj.GetValue().Intensity); EvaluatorValue = new _8BitCommand(byteLevel); }
public override void Handle(IIntentState<LightingValue> obj) { var value = obj.GetValue(); HandleColor(value.Color, value.Intensity); }
public virtual void Handle(IIntentState<DiscreteValue> obj) { }
public override void Handle(IIntentState<LightingValue> obj) { _intentValue = new StaticIntentState<LightingValue>(obj, FilterLightingValue(obj.GetValue())); }
public virtual void Handle(IIntentState<IntensityValue> obj) { }
public virtual void Handle(IIntentState<RGBValue> obj) { }
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); }
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; }