|
|
|
@ -7,12 +7,12 @@ namespace ImageSharp.Formats.Jpg |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Represents an area of a Jpeg subimage (channel)
|
|
|
|
/// Represents an area of a Jpeg subimage (channel)
|
|
|
|
/// </summary>
|
|
|
|
internal struct JpegPixelArea |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="JpegPixelArea" /> struct from existing data.
|
|
|
|
/// Initializes a new instance of the <see cref="JpegPixelArea" /> struct from existing data.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pixels">The pixel array</param>
|
|
|
|
/// <param name="striede">The stride</param>
|
|
|
|
@ -25,32 +25,32 @@ namespace ImageSharp.Formats.Jpg |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the pixels.
|
|
|
|
/// Gets the pixels.
|
|
|
|
/// </summary>
|
|
|
|
public byte[] Pixels { get; private set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a value indicating whether the instance has been initalized. (Is not default(JpegPixelArea))
|
|
|
|
/// Gets a value indicating whether the instance has been initalized. (Is not default(JpegPixelArea))
|
|
|
|
/// </summary>
|
|
|
|
public bool IsInitialized => this.Pixels != null; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or the stride.
|
|
|
|
/// Gets or the stride.
|
|
|
|
/// </summary>
|
|
|
|
public int Stride { get; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or the offset.
|
|
|
|
/// Gets or the offset.
|
|
|
|
/// </summary>
|
|
|
|
public int Offset { get; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a <see cref="MutableSpan{T}" /> of bytes to the pixel area
|
|
|
|
/// Gets a <see cref="MutableSpan{T}" /> of bytes to the pixel area
|
|
|
|
/// </summary>
|
|
|
|
public MutableSpan<byte> Span => new MutableSpan<byte>(this.Pixels, this.Offset); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns the pixel at (x, y)
|
|
|
|
/// Returns the pixel at (x, y)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="x">The x index</param>
|
|
|
|
/// <param name="y">The y index</param>
|
|
|
|
@ -65,9 +65,9 @@ namespace ImageSharp.Formats.Jpg |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new instance of the <see cref="JpegPixelArea" /> struct.
|
|
|
|
/// Pixel array will be taken from a pool, this instance will be the owner of it's pixel data, therefore
|
|
|
|
/// <see cref="ReturnPooled" /> should be called when the instance is no longer needed.
|
|
|
|
/// Creates a new instance of the <see cref="JpegPixelArea" /> struct.
|
|
|
|
/// Pixel array will be taken from a pool, this instance will be the owner of it's pixel data, therefore
|
|
|
|
/// <see cref="ReturnPooled" /> should be called when the instance is no longer needed.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="width">The width.</param>
|
|
|
|
/// <param name="height">The height.</param>
|
|
|
|
@ -80,7 +80,7 @@ namespace ImageSharp.Formats.Jpg |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns <see cref="Pixels" /> to the pool
|
|
|
|
/// Returns <see cref="Pixels" /> to the pool
|
|
|
|
/// </summary>
|
|
|
|
public void ReturnPooled() |
|
|
|
{ |
|
|
|
@ -94,7 +94,7 @@ namespace ImageSharp.Formats.Jpg |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the subarea that belongs to the Block8x8 defined by block indices
|
|
|
|
/// Gets the subarea that belongs to the Block8x8 defined by block indices
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="bx">The block X index</param>
|
|
|
|
/// <param name="by">The block Y index</param>
|
|
|
|
@ -106,7 +106,7 @@ namespace ImageSharp.Formats.Jpg |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the row offset at the given position
|
|
|
|
/// Gets the row offset at the given position
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="y">The y-coordinate of the image.</param>
|
|
|
|
/// <returns>The <see cref="int" /></returns>
|
|
|
|
@ -116,9 +116,9 @@ namespace ImageSharp.Formats.Jpg |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load values to the pixel area from the given <see cref="Block8x8F" />.
|
|
|
|
/// Level shift [-128.0, 128.0] floating point color values by +128, clip them to [0, 255], and convert them to
|
|
|
|
/// <see cref="byte" /> values
|
|
|
|
/// Load values to the pixel area from the given <see cref="Block8x8F" />.
|
|
|
|
/// Level shift [-128.0, 128.0] floating point color values by +128, clip them to [0, 255], and convert them to
|
|
|
|
/// <see cref="byte" /> values
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="block">The block holding the color values</param>
|
|
|
|
/// <param name="temp">Temporal block provided by the caller</param>
|
|
|
|
|