mirror of
https://github.com/DarthAffe/HPPH.git
synced 2026-11-09 18:36:34 +00:00
Changed current quantization method name to SimpleColorPalette, added placeholder for a more quality focused implementation
This commit is contained in:
1 parent
15981f82d6
commit
c897b34690
13 files changed
+436
-86
No files matched your search
@@ -6,19 +6,19 @@ public static partial class ReferencePixelHelper
|
||||
{
|
||||
#region Methods
|
||||
|
||||
public static T[] CreateColorPalette<T>(Image<T> image, int paletteSize)
|
||||
public static T[] CreateSimpleColorPalette<T>(Image<T> image, int paletteSize)
|
||||
where T : unmanaged, IColor
|
||||
=> CreateColorPalette<T>(image.ToArray(), paletteSize);
|
||||
=> CreateSimpleColorPalette<T>(image.ToArray(), paletteSize);
|
||||
|
||||
public static T[] CreateColorPalette<T>(RefImage<T> image, int paletteSize)
|
||||
public static T[] CreateSimpleColorPalette<T>(RefImage<T> image, int paletteSize)
|
||||
where T : unmanaged, IColor
|
||||
=> CreateColorPalette<T>(image.ToArray(), paletteSize);
|
||||
=> CreateSimpleColorPalette<T>(image.ToArray(), paletteSize);
|
||||
|
||||
public static T[] CreateColorPalette<T>(Span<T> colors, int paletteSize)
|
||||
public static T[] CreateSimpleColorPalette<T>(Span<T> colors, int paletteSize)
|
||||
where T : unmanaged, IColor =>
|
||||
CreateColorPalette<T>(colors.ToArray().Cast<IColor>().ToArray(), paletteSize).Select(x => T.Create(x.R, x.G, x.B, x.A)).Cast<T>().ToArray();
|
||||
CreateSimpleColorPalette<T>(colors.ToArray().Cast<IColor>().ToArray(), paletteSize).Select(x => T.Create(x.R, x.G, x.B, x.A)).Cast<T>().ToArray();
|
||||
|
||||
private static IColor[] CreateColorPalette<T>(IColor[] colors, int paletteSize)
|
||||
private static IColor[] CreateSimpleColorPalette<T>(IColor[] colors, int paletteSize)
|
||||
where T : struct, IColor
|
||||
{
|
||||
if (paletteSize == 0) return [];
|
||||
|
||||
Reference in new issue
Block a user