-
-
Notifications
You must be signed in to change notification settings - Fork 888
Add new PixelAlphaRepresentation property and implement for TPixel types #1420
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
Changes from all commits
686aef7
181d434
842cd37
f30e22f
e18ef9f
ed949f6
dae53a3
589bd68
a0a6aea
f23fd09
8a065ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright (c) Six Labors. | ||
| // Licensed under the Apache License, Version 2.0. | ||
|
|
||
| namespace SixLabors.ImageSharp.PixelFormats | ||
| { | ||
| /// <summary> | ||
| /// Provides enumeration of the alpha value transparency behavior of a pixel format. | ||
| /// </summary> | ||
| public enum PixelAlphaRepresentation | ||
| { | ||
| /// <summary> | ||
| /// Indicates that the pixel format does not contain an alpha channel. | ||
| /// </summary> | ||
| None, | ||
|
|
||
| /// <summary> | ||
| /// Indicates that the transparency behavior is premultiplied. | ||
| /// Each color is first scaled by the alpha value. The alpha value itself is the same | ||
| /// in both straight and premultiplied alpha. Typically, no color channel value is | ||
| /// greater than the alpha channel value. | ||
| /// If a color channel value in a premultiplied format is greater than the alpha | ||
| /// channel, the standard source-over blending math results in an additive blend. | ||
| /// </summary> | ||
| Associated, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless we know image formats where we can report this by How about replacing the summary with the text "Reserved for future use", and moving the docs into a comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dunno... We'd then have to have a tracking issue etc. What if someone want to implement their own pixel format type and use it to represent already premultiplied pixel data? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a pixel had premultiplied alpha would it break any of our processors methods? if it would then either we need to go though and add checks to any that it will break even if we don't do anything else with it or we need to fix them so they function with eather type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unlikely I think that it would break anything. I couldn't be 100% sure though but since no one has raised an issue suggesting that it does so far I think we're ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will only make difference when we start utilizing it in Other than this I don't really see open questions here according to my understanding of the feature, but I'm generally reluctant for defining public API-s for stuff that is not even prototyped. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be overthinking in this case, IDK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the best place to do the check is in |
||
|
|
||
| /// <summary> | ||
| /// Indicates that the transparency behavior is not premultiplied. | ||
| /// The alpha channel indicates the transparency of the color. | ||
| /// </summary> | ||
| Unassociated | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.