Browse Source

Remove ChunkTypes and Animated flag from metadata

pull/1552/head
Brian Popow 4 years ago
parent
commit
7ff7075e04
  1. 5
      src/ImageSharp/Formats/WebP/WebpDecoderCore.cs
  2. 18
      src/ImageSharp/Formats/WebP/WebpMetadata.cs

5
src/ImageSharp/Formats/WebP/WebpDecoderCore.cs

@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Formats.Webp
/// <summary> /// <summary>
/// Gets the dimensions of the image. /// Gets the dimensions of the image.
/// </summary> /// </summary>
public Size Dimensions => new Size((int)this.webImageInfo.Width, (int)this.webImageInfo.Height); public Size Dimensions => new((int)this.webImageInfo.Width, (int)this.webImageInfo.Height);
/// <inheritdoc /> /// <inheritdoc />
public Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken cancellationToken) public Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken cancellationToken)
@ -441,7 +441,7 @@ namespace SixLabors.ImageSharp.Formats.Webp
break; break;
case WebpChunkType.Animation: case WebpChunkType.Animation:
this.webpMetadata.Animated = true; // TODO: Decoding animation is not implemented yet.
break; break;
case WebpChunkType.Alpha: case WebpChunkType.Alpha:
@ -499,7 +499,6 @@ namespace SixLabors.ImageSharp.Formats.Webp
if (this.currentStream.Read(this.buffer, 0, 4) == 4) if (this.currentStream.Read(this.buffer, 0, 4) == 4)
{ {
var chunkType = (WebpChunkType)BinaryPrimitives.ReadUInt32BigEndian(this.buffer); var chunkType = (WebpChunkType)BinaryPrimitives.ReadUInt32BigEndian(this.buffer);
this.webpMetadata.ChunkTypes.Enqueue(chunkType);
return chunkType; return chunkType;
} }

18
src/ImageSharp/Formats/WebP/WebpMetadata.cs

@ -1,8 +1,6 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Collections.Generic;
namespace SixLabors.ImageSharp.Formats.Webp namespace SixLabors.ImageSharp.Formats.Webp
{ {
/// <summary> /// <summary>
@ -21,27 +19,13 @@ namespace SixLabors.ImageSharp.Formats.Webp
/// Initializes a new instance of the <see cref="WebpMetadata"/> class. /// Initializes a new instance of the <see cref="WebpMetadata"/> class.
/// </summary> /// </summary>
/// <param name="other">The metadata to create an instance from.</param> /// <param name="other">The metadata to create an instance from.</param>
private WebpMetadata(WebpMetadata other) private WebpMetadata(WebpMetadata other) => this.Format = other.Format;
{
this.Animated = other.Animated;
this.Format = other.Format;
}
/// <summary> /// <summary>
/// Gets or sets the webp format used. Either lossless or lossy. /// Gets or sets the webp format used. Either lossless or lossy.
/// </summary> /// </summary>
public WebpFormatType Format { get; set; } public WebpFormatType Format { get; set; }
/// <summary>
/// Gets all found chunk types ordered by appearance.
/// </summary>
public Queue<WebpChunkType> ChunkTypes { get; } = new Queue<WebpChunkType>();
/// <summary>
/// Gets or sets a value indicating whether the webp file contains an animation.
/// </summary>
public bool Animated { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
public IDeepCloneable DeepClone() => new WebpMetadata(this); public IDeepCloneable DeepClone() => new WebpMetadata(this);
} }

Loading…
Cancel
Save