diff --git a/src/ImageSharp/Formats/Ani/AniDecoderCore.cs b/src/ImageSharp/Formats/Ani/AniDecoderCore.cs index 57f9d4031f..e1cdba2ec1 100644 --- a/src/ImageSharp/Formats/Ani/AniDecoderCore.cs +++ b/src/ImageSharp/Formats/Ani/AniDecoderCore.cs @@ -78,6 +78,7 @@ internal class AniDecoderCore : ImageDecoderCore { case AniFrameFormat.Ico: IcoFrameMetadata icoFrameMetadata = source.Metadata.GetIcoMetadata(); + // TODO source.Metadata.SetFormatMetadata(IcoFormat.Instance, null); clonedMetadata.IcoFrameMetadata = icoFrameMetadata; clonedMetadata.EncodingWidth = icoFrameMetadata.EncodingWidth; @@ -85,6 +86,7 @@ internal class AniDecoderCore : ImageDecoderCore break; case AniFrameFormat.Cur: CurFrameMetadata curFrameMetadata = source.Metadata.GetCurMetadata(); + // TODO source.Metadata.SetFormatMetadata(CurFormat.Instance, null); clonedMetadata.CurFrameMetadata = curFrameMetadata; clonedMetadata.EncodingWidth = curFrameMetadata.EncodingWidth; @@ -198,6 +200,7 @@ internal class AniDecoderCore : ImageDecoderCore { case AniFrameFormat.Ico: IcoFrameMetadata icoFrameMetadata = frameMetadata.GetIcoMetadata(); + // TODO source.Metadata.SetFormatMetadata(IcoFormat.Instance, null); clonedMetadata.IcoFrameMetadata = icoFrameMetadata; clonedMetadata.EncodingWidth = icoFrameMetadata.EncodingWidth; @@ -205,6 +208,7 @@ internal class AniDecoderCore : ImageDecoderCore break; case AniFrameFormat.Cur: CurFrameMetadata curFrameMetadata = frameMetadata.GetCurMetadata(); + // TODO source.Metadata.SetFormatMetadata(CurFormat.Instance, null); clonedMetadata.CurFrameMetadata = curFrameMetadata; clonedMetadata.EncodingWidth = curFrameMetadata.EncodingWidth; @@ -218,8 +222,9 @@ internal class AniDecoderCore : ImageDecoderCore return frameMetadata; })); } - else // BMP + else { + // BMP aniFrameMetadata.EncodingWidth = Narrow(info.Width); aniFrameMetadata.EncodingHeight = Narrow(info.Height); aniFrameMetadata.FrameFormat = type; @@ -253,6 +258,7 @@ internal class AniDecoderCore : ImageDecoderCore switch (dir.Type) { + // TODO: Use Core decoders. case IconFileType.CUR: info = CurDecoder.Instance.Identify(this.Options, this.currentStream); type = AniFrameFormat.Cur; @@ -266,6 +272,7 @@ internal class AniDecoderCore : ImageDecoderCore } else { + // TODO: Use Core decoders. info = BmpDecoder.Instance.Identify(this.Options, this.currentStream); type = AniFrameFormat.Bmp; } diff --git a/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs b/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs index f024c1c8ad..5af0b6fc7c 100644 --- a/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs +++ b/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System.Diagnostics.CodeAnalysis; +using System.Numerics; using SixLabors.ImageSharp.Formats.Cur; using SixLabors.ImageSharp.Formats.Ico; using SixLabors.ImageSharp.PixelFormats; @@ -68,12 +68,17 @@ public class AniFrameMetadata : IFormatFrameMetadata IDeepCloneable IDeepCloneable.DeepClone() => this.DeepClone(); /// - public FormatConnectingFrameMetadata ToFormatConnectingFrameMetadata() => new FormatConnectingFrameMetadata() { Duration = TimeSpan.FromSeconds(this.FrameDelay / 60d) }; + public FormatConnectingFrameMetadata ToFormatConnectingFrameMetadata() + { + // TODO: Implement. You need to consider encoding width/height. + return new() { Duration = TimeSpan.FromSeconds(this.FrameDelay / 60d) }; + } /// - public void AfterFrameApply(ImageFrame source, ImageFrame destination) + public void AfterFrameApply(ImageFrame source, ImageFrame destination, Matrix4x4 matrix) where TPixel : unmanaged, IPixel { + // TODO: Implement. You need to consider encoding width/height. } /// @@ -83,7 +88,7 @@ public class AniFrameMetadata : IFormatFrameMetadata EncodingHeight = this.EncodingHeight, EncodingWidth = this.EncodingWidth, SequenceNumber = this.SequenceNumber, - IsIco = this.IsIco, + FrameFormat = this.FrameFormat, IcoFrameMetadata = this.IcoFrameMetadata?.DeepClone(), CurFrameMetadata = this.CurFrameMetadata?.DeepClone(), diff --git a/src/ImageSharp/Formats/Ani/AniMetadata.cs b/src/ImageSharp/Formats/Ani/AniMetadata.cs index 1660b8a765..9b09cfa7a7 100644 --- a/src/ImageSharp/Formats/Ani/AniMetadata.cs +++ b/src/ImageSharp/Formats/Ani/AniMetadata.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using SixLabors.ImageSharp.Metadata; +using System.Numerics; using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Formats.Ani; @@ -75,8 +75,8 @@ public class AniMetadata : IFormatMetadata => throw new NotImplementedException(); /// - public void AfterImageApply(Image destination) - where TPixel : unmanaged, IPixel + public void AfterImageApply(Image destination, Matrix4x4 matrix) + where TPixel : unmanaged, IPixel { } diff --git a/src/ImageSharp/Formats/Webp/WebpConstants.cs b/src/ImageSharp/Formats/Webp/WebpConstants.cs index b42e5313e2..7bee3c8c50 100644 --- a/src/ImageSharp/Formats/Webp/WebpConstants.cs +++ b/src/ImageSharp/Formats/Webp/WebpConstants.cs @@ -60,11 +60,6 @@ internal static class WebpConstants 0x50 // P ]; - /// - /// The header bytes identifying a Webp. - /// - public const string WebpFourCc = "WEBP"; - /// /// 3 bits reserved for version. /// @@ -324,4 +319,9 @@ internal static class WebpConstants -7, 8, -8, -9 ]; + + /// + /// Gets the header bytes identifying a Webp. + /// + public static ReadOnlySpan WebpFormTypeFourCc => "WEBP"u8; }