Plugins - Moved test data model to a seperate plugin

Core - Moved built-in types to a separate folder and namespace
This commit is contained in:
Robert committed 2020-09-16 19:22:37 +02:00
1 parent d788183f25
commit d9017c67b4
59 files changed
+350 -131

No files matched your search

@@ -1,35 +0,0 @@
namespace Artemis.Core
{
/// <inheritdoc />
public class ColorGradientLayerProperty : LayerProperty<ColorGradient>
{
internal ColorGradientLayerProperty()
{
KeyframesSupported = false;
DataBindingsSupported = false;
BaseValueChanged += OnBaseValueChanged;
}
/// <summary>
/// Implicitly converts an <see cref="ColorGradientLayerProperty" /> to a <see cref="ColorGradient" />
/// </summary>
public static implicit operator ColorGradient(ColorGradientLayerProperty p)
{
return p.CurrentValue;
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
throw new ArtemisCoreException("Color Gradients do not support keyframes.");
}
private void OnBaseValueChanged(object sender, LayerPropertyEventArgs<ColorGradient> e)
{
// Don't allow color gradients to be null
if (BaseValue == null)
BaseValue = DefaultValue ?? new ColorGradient();
}
}
}
@@ -1,36 +0,0 @@
using System;
namespace Artemis.Core
{
/// <inheritdoc />
public class EnumLayerProperty<T> : LayerProperty<T> where T : Enum
{
internal EnumLayerProperty()
{
KeyframesSupported = false;
DataBindingsSupported = false;
}
/// <summary>
/// Implicitly converts an <see cref="EnumLayerProperty{T}" /> to a <typeparamref name="T"/>
/// </summary>
public static implicit operator T(EnumLayerProperty<T> p)
{
return p.CurrentValue;
}
/// <summary>
/// Implicitly converts an <see cref="EnumLayerProperty{T}" /> to an <see cref="int" />
/// </summary>
public static implicit operator int(EnumLayerProperty<T> p)
{
return Convert.ToInt32(p.CurrentValue);
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
throw new ArtemisCoreException("Enum properties do not support keyframes.");
}
}
}
@@ -1,34 +0,0 @@
namespace Artemis.Core
{
/// <inheritdoc />
public class FloatLayerProperty : LayerProperty<float>
{
internal FloatLayerProperty()
{
RegisterDataBindingProperty(value => value, new FloatDataBindingConverter());
}
/// <summary>
/// Implicitly converts an <see cref="FloatLayerProperty" /> to a <see cref="float" />
/// </summary>
public static implicit operator float(FloatLayerProperty p)
{
return p.CurrentValue;
}
/// <summary>
/// Implicitly converts an <see cref="FloatLayerProperty" /> to a <see cref="double" />
/// </summary>
public static implicit operator double(FloatLayerProperty p)
{
return p.CurrentValue;
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
var diff = NextKeyframe.Value - CurrentKeyframe.Value;
CurrentValue = CurrentKeyframe.Value + diff * keyframeProgressEased;
}
}
}
@@ -1,44 +0,0 @@
using System;
namespace Artemis.Core
{
/// <inheritdoc />
public class IntLayerProperty : LayerProperty<int>
{
internal IntLayerProperty()
{
RegisterDataBindingProperty(value => value, new IntDataBindingConverter());
}
/// <summary>
/// Implicitly converts an <see cref="IntLayerProperty" /> to an <see cref="int" />
/// </summary>
public static implicit operator int(IntLayerProperty p)
{
return p.CurrentValue;
}
/// <summary>
/// Implicitly converts an <see cref="IntLayerProperty" /> to a <see cref="float" />
/// </summary>
public static implicit operator float(IntLayerProperty p)
{
return p.CurrentValue;
}
/// <summary>
/// Implicitly converts an <see cref="IntLayerProperty" /> to a <see cref="double" />
/// </summary>
public static implicit operator double(IntLayerProperty p)
{
return p.CurrentValue;
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
var diff = NextKeyframe.Value - CurrentKeyframe.Value;
CurrentValue = (int) Math.Round(CurrentKeyframe.Value + diff * keyframeProgressEased, MidpointRounding.AwayFromZero);
}
}
}
@@ -1,28 +0,0 @@
namespace Artemis.Core
{
/// <summary>
/// A special layer property used to configure the selected layer brush
/// </summary>
public class LayerBrushReferenceLayerProperty : LayerProperty<LayerBrushReference>
{
internal LayerBrushReferenceLayerProperty()
{
KeyframesSupported = false;
DataBindingsSupported = false;
}
/// <summary>
/// Implicitly converts an <see cref="LayerBrushReferenceLayerProperty" /> to an <see cref="LayerBrushReference" />
/// </summary>
public static implicit operator LayerBrushReference(LayerBrushReferenceLayerProperty p)
{
return p.CurrentValue;
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
throw new ArtemisCoreException("Layer brush references do not support keyframes.");
}
}
}
@@ -1,29 +0,0 @@
using SkiaSharp;
namespace Artemis.Core
{
/// <inheritdoc />
public class SKColorLayerProperty : LayerProperty<SKColor>
{
internal SKColorLayerProperty()
{
RegisterDataBindingProperty(value => value, new SKColorDataBindingConverter());
}
/// <summary>
/// Implicitly converts an <see cref="SKColorLayerProperty" /> to an <see cref="SKColor" />¶
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
public static implicit operator SKColor(SKColorLayerProperty p)
{
return p.CurrentValue;
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
CurrentValue = CurrentKeyframe.Value.Interpolate(NextKeyframe.Value, keyframeProgressEased);
}
}
}
@@ -1,30 +0,0 @@
using SkiaSharp;
namespace Artemis.Core
{
/// <inheritdoc />
public class SKPointLayerProperty : LayerProperty<SKPoint>
{
internal SKPointLayerProperty()
{
RegisterDataBindingProperty(point => point.X, new FloatDataBindingConverter<SKPoint>());
RegisterDataBindingProperty(point => point.Y, new FloatDataBindingConverter<SKPoint>());
}
/// <summary>
/// Implicitly converts an <see cref="SKPointLayerProperty" /> to an <see cref="SKPoint" />
/// </summary>
public static implicit operator SKPoint(SKPointLayerProperty p)
{
return p.CurrentValue;
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
var xDiff = NextKeyframe.Value.X - CurrentKeyframe.Value.X;
var yDiff = NextKeyframe.Value.Y - CurrentKeyframe.Value.Y;
CurrentValue = new SKPoint(CurrentKeyframe.Value.X + xDiff * keyframeProgressEased, CurrentKeyframe.Value.Y + yDiff * keyframeProgressEased);
}
}
}
@@ -1,30 +0,0 @@
using SkiaSharp;
namespace Artemis.Core
{
/// <inheritdoc />
public class SKSizeLayerProperty : LayerProperty<SKSize>
{
internal SKSizeLayerProperty()
{
RegisterDataBindingProperty(size => size.Height, new FloatDataBindingConverter<SKSize>());
RegisterDataBindingProperty(size => size.Width, new FloatDataBindingConverter<SKSize>());
}
/// <summary>
/// Implicitly converts an <see cref="SKSizeLayerProperty" /> to an <see cref="SKSize" />
/// </summary>
public static implicit operator SKSize(SKSizeLayerProperty p)
{
return p.CurrentValue;
}
/// <inheritdoc />
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
var widthDiff = NextKeyframe.Value.Width - CurrentKeyframe.Value.Width;
var heightDiff = NextKeyframe.Value.Height - CurrentKeyframe.Value.Height;
CurrentValue = new SKSize(CurrentKeyframe.Value.Width + widthDiff * keyframeProgressEased, CurrentKeyframe.Value.Height + heightDiff * keyframeProgressEased);
}
}
}