-
-
Notifications
You must be signed in to change notification settings - Fork 889
Closed
Description
Motivation
By introducing a property to observe whether a given pixel type has an alpha, we can then use it in our processors to omit unnecessary alpha premultiplication. Might be also interesting for users working with Image.Identify.
We need to make sure it's value is properly filled:
- In decoders with
Identifyimplementations (PNG, BMP) - For all built-in pixel formats (
IPixel-s)
API alternatives
In #1394 (reply in thread) I forgot that extending IPixel is actually a breaking change. Non-breaking variant:
internal enum PixelAlphaRepresentation
{
None,
Associated,
Unassociated
}
public class PixelTypeInfo
{
// 'null' means unknown/not implemented
public PixelAlphaRepresentation? AlphaRepresentation { get; }
}
public PixelOperations<TPixel>
{
// Return AlphaRepresentation == null by default, but for important pixel types, introduce proper overrides with T4:
public virtual PixelTypeInfo GetPixelTypeInfo();
}JimBobSquarePants