From ed0edfe20a62f3f3d15be52ad508d9915cf15e4b Mon Sep 17 00:00:00 2001 From: Poker Date: Mon, 7 Apr 2025 22:45:28 +0800 Subject: [PATCH] fix AniMetadata --- .../Formats/Ani/AniFrameMetadata.cs | 10 +---- src/ImageSharp/Formats/Ani/AniMetadata.cs | 41 ++++++++++++++++--- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs b/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs index 8a567c40a..928899476 100644 --- a/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs +++ b/src/ImageSharp/Formats/Ani/AniFrameMetadata.cs @@ -53,15 +53,7 @@ public class AniFrameMetadata : IFormatFrameMetadata }; /// - IDeepCloneable IDeepCloneable.DeepClone() => new AniFrameMetadata - { - FrameDelay = this.FrameDelay, - EncodingHeight = this.EncodingHeight, - EncodingWidth = this.EncodingWidth, - FrameCount = this.FrameCount - - // TODO SubImageMetadata - }; + IDeepCloneable IDeepCloneable.DeepClone() => this.DeepClone(); /// public FormatConnectingFrameMetadata ToFormatConnectingFrameMetadata() => new FormatConnectingFrameMetadata() { Duration = TimeSpan.FromSeconds(this.FrameDelay / 60d) }; diff --git a/src/ImageSharp/Formats/Ani/AniMetadata.cs b/src/ImageSharp/Formats/Ani/AniMetadata.cs index cdebcbb24..9b30bedb6 100644 --- a/src/ImageSharp/Formats/Ani/AniMetadata.cs +++ b/src/ImageSharp/Formats/Ani/AniMetadata.cs @@ -21,21 +21,33 @@ public class AniMetadata : IFormatMetadata /// /// Gets or sets the width of frames in the animation. /// + /// + /// Remains zero when has flag + /// public uint Width { get; set; } /// /// Gets or sets the height of frames in the animation. /// + /// + /// Remains zero when has flag + /// public uint Height { get; set; } /// /// Gets or sets the number of bits per pixel. /// + /// + /// Remains zero when has flag + /// public uint BitCount { get; set; } /// /// Gets or sets the number of frames in the animation. /// + /// + /// Remains zero when has flag + /// public uint Planes { get; set; } /// @@ -64,21 +76,38 @@ public class AniMetadata : IFormatMetadata public IList IconFrames { get; set; } = []; /// - public static AniMetadata FromFormatConnectingMetadata(FormatConnectingMetadata metadata) => throw new NotImplementedException(); + public static AniMetadata FromFormatConnectingMetadata(FormatConnectingMetadata metadata) + => throw new NotImplementedException(); /// public void AfterImageApply(Image destination) - where TPixel : unmanaged, IPixel => throw new NotImplementedException(); + where TPixel : unmanaged, IPixel + { + } /// - public IDeepCloneable DeepClone() => throw new NotImplementedException(); + IDeepCloneable IDeepCloneable.DeepClone() => this.DeepClone(); /// - public PixelTypeInfo GetPixelTypeInfo() => throw new NotImplementedException(); + public PixelTypeInfo GetPixelTypeInfo() + => throw new NotImplementedException(); /// - public FormatConnectingMetadata ToFormatConnectingMetadata() => throw new NotImplementedException(); + public FormatConnectingMetadata ToFormatConnectingMetadata() + => throw new NotImplementedException(); /// - AniMetadata IDeepCloneable.DeepClone() => throw new NotImplementedException(); + public AniMetadata DeepClone() => new() + { + Width = this.Width, + Height = this.Height, + BitCount = this.BitCount, + Planes = this.Planes, + DisplayRate = this.DisplayRate, + Flags = this.Flags, + Name = this.Name, + Artist = this.Artist + + // TODO IconFrames + }; }