mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
UI - Many misc fixes I can't remember
Profile editor - Removed layer outline, increasing performance by a lot Device visualizer - Streamlined custom Device providers - Added debug device provider ASUS - Added Maximus X Hero thanks @copystring Plugin core - Added PerLedLayerBrush Noise layer - Converted to PerLedLayerBrush, increasing performance and quality
This commit is contained in:
1 parent
3000d4607a
commit
aa7c914b92
29 files changed
+767
-277
No files matched your search
@@ -124,7 +124,8 @@ namespace Artemis.Core.Models.Profile.Conditions
|
||||
StaticConditionLambda = null;
|
||||
CompiledStaticConditionLambda = null;
|
||||
|
||||
if (PredicateType == PredicateType.Dynamic)
|
||||
// If the operator does not support a right side, create a static expression because the right side will simply be null
|
||||
if (PredicateType == PredicateType.Dynamic && Operator.SupportsRightSide)
|
||||
CreateDynamicExpression();
|
||||
|
||||
CreateStaticExpression();
|
||||
|
||||
@@ -156,8 +156,10 @@ namespace Artemis.Core.Models.Profile
|
||||
// Iterate the children in reverse because the first layer must be rendered last to end up on top
|
||||
for (var index = Children.Count - 1; index > -1; index--)
|
||||
{
|
||||
folderCanvas.Save();
|
||||
var profileElement = Children[index];
|
||||
profileElement.Render(deltaTime, folderCanvas, _folderBitmap.Info);
|
||||
folderCanvas.Restore();
|
||||
}
|
||||
|
||||
var targetLocation = Path.Bounds.Location;
|
||||
|
||||
@@ -425,12 +425,14 @@ namespace Artemis.Core.Models.Profile
|
||||
OnRenderPropertiesUpdated();
|
||||
}
|
||||
|
||||
internal SKPoint GetLayerAnchorPosition(SKPath layerPath)
|
||||
internal SKPoint GetLayerAnchorPosition(SKPath layerPath, bool zeroBased = false)
|
||||
{
|
||||
var positionProperty = Transform.Position.CurrentValue;
|
||||
|
||||
// Start at the center of the shape
|
||||
var position = new SKPoint(layerPath.Bounds.MidX, layerPath.Bounds.MidY);
|
||||
var position = zeroBased
|
||||
? new SKPoint(layerPath.Bounds.MidX - layerPath.Bounds.Left, layerPath.Bounds.MidY - layerPath.Bounds.Top)
|
||||
: new SKPoint(layerPath.Bounds.MidX, layerPath.Bounds.MidY);
|
||||
|
||||
// Apply translation
|
||||
position.X += positionProperty.X * layerPath.Bounds.Width;
|
||||
@@ -444,17 +446,46 @@ namespace Artemis.Core.Models.Profile
|
||||
/// layer translations out
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void ExcludePathFromTranslation(SKPath path)
|
||||
public void IncludePathInTranslation(SKPath path, bool zeroBased)
|
||||
{
|
||||
var sizeProperty = Transform.Scale.CurrentValue;
|
||||
var rotationProperty = Transform.Rotation.CurrentValue;
|
||||
|
||||
var anchorPosition = GetLayerAnchorPosition(Path);
|
||||
var anchorPosition = GetLayerAnchorPosition(Path, zeroBased);
|
||||
var anchorProperty = Transform.AnchorPoint.CurrentValue;
|
||||
|
||||
// Translation originates from the unscaled center of the shape and is tied to the anchor
|
||||
var x = anchorPosition.X - Bounds.MidX - anchorProperty.X * Bounds.Width;
|
||||
var y = anchorPosition.Y - Bounds.MidY - anchorProperty.Y * Bounds.Height;
|
||||
var x = anchorPosition.X - (zeroBased ? Bounds.MidX - Bounds.Left : Bounds.MidX) - anchorProperty.X * Bounds.Width;
|
||||
var y = anchorPosition.Y - (zeroBased ? Bounds.MidY - Bounds.Top : Bounds.MidY) - anchorProperty.Y * Bounds.Height;
|
||||
|
||||
if (General.FillType == LayerFillType.Stretch)
|
||||
{
|
||||
path.Transform(SKMatrix.MakeTranslation(x, y));
|
||||
path.Transform(SKMatrix.MakeScale((sizeProperty.Width / 100f), (sizeProperty.Height / 100f), anchorPosition.X, anchorPosition.Y));
|
||||
path.Transform(SKMatrix.MakeRotationDegrees(rotationProperty, anchorPosition.X, anchorPosition.Y));
|
||||
}
|
||||
else
|
||||
{
|
||||
path.Transform(SKMatrix.MakeTranslation(x, y));
|
||||
path.Transform(SKMatrix.MakeRotationDegrees(rotationProperty * -1, anchorPosition.X, anchorPosition.Y));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Excludes the provided path from the translations applied to the layer by applying translations that cancel the
|
||||
/// layer translations out
|
||||
/// </summary>
|
||||
public void ExcludePathFromTranslation(SKPath path, bool zeroBased)
|
||||
{
|
||||
var sizeProperty = Transform.Scale.CurrentValue;
|
||||
var rotationProperty = Transform.Rotation.CurrentValue;
|
||||
|
||||
var anchorPosition = GetLayerAnchorPosition(Path, zeroBased);
|
||||
var anchorProperty = Transform.AnchorPoint.CurrentValue;
|
||||
|
||||
// Translation originates from the unscaled center of the shape and is tied to the anchor
|
||||
var x = anchorPosition.X - (zeroBased ? Bounds.MidX - Bounds.Left : Bounds.MidX) - anchorProperty.X * Bounds.Width;
|
||||
var y = anchorPosition.Y - (zeroBased ? Bounds.MidY - Bounds.Top : Bounds.MidY) - anchorProperty.Y * Bounds.Height;
|
||||
|
||||
var reversedXScale = 1f / (sizeProperty.Width / 100f);
|
||||
var reversedYScale = 1f / (sizeProperty.Height / 100f);
|
||||
@@ -472,6 +503,40 @@ namespace Artemis.Core.Models.Profile
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Excludes the provided canvas from the translations applied to the layer by applying translations that cancel the
|
||||
/// layer translations out
|
||||
/// </summary>
|
||||
/// <returns>The number of transformations applied</returns>
|
||||
public int ExcludeCanvasFromTranslation(SKCanvas canvas, bool zeroBased)
|
||||
{
|
||||
var sizeProperty = Transform.Scale.CurrentValue;
|
||||
var rotationProperty = Transform.Rotation.CurrentValue;
|
||||
|
||||
var anchorPosition = GetLayerAnchorPosition(Path, zeroBased);
|
||||
var anchorProperty = Transform.AnchorPoint.CurrentValue;
|
||||
|
||||
// Translation originates from the unscaled center of the shape and is tied to the anchor
|
||||
var x = anchorPosition.X - (zeroBased ? Bounds.MidX - Bounds.Left : Bounds.MidX) - anchorProperty.X * Bounds.Width;
|
||||
var y = anchorPosition.Y - (zeroBased ? Bounds.MidY - Bounds.Top : Bounds.MidY) - anchorProperty.Y * Bounds.Height;
|
||||
|
||||
var reversedXScale = 1f / (sizeProperty.Width / 100f);
|
||||
var reversedYScale = 1f / (sizeProperty.Height / 100f);
|
||||
|
||||
if (General.FillType == LayerFillType.Stretch)
|
||||
{
|
||||
canvas.Translate(x * -1, y * -1);
|
||||
canvas.Scale(reversedXScale, reversedYScale, anchorPosition.X, anchorPosition.Y);
|
||||
canvas.RotateDegrees(rotationProperty * -1, anchorPosition.X, anchorPosition.Y);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
canvas.RotateDegrees(rotationProperty * -1, anchorPosition.X, anchorPosition.Y);
|
||||
canvas.Translate(x * -1, y * -1);
|
||||
return 2;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LED management
|
||||
|
||||
Reference in new issue
Block a user