diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs b/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs index 5706d907d..08257fa68 100644 --- a/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs +++ b/src/ImageSharp/Colors/PackedPixel/IPackedPixel.cs @@ -6,6 +6,7 @@ namespace ImageSharp { using System; + /// /// An interface that represents a packed pixel type. /// diff --git a/src/ImageSharp/Drawing/Brushes/Brushes`2.cs b/src/ImageSharp/Drawing/Brushes/Brushes`2.cs index 5d2f81dc8..2e2eb5ad3 100644 --- a/src/ImageSharp/Drawing/Brushes/Brushes`2.cs +++ b/src/ImageSharp/Drawing/Brushes/Brushes`2.cs @@ -3,10 +3,10 @@ // Licensed under the Apache License, Version 2.0. // -using System; - namespace ImageSharp.Drawing.Brushes { + using System; + /// /// A collection of methods for creating generic brushes. /// diff --git a/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs b/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs index 203fa85cd..cdbdf23ad 100644 --- a/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs +++ b/src/ImageSharp/Drawing/Brushes/PatternBrush`2.cs @@ -5,10 +5,10 @@ namespace ImageSharp.Drawing.Brushes { + using System; using System.Numerics; using Processors; - using System; /// /// Provides an implementation of a pattern brush for painting patterns. @@ -30,12 +30,12 @@ namespace ImageSharp.Drawing.Brushes /// 0 /// 0 /// - /// Warning when use array initializer across multiple lines the bools look inverted i.e. + /// Warning when use array initializer across multiple lines the bools look inverted i.e. /// new bool[,]{ /// {true, false, false}, /// {false,true, false} /// } - /// would be + /// would be /// 10 /// 01 /// 00 diff --git a/src/ImageSharp/Drawing/Draw.cs b/src/ImageSharp/Drawing/Draw.cs index e3d1be350..0f58c5727 100644 --- a/src/ImageSharp/Drawing/Draw.cs +++ b/src/ImageSharp/Drawing/Draw.cs @@ -220,6 +220,7 @@ namespace ImageSharp { return source.DrawPolygon(pen, new Polygon(new LinearLineSegment(points)), options); } + /// /// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// diff --git a/src/ImageSharp/Drawing/DrawImage.cs b/src/ImageSharp/Drawing/DrawImage.cs index d29415d37..b7e672e0a 100644 --- a/src/ImageSharp/Drawing/DrawImage.cs +++ b/src/ImageSharp/Drawing/DrawImage.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/Drawing/Fill.cs b/src/ImageSharp/Drawing/Fill.cs index 65b506f5e..4a96b20ac 100644 --- a/src/ImageSharp/Drawing/Fill.cs +++ b/src/ImageSharp/Drawing/Fill.cs @@ -56,6 +56,7 @@ namespace ImageSharp /// The source. /// The brush. /// The shape. + /// The graphics options. /// The Image public static Image Fill(this Image source, IBrush brush, IShape shape, GraphicsOptions options) where TColor : struct, IPackedPixel diff --git a/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs b/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs index b1b3e8dc9..af0af20fa 100644 --- a/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs +++ b/src/ImageSharp/Drawing/Processors/DrawPathProcessor.cs @@ -34,7 +34,7 @@ namespace ImageSharp.Drawing.Processors private readonly IPath[] paths; private readonly RectangleF region; private readonly GraphicsOptions options; - + /// /// Initializes a new instance of the class. /// @@ -56,7 +56,7 @@ namespace ImageSharp.Drawing.Processors : this(pen, new[] { path }, options) { } - + /// /// Initializes a new instance of the class. /// @@ -134,10 +134,10 @@ namespace ImageSharp.Drawing.Processors currentPoint.X = offsetX; currentPoint.Y = offsetY; - var dist = Closest(currentPoint); + var dist = this.Closest(currentPoint); var color = applicator.GetColor(dist); - + var opacity = this.Opacity(color.DistanceFromElement); if (opacity > Epsilon) diff --git a/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs b/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs index 6ced979e5..3209ce9c5 100644 --- a/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs +++ b/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs @@ -35,6 +35,7 @@ namespace ImageSharp.Drawing.Processors /// /// The brush. /// The shape. + /// The graphics options. public FillShapeProcessor(IBrush brush, IShape shape, GraphicsOptions options) { this.poly = shape; @@ -73,7 +74,7 @@ namespace ImageSharp.Drawing.Processors { polyStartY = 0; } - + using (PixelAccessor sourcePixels = source.Lock()) using (IBrushApplicator applicator = this.fillColor.CreateApplicator(rect)) { diff --git a/src/ImageSharp/Drawing/Shapes/LinearPolygon.cs b/src/ImageSharp/Drawing/Shapes/LinearPolygon.cs index 2b7a0292a..03069b678 100644 --- a/src/ImageSharp/Drawing/Shapes/LinearPolygon.cs +++ b/src/ImageSharp/Drawing/Shapes/LinearPolygon.cs @@ -25,7 +25,7 @@ namespace ImageSharp.Drawing.Shapes { this.innerPolygon = new Polygon(new LinearLineSegment(points)); } - + /// /// Gets the bounding box of this shape. /// diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 4cbae6e77..b729f30e9 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -53,7 +53,8 @@ namespace ImageSharp.Formats /// The to encode from. /// The to encode the image data to. public void Encode(Image image, Stream stream) - where TColor : struct, IPackedPixel where TPacked : struct, IEquatable + where TColor : struct, IPackedPixel + where TPacked : struct, IEquatable { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -121,7 +122,8 @@ namespace ImageSharp.Formats /// The . /// private static int GetTransparentIndex(QuantizedImage quantized) - where TColor : struct, IPackedPixel where TPacked : struct, IEquatable + where TColor : struct, IPackedPixel + where TPacked : struct, IEquatable { // Find the lowest alpha value and make it the transparent index. int index = -1; @@ -236,7 +238,9 @@ namespace ImageSharp.Formats private void WriteGraphicalControlExtension( ImageBase image, EndianBinaryWriter writer, - int transparencyIndex) where TColor : struct, IPackedPixel where TPacked : struct, IEquatable + int transparencyIndex) + where TColor : struct, IPackedPixel + where TPacked : struct, IEquatable { // TODO: Check transparency logic. bool hasTransparent = transparencyIndex > -1; @@ -281,7 +285,8 @@ namespace ImageSharp.Formats /// The to be encoded. /// The stream to write to. private void WriteImageDescriptor(ImageBase image, EndianBinaryWriter writer) - where TColor : struct, IPackedPixel where TPacked : struct, IEquatable + where TColor : struct, IPackedPixel + where TPacked : struct, IEquatable { writer.Write(GifConstants.ImageDescriptorLabel); // 2c // TODO: Can we capture this? diff --git a/src/ImageSharp/Formats/Jpg/Components/Bits.cs b/src/ImageSharp/Formats/Jpg/Components/Bits.cs index b273b2702..0eebef132 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Bits.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Bits.cs @@ -36,7 +36,8 @@ namespace ImageSharp.Formats /// the caller is the one responsible for first checking that bits.UnreadBits < n. /// /// The number of bits to ensure. - /// + /// Jpeg decoder + /// Error code [MethodImpl(MethodImplOptions.AggressiveInlining)] internal JpegDecoderCore.ErrorCodes EnsureNBits(int n, JpegDecoderCore decoder) { @@ -69,6 +70,12 @@ namespace ImageSharp.Formats } } + /// + /// Receive extend + /// + /// Byte + /// Jpeg decoder + /// Read bits value internal int ReceiveExtend(byte t, JpegDecoderCore decoder) { if (this.UnreadBits < t) diff --git a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs index c27de4ca9..33b73cdd1 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs @@ -85,6 +85,8 @@ namespace ImageSharp.Formats /// /// Load raw 32bit floating point data from source /// + /// Block pointer + /// Source [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe void LoadFrom(Block8x8F* blockPtr, MutableSpan source) { @@ -94,6 +96,8 @@ namespace ImageSharp.Formats /// /// Copy raw 32bit floating point data to dest /// + /// Block pointer + /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe void CopyTo(Block8x8F* blockPtr, MutableSpan dest) { @@ -103,6 +107,7 @@ namespace ImageSharp.Formats /// /// Load raw 32bit floating point data from source /// + /// Source [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void LoadFrom(MutableSpan source) { @@ -115,6 +120,7 @@ namespace ImageSharp.Formats /// /// Copy raw 32bit floating point data to dest /// + /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void CopyTo(MutableSpan dest) { @@ -127,6 +133,7 @@ namespace ImageSharp.Formats /// /// Copy raw 32bit floating point data to dest /// + /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void CopyTo(float[] dest) { @@ -161,17 +168,17 @@ namespace ImageSharp.Formats /// Apply floating point IDCT transformation into dest, using a temporary block 'temp' provided by the caller (optimization) /// /// Destination - /// Temporary block provided by the caller - public void TransformIDCTInto(ref Block8x8F dest, ref Block8x8F temp) + /// Temporary block provided by the caller + public void TransformIDCTInto(ref Block8x8F dest, ref Block8x8F tempBlockPtr) { - this.TransposeInto(ref temp); - temp.IDCT8x4_LeftPart(ref dest); - temp.IDCT8x4_RightPart(ref dest); + this.TransposeInto(ref tempBlockPtr); + tempBlockPtr.IDCT8x4_LeftPart(ref dest); + tempBlockPtr.IDCT8x4_RightPart(ref dest); - dest.TransposeInto(ref temp); + dest.TransposeInto(ref tempBlockPtr); - temp.IDCT8x4_LeftPart(ref dest); - temp.IDCT8x4_RightPart(ref dest); + tempBlockPtr.IDCT8x4_LeftPart(ref dest); + tempBlockPtr.IDCT8x4_RightPart(ref dest); dest.MultiplyAllInplace(C_0_125); } @@ -179,6 +186,9 @@ namespace ImageSharp.Formats /// /// Pointer-based "Indexer" (getter part) /// + /// Block pointer + /// Index + /// The scalar value at the specified index [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static unsafe float GetScalarAt(Block8x8F* blockPtr, int idx) { @@ -189,6 +199,9 @@ namespace ImageSharp.Formats /// /// Pointer-based "Indexer" (setter part) /// + /// Block pointer + /// Index + /// Value [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static unsafe void SetScalarAt(Block8x8F* blockPtr, int idx, float value) { @@ -196,11 +209,17 @@ namespace ImageSharp.Formats fp[idx] = value; } + /// + /// Un-zig + /// + /// Block pointer + /// Qt pointer + /// Unzig pointer [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void UnZig(Block8x8F* block, Block8x8F* qt, int* unzigPtr) + internal static unsafe void UnZig(Block8x8F* blockPtr, Block8x8F* qtPtr, int* unzigPtr) { - float* b = (float*)block; - float* qtp = (float*)qt; + float* b = (float*)blockPtr; + float* qtp = (float*)qtPtr; for (int zig = 0; zig < BlockF.BlockSize; zig++) { float* unzigPos = b + unzigPtr[zig]; @@ -213,6 +232,7 @@ namespace ImageSharp.Formats /// /// Copy raw 32bit floating point data to dest /// + /// Destination internal unsafe void CopyTo(MutableSpan dest) { fixed (Vector4* ptr = &this.V0L) @@ -228,6 +248,7 @@ namespace ImageSharp.Formats /// /// Load raw 32bit floating point data from source /// + /// Source internal unsafe void LoadFrom(MutableSpan source) { fixed (Vector4* ptr = &this.V0L) @@ -301,8 +322,9 @@ namespace ImageSharp.Formats /// Original source: /// https://github.com/norishigefukushima/dct_simd/blob/master/dct/dct8x8_simd.cpp#L261 /// + /// Destination Block pointer [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void IDCT8x4_RightPart(ref Block8x8F d) + internal void IDCT8x4_RightPart(ref Block8x8F destBlockPtr) { Vector4 my1 = this.V1R; Vector4 my7 = this.V7R; @@ -342,14 +364,14 @@ namespace ImageSharp.Formats my1 = mz1 + mz2; my2 = mz1 - mz2; - d.V0R = my0 + mb0; - d.V7R = my0 - mb0; - d.V1R = my1 + mb1; - d.V6R = my1 - mb1; - d.V2R = my2 + mb2; - d.V5R = my2 - mb2; - d.V3R = my3 + mb3; - d.V4R = my3 - mb3; + destBlockPtr.V0R = my0 + mb0; + destBlockPtr.V7R = my0 - mb0; + destBlockPtr.V1R = my1 + mb1; + destBlockPtr.V6R = my1 - mb1; + destBlockPtr.V2R = my2 + mb2; + destBlockPtr.V5R = my2 - mb2; + destBlockPtr.V3R = my3 + mb3; + destBlockPtr.V4R = my3 - mb3; } /// @@ -365,7 +387,7 @@ namespace ImageSharp.Formats /// /// TODO: Should be removed when BlockF goes away /// - /// + /// Legacy block internal void LoadFrom(ref BlockF legacyBlock) { this.LoadFrom(legacyBlock.Data); @@ -374,7 +396,7 @@ namespace ImageSharp.Formats /// /// TODO: Should be removed when BlockF goes away /// - /// + /// Legacy block internal void CopyTo(ref BlockF legacyBlock) { this.CopyTo(legacyBlock.Data); @@ -383,12 +405,15 @@ namespace ImageSharp.Formats /// /// Level shift by +128, clip to [0, 255], and write to buffer. /// + /// Color buffer + /// Stride offset + /// Temp Block pointer [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal unsafe void CopyColorsTo(MutableSpan buffer, int stride, Block8x8F* temp) + internal unsafe void CopyColorsTo(MutableSpan buffer, int stride, Block8x8F* tempBlockPtr) { - this.TransformByteConvetibleColorValuesInto(ref *temp); + this.TransformByteConvetibleColorValuesInto(ref *tempBlockPtr); - float* src = (float*)temp; + float* src = (float*)tempBlockPtr; for (int i = 0; i < 8; i++) { buffer[0] = (byte)src[0]; diff --git a/src/ImageSharp/Formats/Jpg/Components/Bytes.cs b/src/ImageSharp/Formats/Jpg/Components/Bytes.cs index 796ef1804..f848439a0 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Bytes.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Bytes.cs @@ -38,6 +38,7 @@ namespace ImageSharp.Formats /// /// Creates a new instance of the , and initializes it's buffer. /// + /// The bytes created public static Bytes Create() { return new Bytes { Buffer = ArrayPool.Rent(4096) }; @@ -56,6 +57,8 @@ namespace ImageSharp.Formats /// /// ReadByteStuffedByte is like ReadByte but is for byte-stuffed Huffman data. /// + /// Input stream + /// Error code /// The internal byte ReadByteStuffedByte(Stream inputStream, out JpegDecoderCore.ErrorCodes errorCode) { @@ -112,6 +115,7 @@ namespace ImageSharp.Formats /// /// Returns the next byte, whether buffered or not buffered. It does not care about byte stuffing. /// + /// Input stream /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] internal byte ReadByte(Stream inputStream) @@ -131,6 +135,7 @@ namespace ImageSharp.Formats /// Fills up the bytes buffer from the underlying stream. /// It should only be called when there are no unread bytes in bytes. /// + /// Input stream [MethodImpl(MethodImplOptions.AggressiveInlining)] internal void Fill(Stream inputStream) { diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs index 313360d1c..b9cdad39d 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs @@ -1874,7 +1874,7 @@ namespace ImageSharp.Formats /// /// The block of coefficients /// The Huffman tree - /// + /// Unzig ptr /// The zig-zag start index /// The zig-zag end index /// The low transform offset