mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Profiles - Abstracted property elements and effect elements
Folders - Added properties to folders Layer effects - Expanded to folders Layer effects - Added shape clipping
This commit is contained in:
1 parent
34bcd22f8c
commit
75b0ee8151
42 files changed
+638
-347
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using RGB.NET.Core;
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Extensions
|
||||
@@ -10,5 +11,25 @@ namespace Artemis.Core.Extensions
|
||||
{
|
||||
return new Color(color.Alpha, color.Red, color.Green, color.Blue);
|
||||
}
|
||||
|
||||
public static SKColor Interpolate(this SKColor from, SKColor to, float progress)
|
||||
{
|
||||
var redDiff = to.Red - from.Red;
|
||||
var greenDiff = to.Green - from.Green;
|
||||
var blueDiff = to.Blue - from.Blue;
|
||||
var alphaDiff = to.Alpha - from.Alpha;
|
||||
|
||||
return new SKColor(
|
||||
ClampToByte(from.Red + redDiff * progress),
|
||||
ClampToByte(from.Green + greenDiff * progress),
|
||||
ClampToByte(from.Blue + blueDiff * progress),
|
||||
ClampToByte(from.Alpha + alphaDiff * progress)
|
||||
);
|
||||
}
|
||||
|
||||
private static byte ClampToByte(float value)
|
||||
{
|
||||
return (byte)Math.Clamp(value, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,20 @@ namespace Artemis.Core.Extensions
|
||||
|
||||
return type.BaseType?.GetGenericTypeDefinition() == genericType;
|
||||
}
|
||||
|
||||
public static bool IsNumber(this object value)
|
||||
{
|
||||
return value is sbyte
|
||||
|| value is byte
|
||||
|| value is short
|
||||
|| value is ushort
|
||||
|| value is int
|
||||
|| value is uint
|
||||
|| value is long
|
||||
|| value is ulong
|
||||
|| value is float
|
||||
|| value is double
|
||||
|| value is decimal;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user