diff --git a/src/ImageSharp/Colors/ColorConstants.cs b/src/ImageSharp/Colors/ColorConstants.cs index f3b01f466..1397b6da6 100644 --- a/src/ImageSharp/Colors/ColorConstants.cs +++ b/src/ImageSharp/Colors/ColorConstants.cs @@ -26,7 +26,7 @@ namespace ImageSharp /// /// Returns an array of web safe colors. /// - /// + /// The private static Color[] GetWebSafeColors() { return new List diff --git a/src/ImageSharp/Colors/ColorTransforms.cs b/src/ImageSharp/Colors/ColorTransforms.cs index 5f8fe37db..f61afbf5b 100644 --- a/src/ImageSharp/Colors/ColorTransforms.cs +++ b/src/ImageSharp/Colors/ColorTransforms.cs @@ -82,8 +82,8 @@ namespace ImageSharp /// /// Multiplies the complements of the backdrop and source color values, then complements the result. /// - /// The result color is always at least as light as either of the two constituent colors. Screening any - /// color with white produces white; screening with black leaves the original color unchanged. + /// The result color is always at least as light as either of the two constituent colors. Screening any + /// color with white produces white; screening with black leaves the original color unchanged. /// The effect is similar to projecting multiple photographic slides simultaneously onto a single screen. /// /// @@ -99,7 +99,7 @@ namespace ImageSharp } /// - /// Multiplies or screens the colors, depending on the source color value. The effect is similar to + /// Multiplies or screens the colors, depending on the source color value. The effect is similar to /// shining a harsh spotlight on the backdrop. /// /// The backdrop color. @@ -116,7 +116,7 @@ namespace ImageSharp /// /// Multiplies or screens the colors, depending on the backdrop color value. /// - /// Source colors overlay the backdrop while preserving its highlights and shadows. + /// Source colors overlay the backdrop while preserving its highlights and shadows. /// The backdrop color is not replaced but is mixed with the source color to reflect the lightness or darkness /// of the backdrop. /// @@ -133,7 +133,7 @@ namespace ImageSharp } /// - /// Selects the darker of the backdrop and source colors. + /// Selects the darker of the backdrop and source colors. /// The backdrop is replaced with the source where the source is darker; otherwise, it is left unchanged. /// /// The backdrop color. @@ -148,7 +148,7 @@ namespace ImageSharp } /// - /// Selects the lighter of the backdrop and source colors. + /// Selects the lighter of the backdrop and source colors. /// The backdrop is replaced with the source where the source is lighter; otherwise, it is left unchanged. /// /// The backdrop color. @@ -221,7 +221,7 @@ namespace ImageSharp } /// - /// Produces an effect similar to that of the mode but lower in contrast. Painting with white + /// Produces an effect similar to that of the mode but lower in contrast. Painting with white /// inverts the backdrop color; painting with black produces no change /// /// The backdrop color. diff --git a/src/ImageSharp/Colors/Colorspaces/CieLab.cs b/src/ImageSharp/Colors/Colorspaces/CieLab.cs index b0c042a3c..f817ae12b 100644 --- a/src/ImageSharp/Colors/Colorspaces/CieLab.cs +++ b/src/ImageSharp/Colors/Colorspaces/CieLab.cs @@ -86,7 +86,8 @@ namespace ImageSharp // Now to LAB x /= 0.95047F; - //y /= 1F; + + // y /= 1F; z /= 1.08883F; x = x > 0.008856F ? (float)Math.Pow(x, 0.3333333F) : ((903.3F * x) + 16F) / 116F; diff --git a/src/ImageSharp/Colors/PackedPixel/Alpha8.cs b/src/ImageSharp/Colors/PackedPixel/Alpha8.cs index 234976b48..0100afee1 100644 --- a/src/ImageSharp/Colors/PackedPixel/Alpha8.cs +++ b/src/ImageSharp/Colors/PackedPixel/Alpha8.cs @@ -14,7 +14,7 @@ namespace ImageSharp public struct Alpha8 : IPackedPixel, IEquatable { /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The alpha component public Alpha8(float alpha) diff --git a/src/ImageSharp/Colors/PackedPixel/Bgr565.cs b/src/ImageSharp/Colors/PackedPixel/Bgr565.cs index 214e03c5f..e28c7aed0 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgr565.cs +++ b/src/ImageSharp/Colors/PackedPixel/Bgr565.cs @@ -14,7 +14,7 @@ namespace ImageSharp public struct Bgr565 : IPackedPixel, IEquatable { /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The x-component /// The y-component @@ -25,7 +25,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// /// The vector containing the components for the packed value. diff --git a/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs b/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs index 630415d03..ed07a69c0 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs +++ b/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs @@ -14,7 +14,7 @@ namespace ImageSharp public struct Bgra4444 : IPackedPixel, IEquatable { /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The x-component /// The y-component @@ -26,7 +26,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The vector containing the components for the packed vector. public Bgra4444(Vector4 vector) diff --git a/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs b/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs index 50aa67914..97153af9d 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs +++ b/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs @@ -14,7 +14,7 @@ namespace ImageSharp public struct Bgra5551 : IPackedPixel, IEquatable { /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The x-component /// The y-component diff --git a/src/ImageSharp/Colors/PackedPixel/Byte4.cs b/src/ImageSharp/Colors/PackedPixel/Byte4.cs index f757ac077..31efd6094 100644 --- a/src/ImageSharp/Colors/PackedPixel/Byte4.cs +++ b/src/ImageSharp/Colors/PackedPixel/Byte4.cs @@ -14,7 +14,7 @@ namespace ImageSharp public struct Byte4 : IPackedPixel, IEquatable { /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// /// A vector containing the initial values for the components of the Byte4 structure. @@ -25,7 +25,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The x-component /// The y-component diff --git a/src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs b/src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs index ae71294bc..d6d680ed4 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs +++ b/src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs @@ -99,6 +99,7 @@ namespace ImageSharp exponent--; mantissa = mantissa << 1; } + mantissa &= 0xfffffbff; result = ((uint)((((uint)value & 0x8000) << 16) | ((exponent + 127) << 23))) | (mantissa << 13); } diff --git a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs b/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs index f356024b3..2b4b5b3de 100644 --- a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs +++ b/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs @@ -48,25 +48,25 @@ namespace ImageSharp return FromStandardType(target); } - // Normalized offsets. All four components. + // Normalized offsets. All four components. if (IsOffsetNormalizedType(source)) { return FromOffsetNormalizedType(target); } - // Offset. All four components. + // Offset. All four components. if (IsOffsetType(source)) { return FromOffsetType(target); } - // Normalized offsets. First component pair only. + // Normalized offsets. First component pair only. if (IsOffsetTwoComponentNormalizedType(source)) { return FromOffsetTwoComponentNormalizedType(target); } - // Offsets. First component pair only. + // Offsets. First component pair only. if (IsOffsetTwoComponentType(source)) { return FromOffsetTwoComponentType(target); @@ -200,7 +200,7 @@ namespace ImageSharp { return vector4 => { - // Compress the range then offset the center up for first pair. + // Compress the range then offset the center up for first pair. Vector4 v = (vector4 / 2F) + new Vector4(.5F); return new Vector4(v.X, v.Y, 0F, 1F); }; @@ -210,7 +210,7 @@ namespace ImageSharp { return vector4 => { - // Compress the range, multiply, then offset the center up for first pair. + // Compress the range, multiply, then offset the center up for first pair. Vector4 v = ((vector4 / 2F) * 255F) + new Vector4(127.5F); return new Vector4(v.X, v.Y, 0F, 255F); }; diff --git a/src/ImageSharp/Colors/PackedPixel/Rgba64.cs b/src/ImageSharp/Colors/PackedPixel/Rgba64.cs index 3744fb1ec..2b9932519 100644 --- a/src/ImageSharp/Colors/PackedPixel/Rgba64.cs +++ b/src/ImageSharp/Colors/PackedPixel/Rgba64.cs @@ -14,7 +14,7 @@ namespace ImageSharp public struct Rgba64 : IPackedPixel, IEquatable, IPackedVector { /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The x-component /// The y-component @@ -26,7 +26,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The vector containing the components values. public Rgba64(Vector4 vector) diff --git a/src/ImageSharp/Colors/PackedPixel/Short4.cs b/src/ImageSharp/Colors/PackedPixel/Short4.cs index 190c579ce..13bce08c8 100644 --- a/src/ImageSharp/Colors/PackedPixel/Short4.cs +++ b/src/ImageSharp/Colors/PackedPixel/Short4.cs @@ -29,7 +29,7 @@ namespace ImageSharp private static readonly Vector4 Round = new Vector4(.5F); /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// A vector containing the initial values for the components. public Short4(Vector4 vector) @@ -38,7 +38,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The x-component. /// The y-component. diff --git a/src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs b/src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs index a6d43a47a..df986f8a7 100644 --- a/src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs +++ b/src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs @@ -89,7 +89,7 @@ namespace ImageSharp } /// - /// Selects the minimum of the backdrop and source vectors. + /// Selects the minimum of the backdrop and source vectors. /// /// The backdrop vector. /// The source vector. @@ -104,7 +104,7 @@ namespace ImageSharp } /// - /// Selects the max of the backdrop and source vector. + /// Selects the max of the backdrop and source vector. /// /// The backdrop vector. /// The source vector. diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs index 6fbde6418..c7fdfd721 100644 --- a/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs +++ b/src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Processors /// Converts the colors of the image to Grayscale applying the formula as specified by /// ITU-R Recommendation BT.709 . /// + /// The pixel format. + /// The packed format. uint, long, float. public class GrayscaleBt709Processor : ColorMatrixFilter where TColor : struct, IPackedPixel where TPacked : struct diff --git a/src/ImageSharp/Image/PixelAccessor.cs b/src/ImageSharp/Image/PixelAccessor.cs index 255285c21..5b1305047 100644 --- a/src/ImageSharp/Image/PixelAccessor.cs +++ b/src/ImageSharp/Image/PixelAccessor.cs @@ -106,7 +106,7 @@ namespace ImageSharp { get { -#if DEBUG +#if DEBUG if (x < 0 || x >= this.Width) { throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds."); @@ -122,7 +122,7 @@ namespace ImageSharp set { -#if DEBUG +#if DEBUG if (x < 0 || x >= this.Width) { throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds."); @@ -254,6 +254,14 @@ namespace ImageSharp GC.SuppressFinalize(this); } + /// + /// Resets all the pixels to it's initial value. + /// + internal void Reset() + { + Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height)); + } + /// /// Copies from a row in format. /// @@ -429,13 +437,5 @@ namespace ImageSharp { return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf()); } - - /// - /// Resets all the pixels to it's initial value. - /// - internal void Reset() - { - Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height)); - } } } \ No newline at end of file diff --git a/src/ImageSharp/Image/PixelRow.cs b/src/ImageSharp/Image/PixelRow.cs index e13b62005..a97e49deb 100644 --- a/src/ImageSharp/Image/PixelRow.cs +++ b/src/ImageSharp/Image/PixelRow.cs @@ -178,6 +178,14 @@ namespace ImageSharp GC.SuppressFinalize(this); } + /// + /// Resets the bytes of the array to it's initial value. + /// + internal void Reset() + { + Unsafe.InitBlock(this.PixelBase, 0, (uint)this.Bytes.Length); + } + /// /// Gets component count for the given order. /// @@ -202,13 +210,5 @@ namespace ImageSharp throw new NotSupportedException(); } - - /// - /// Resets the bytes of the array to it's initial value. - /// - internal void Reset() - { - Unsafe.InitBlock(this.PixelBase, 0, (uint)this.Bytes.Length); - } } } diff --git a/src/ImageSharp/ImageFrame.cs b/src/ImageSharp/ImageFrame.cs index 760e559fd..0e4741f11 100644 --- a/src/ImageSharp/ImageFrame.cs +++ b/src/ImageSharp/ImageFrame.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // diff --git a/src/ImageSharp/PixelAccessor.cs b/src/ImageSharp/PixelAccessor.cs index 484173844..ff0abddf9 100644 --- a/src/ImageSharp/PixelAccessor.cs +++ b/src/ImageSharp/PixelAccessor.cs @@ -27,7 +27,7 @@ namespace ImageSharp byte* source = row.PixelBase; byte* destination = this.GetRowPointer(targetY) + targetX; - Unsafe.CopyBlock(destination, source, (uint) width * 4); + Unsafe.CopyBlock(destination, source, (uint)width * 4); } /// @@ -38,7 +38,7 @@ namespace ImageSharp for (int x = 0; x < width; x++) { - Unsafe.Write(destination, (uint)(*(source) << 0 | *(source + 1) << 8 | *(source + 2) << 16 | 255 << 24)); + Unsafe.Write(destination, (uint)(*source << 0 | *(source + 1) << 8 | *(source + 2) << 16 | 255 << 24)); source += 3; destination += 4;