public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) { if (!(otherAnim is AnimationManualColorFrame)) { throw new FormatException("Cannot blend with another type"); } Dictionary <DeviceKeys, Color> _combinedBitmapColors = new Dictionary <DeviceKeys, Color>(); amount = GetTransitionValue(amount); foreach (var kvp in _BitmapColors) { if ((otherAnim as AnimationManualColorFrame)._BitmapColors.ContainsKey(kvp.Key)) { _combinedBitmapColors.Add(kvp.Key, Utils.ColorUtils.BlendColors(kvp.Value, (otherAnim as AnimationManualColorFrame)._BitmapColors[kvp.Key], amount)); } else { _combinedBitmapColors.Add(kvp.Key, Utils.ColorUtils.MultiplyColorByScalar(kvp.Value, 1.0 - amount)); } } foreach (var kvp in (otherAnim as AnimationManualColorFrame)._BitmapColors) { if (!_BitmapColors.ContainsKey(kvp.Key)) { _combinedBitmapColors.Add(kvp.Key, Utils.ColorUtils.MultiplyColorByScalar(kvp.Value, amount)); } } AnimationManualColorFrame newAnim = new AnimationManualColorFrame(); newAnim._BitmapColors = _combinedBitmapColors; return(newAnim); }
public bool Equals(AnimationManualColorFrame p) { return(_BitmapColors.Equals(p._BitmapColors) && _duration.Equals(p._duration)); }