tidy
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia;
|
||||
using SukiUI.Utilities.Background;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Styling;
|
||||
using SukiUI.Utilities.Background;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class FastNoiseBackgroundRenderer
|
||||
|
||||
public FastNoiseBackgroundRenderer(FastNoiseRendererOptions? options = null)
|
||||
{
|
||||
FastNoiseRendererOptions opt = options ??
|
||||
FastNoiseRendererOptions opt = options ??
|
||||
new FastNoiseRendererOptions(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||
|
||||
NoiseGen.SetNoiseType(opt.Type);
|
||||
@@ -130,7 +130,7 @@ public class FastNoiseBackgroundRenderer
|
||||
return ARGB(A(back), resultR, resultG, resultB);
|
||||
}
|
||||
|
||||
private static byte G(uint col) =>
|
||||
private static byte G(uint col) =>
|
||||
(byte)(col >> 8);
|
||||
|
||||
private static uint GetBackgroundColour(Color input)
|
||||
@@ -159,7 +159,7 @@ public class FastNoiseBackgroundRenderer
|
||||
|
||||
private static byte R(uint col) => (byte)(col >> 16);
|
||||
|
||||
private static uint ToUInt32(Color colour) =>
|
||||
private static uint ToUInt32(Color colour) =>
|
||||
(uint)(colour.A << 24 | colour.R << 16 | colour.G << 8 | colour.B);
|
||||
|
||||
private static uint WithAlpha(uint col, byte a) => col & 0x00FFFFFF | (uint)(a << 24);
|
||||
|
||||
@@ -20,4 +20,4 @@ public readonly struct FastNoiseRendererOptions(
|
||||
public float XSeed { get; } = xSeed * seedScale;
|
||||
|
||||
public float YSeed { get; } = ySeed * seedScale;
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,13 @@ using Avalonia.Styling;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class FastRendererBackground :
|
||||
public class FastRendererBackground :
|
||||
Image, IDisposable
|
||||
{
|
||||
private const int ImageWidth = 100;
|
||||
private const int ImageHeight = 100;
|
||||
|
||||
private readonly WriteableBitmap bitmap = new(new PixelSize(ImageWidth, ImageHeight),
|
||||
private readonly WriteableBitmap bitmap = new(new PixelSize(ImageWidth, ImageHeight),
|
||||
new Vector(96, 96), PixelFormat.Bgra8888);
|
||||
|
||||
private readonly FastNoiseBackgroundRenderer renderer = new();
|
||||
@@ -29,7 +29,7 @@ public class FastRendererBackground :
|
||||
base.EndInit();
|
||||
if (Application.Current?.ActualThemeVariant is ThemeVariant theme)
|
||||
{
|
||||
renderer.UpdateValues((Color)Application.Current.FindResource("SystemAccentColorLight3"),
|
||||
renderer.UpdateValues((Color)Application.Current.FindResource("SystemAccentColorLight3"),
|
||||
(Color)Application.Current.FindResource("SystemAccentColorDark3"), theme);
|
||||
}
|
||||
|
||||
@@ -41,4 +41,4 @@ public class FastRendererBackground :
|
||||
GC.SuppressFinalize(this);
|
||||
bitmap.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user