Browse Source

Removed core obsolete properties, decoupled frame metadata from the decoder

pull/1702/head
Dmitry Pentin 5 years ago
parent
commit
6b214ca129
  1. 5
      src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs
  2. 5
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs
  3. 17
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

5
src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs

@ -11,11 +11,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// </summary>
internal interface IRawJpegData : IDisposable
{
/// <summary>
/// Gets the image size in pixels.
/// </summary>
Size ImageSizeInPixels { get; }
/// <summary>
/// Gets the color space
/// </summary>

5
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs

@ -43,6 +43,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// </summary>
public int PixelWidth { get; set; }
/// <summary>
/// Gets the pixel size of the image.
/// </summary>
public Size PixelSize => new Size(this.PixelWidth, this.PixelHeight);
/// <summary>
/// Gets or sets the number of components within a frame. In progressive frames this value can range from only 1 to 4.
/// </summary>

17
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -110,23 +110,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
public Size ImageSizeInPixels { get; private set; }
/// <inheritdoc/>
Size IImageDecoderInternals.Dimensions => this.ImageSizeInPixels;
Size IImageDecoderInternals.Dimensions => this.Frame.PixelSize;
/// <summary>
/// Gets the number of MCU blocks in the image as <see cref="Size"/>.
/// </summary>
public Size ImageSizeInMCU { get; private set; }
/// <summary>
/// Gets the image width
/// </summary>
public int ImageWidth => this.ImageSizeInPixels.Width;
/// <summary>
/// Gets the image height
/// </summary>
public int ImageHeight => this.ImageSizeInPixels.Height;
/// <summary>
/// Gets a value indicating whether the metadata should be ignored when the image is being decoded.
/// </summary>
@ -214,7 +204,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
this.InitIptcProfile();
this.InitDerivedMetadataProperties();
return new ImageInfo(new PixelTypeInfo(this.Frame.BitsPerPixel), this.ImageWidth, this.ImageHeight, this.Metadata);
Size pixelSize = this.Frame.PixelSize;
return new ImageInfo(new PixelTypeInfo(this.Frame.BitsPerPixel), pixelSize.Width, pixelSize.Height, this.Metadata);
}
/// <summary>
@ -853,8 +844,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
ComponentCount = componentCount
};
this.ImageSizeInPixels = new Size(this.Frame.PixelWidth, this.Frame.PixelHeight);
this.Metadata.GetJpegMetadata().ColorType = this.ColorSpace == JpegColorSpace.Grayscale ? JpegColorType.Luminance : JpegColorType.YCbCr;
if (!metadataOnly)

Loading…
Cancel
Save