diff --git a/HPPH.Reference/PixelHelper.Average.cs b/HPPH.Reference/PixelHelper.Average.cs index 5544155..43b8f9c 100644 --- a/HPPH.Reference/PixelHelper.Average.cs +++ b/HPPH.Reference/PixelHelper.Average.cs @@ -9,10 +9,10 @@ public static partial class ReferencePixelHelper float count = image.Width * image.Height; ISum sum = Sum(image); - return new ColorRGBA((sum.R / count).GetByteValueFromPercentage(), - (sum.G / count).GetByteValueFromPercentage(), - (sum.B / count).GetByteValueFromPercentage(), - (sum.A / count).GetByteValueFromPercentage()); + return new ColorRGBA((byte)(sum.R / count), + (byte)(sum.G / count), + (byte)(sum.B / count), + (byte)(sum.A / count)); } public static T Average(RefImage image) @@ -21,10 +21,10 @@ public static partial class ReferencePixelHelper float count = image.Width * image.Height; ISum sum = Sum(image); - return (T)T.Create((sum.R / count).GetByteValueFromPercentage(), - (sum.G / count).GetByteValueFromPercentage(), - (sum.B / count).GetByteValueFromPercentage(), - (sum.A / count).GetByteValueFromPercentage()); + return (T)T.Create((byte)(sum.R / count), + (byte)(sum.G / count), + (byte)(sum.B / count), + (byte)(sum.A / count)); } public static T Average(ReadOnlySpan colors) @@ -33,10 +33,10 @@ public static partial class ReferencePixelHelper float count = colors.Length; ISum sum = Sum(colors); - return (T)T.Create((sum.R / count).GetByteValueFromPercentage(), - (sum.G / count).GetByteValueFromPercentage(), - (sum.B / count).GetByteValueFromPercentage(), - (sum.A / count).GetByteValueFromPercentage()); + return (T)T.Create((byte)(sum.R / count), + (byte)(sum.G / count), + (byte)(sum.B / count), + (byte)(sum.A / count)); } #endregion diff --git a/HPPH/PixelHelper.Average.cs b/HPPH/PixelHelper.Average.cs index 1b2d6f5..4cbbee2 100644 --- a/HPPH/PixelHelper.Average.cs +++ b/HPPH/PixelHelper.Average.cs @@ -65,9 +65,9 @@ public static partial class PixelHelper Generic4LongData sum = Sum(data); float count = data.Length; - return new Generic3ByteData((sum.L1 / count).GetByteValueFromPercentage(), - (sum.L2 / count).GetByteValueFromPercentage(), - (sum.L3 / count).GetByteValueFromPercentage()); + return new Generic3ByteData((byte)(sum.L1 / count), + (byte)(sum.L2 / count), + (byte)(sum.L3 / count)); } internal static Generic4ByteData Average(ReadOnlySpan data) @@ -79,10 +79,10 @@ public static partial class PixelHelper Generic4LongData sum = Sum(data); float count = data.Length; - return new Generic4ByteData((sum.L1 / count).GetByteValueFromPercentage(), - (sum.L2 / count).GetByteValueFromPercentage(), - (sum.L3 / count).GetByteValueFromPercentage(), - (sum.L4 / count).GetByteValueFromPercentage()); + return new Generic4ByteData((byte)(sum.L1 / count), + (byte)(sum.L2 / count), + (byte)(sum.L3 / count), + (byte)(sum.L4 / count)); } #endregion