Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize Encoder Transparency Handling For Alpha Aware Image Formats #2844

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JimBobSquarePants
Copy link
Member

@JimBobSquarePants JimBobSquarePants commented Nov 27, 2024

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

This PR adds a new abstract AlphaAwareImageEncoder type which is used to normalize transparent color handling during encoding. Prior to this normalization both PNG and WEBP encoders had separate enum properties that used the same values and behavior. Now any encoder which belongs to an image format that is capable of encoding alpha data shares the same options and functionality.

In addition:

  • ImageFrame.Bounds was normalized to a readonly property to match Image
  • Cancellation token handling was completed for all encoders.
  • A bug was fixed in the ICO and CUR encoders during testing.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 66 out of 81 changed files in this pull request and generated no suggestions.

Files not reviewed (15)
  • src/ImageSharp/Formats/Png/PngTransparentColorMode.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Gif/GifEncoderCore.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Cur/CurFrameMetadata.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Gif/GifDecoderCore.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Pbm/BinaryEncoder.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Tga/TgaEncoder.cs: Evaluated as low risk
  • src/ImageSharp/Formats/EncodingUtilities.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Tga/TgaEncoderCore.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Pbm/PlainEncoder.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Pbm/PbmEncoderCore.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Png/PngEncoder.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Qoi/QoiEncoder.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Icon/IconEncoderCore.cs: Evaluated as low risk
  • src/ImageSharp/Formats/IQuantizingImageEncoder.cs: Evaluated as low risk
  • src/ImageSharp/Formats/Png/PngEncoderCore.cs: Evaluated as low risk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API breaking Signifies a binary breaking change. enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant