-
-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1985 from SixLabors/bp/webpanimation
Add support for decoding webp images with animations
- Loading branch information
Showing
57 changed files
with
1,292 additions
and
399 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,23 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace SixLabors.ImageSharp.Formats.Webp | ||
{ | ||
/// <summary> | ||
/// Indicates how transparent pixels of the current frame are to be blended with corresponding pixels of the previous canvas. | ||
/// </summary> | ||
internal enum AnimationBlendingMethod | ||
{ | ||
/// <summary> | ||
/// Use alpha blending. After disposing of the previous frame, render the current frame on the canvas using alpha-blending. | ||
/// If the current frame does not have an alpha channel, assume alpha value of 255, effectively replacing the rectangle. | ||
/// </summary> | ||
AlphaBlending = 0, | ||
|
||
/// <summary> | ||
/// Do not blend. After disposing of the previous frame, | ||
/// render the current frame on the canvas by overwriting the rectangle covered by the current frame. | ||
/// </summary> | ||
DoNotBlend = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace SixLabors.ImageSharp.Formats.Webp | ||
{ | ||
/// <summary> | ||
/// Indicates how the current frame is to be treated after it has been displayed (before rendering the next frame) on the canvas. | ||
/// </summary> | ||
internal enum AnimationDisposalMethod | ||
{ | ||
/// <summary> | ||
/// Do not dispose. Leave the canvas as is. | ||
/// </summary> | ||
DoNotDispose = 0, | ||
|
||
/// <summary> | ||
/// Dispose to background color. Fill the rectangle on the canvas covered by the current frame with background color specified in the ANIM chunk. | ||
/// </summary> | ||
Dispose = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace SixLabors.ImageSharp.Formats.Webp | ||
{ | ||
internal struct AnimationFrameData | ||
{ | ||
/// <summary> | ||
/// The animation chunk size. | ||
/// </summary> | ||
public uint DataSize; | ||
|
||
/// <summary> | ||
/// The X coordinate of the upper left corner of the frame is Frame X * 2. | ||
/// </summary> | ||
public uint X; | ||
|
||
/// <summary> | ||
/// The Y coordinate of the upper left corner of the frame is Frame Y * 2. | ||
/// </summary> | ||
public uint Y; | ||
|
||
/// <summary> | ||
/// The width of the frame. | ||
/// </summary> | ||
public uint Width; | ||
|
||
/// <summary> | ||
/// The height of the frame. | ||
/// </summary> | ||
public uint Height; | ||
|
||
/// <summary> | ||
/// The time to wait before displaying the next frame, in 1 millisecond units. | ||
/// Note the interpretation of frame duration of 0 (and often smaller then 10) is implementation defined. | ||
/// </summary> | ||
public uint Duration; | ||
|
||
/// <summary> | ||
/// Indicates how transparent pixels of the current frame are to be blended with corresponding pixels of the previous canvas. | ||
/// </summary> | ||
public AnimationBlendingMethod BlendingMethod; | ||
|
||
/// <summary> | ||
/// Indicates how the current frame is to be treated after it has been displayed (before rendering the next frame) on the canvas. | ||
/// </summary> | ||
public AnimationDisposalMethod DisposalMethod; | ||
} | ||
} |
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
Oops, something went wrong.