-
-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add webp decoder option to handle the background color in ANIM chunk (#…
…2547) * Add webp decoder option BackgroundColorHandling to decide howto handle the background color in the ANIM chunk * Add test for Issue 2528 * Update src/ImageSharp/Formats/Webp/BackgroundColorHandling.cs Co-authored-by: James Jackson-South <james_south@hotmail.com> * Fix path to test file * Another attempt fixing the file path: path should be lower case * Revert fa4febf --------- Co-authored-by: James Jackson-South <james_south@hotmail.com>
- Loading branch information
1 parent
9b24cc1
commit c5eed0e
Showing
10 changed files
with
103 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
namespace SixLabors.ImageSharp.Formats.Webp; | ||
|
||
/// <summary> | ||
/// Enum to decide how to handle the background color of the Animation chunk during decoding. | ||
/// </summary> | ||
public enum BackgroundColorHandling | ||
{ | ||
/// <summary> | ||
/// The background color of the ANIM chunk will be used to initialize the canvas to fill the unused space on the canvas around the frame. | ||
/// Also, if AnimationDisposalMethod.Dispose is used, this color will be used to restore the canvas background. | ||
/// </summary> | ||
Standard = 0, | ||
|
||
/// <summary> | ||
/// The background color of the ANIM chunk is ignored and instead the canvas is initialized with transparent, BGRA(0, 0, 0, 0). | ||
/// </summary> | ||
Ignore = 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
namespace SixLabors.ImageSharp.Formats.Webp; | ||
|
||
/// <summary> | ||
/// Configuration options for decoding webp images. | ||
/// </summary> | ||
public sealed class WebpDecoderOptions : ISpecializedDecoderOptions | ||
{ | ||
/// <inheritdoc/> | ||
public DecoderOptions GeneralOptions { get; init; } = new(); | ||
|
||
/// <summary> | ||
/// Gets the flag to decide how to handle the background color Animation Chunk. | ||
/// The specification is vague on how to handle the background color of the animation chunk. | ||
/// This option let's the user choose how to deal with it. | ||
/// </summary> | ||
/// <see href="https://developers.google.com/speed/webp/docs/riff_container#animation"/> | ||
public BackgroundColorHandling BackgroundColorHandling { get; init; } = BackgroundColorHandling.Standard; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git LFS file not shown