更新
This commit is contained in:
23
WPFDark/Internals/ColorHelper.cs
Normal file
23
WPFDark/Internals/ColorHelper.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace WPFDark.Internals
|
||||
{
|
||||
internal static class ColorHelper
|
||||
{
|
||||
internal static Color Lerp(double ratio, Color c1, Color c2)
|
||||
=> Color.FromArgb(
|
||||
(byte)((c2.A - c1.A) * ratio + c1.A),
|
||||
(byte)((c2.R - c1.R) * ratio + c1.R),
|
||||
(byte)((c2.G - c1.G) * ratio + c1.G),
|
||||
(byte)((c2.B - c1.B) * ratio + c1.B));
|
||||
|
||||
|
||||
internal static ByteColor Lerp(double ratio, ByteColor c1, ByteColor c2)
|
||||
=> new ByteColor(
|
||||
(byte)((c2.A - c1.A) * ratio + c1.A),
|
||||
(byte)((c2.R - c1.R) * ratio + c1.R),
|
||||
(byte)((c2.G - c1.G) * ratio + c1.G),
|
||||
(byte)((c2.B - c1.B) * ratio + c1.B));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user