Layer brushes - Added RGB.NET-based layer brushes

Layer brushes - Added sample RGB.NET-based color brush
Layer properties - Save on gradient edit dialog close
Layer properties - Fix layer brush keyframes not working after changing layer brush
This commit is contained in:
SpoinkyNL committed 2020-05-31 21:58:06 +02:00
1 parent 493790f6bd
commit cdb91021a2
31 files changed
+550 -146

No files matched your search

+10 -4
View File
@@ -204,7 +204,7 @@ namespace Artemis.Core.Models.Profile
/// <inheritdoc />
public override void Update(double deltaTime)
{
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized)
if (LayerBrush?.BaseProperties == null || !LayerBrush.BaseProperties.PropertiesInitialized)
return;
var properties = new List<BaseLayerProperty>(General.GetAllLayerProperties().Where(p => p.BaseKeyframes.Any()));
@@ -269,6 +269,9 @@ namespace Artemis.Core.Models.Profile
private void StretchRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
{
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized || LayerBrush.BrushType != LayerBrushType.Regular)
return;
// Apply transformations
var sizeProperty = Transform.Scale.CurrentValue;
var rotationProperty = Transform.Rotation.CurrentValue;
@@ -285,12 +288,14 @@ namespace Artemis.Core.Models.Profile
canvas.Scale(sizeProperty.Width / 100f, sizeProperty.Height / 100f, anchorPosition.X, anchorPosition.Y);
canvas.Translate(x, y);
if (LayerBrush != null && LayerBrush.BaseProperties.PropertiesInitialized)
LayerBrush.Render(canvas, canvasInfo, new SKPath(LayerShape.Path), paint);
LayerBrush.InternalRender(canvas, canvasInfo, new SKPath(LayerShape.Path), paint);
}
private void ClipRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
{
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized || LayerBrush.BrushType != LayerBrushType.Regular)
return;
// Apply transformations
var sizeProperty = Transform.Scale.CurrentValue;
var rotationProperty = Transform.Rotation.CurrentValue;
@@ -321,7 +326,8 @@ namespace Artemis.Core.Models.Profile
);
var renderPath = new SKPath();
renderPath.AddRect(boundsRect);
LayerBrush?.Render(canvas, canvasInfo, renderPath, paint);
LayerBrush.InternalRender(canvas, canvasInfo, renderPath, paint);
}
internal void CalculateRenderProperties()
@@ -165,6 +165,9 @@ namespace Artemis.Core.Models.Profile
internal void ApplyToEntity()
{
if (!PropertiesInitialized)
return;
// Get all properties with a PropertyDescriptionAttribute
foreach (var propertyInfo in GetType().GetProperties())
{