Added extensions for generic image

This commit is contained in:
Darth Affe 2024-07-14 21:01:47 +02:00
parent 2d30dc98ec
commit 0731472c24
4 changed files with 16 additions and 0 deletions

View File

@ -26,6 +26,10 @@ public static partial class PixelHelper
}
}
public static T Average<T>(this IImage<T> image)
where T : struct, IColor
=> image.AsRefImage().Average();
public static T Average<T>(this RefImage<T> image)
where T : struct, IColor
{

View File

@ -27,6 +27,10 @@ public static unsafe partial class PixelHelper
}
}
public static IMinMax MinMax<T>(this IImage<T> image)
where T : struct, IColor
=> image.AsRefImage().MinMax();
public static IMinMax MinMax<T>(this RefImage<T> image)
where T : struct, IColor
{

View File

@ -25,6 +25,10 @@ public static partial class PixelHelper
}
}
public static T[] CreateColorPalette<T>(this IImage<T> image, int paletteSize)
where T : unmanaged, IColor
=> image.AsRefImage().CreateColorPalette(paletteSize);
public static T[] CreateColorPalette<T>(this RefImage<T> image, int paletteSize)
where T : unmanaged, IColor
{

View File

@ -28,6 +28,10 @@ public static unsafe partial class PixelHelper
}
}
public static ISum Sum<T>(this IImage<T> image)
where T : struct, IColor
=> image.AsRefImage().Sum();
public static ISum Sum<T>(this RefImage<T> image)
where T : struct, IColor
{