Unsure about porterduff transparency handling #2967
Unanswered
ShadowsAreBlack
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi I am a small time Developer with a custom application which involves clipping and blending images
However I am experiencing strange outputs that I cannot seem to do anything about since the PorterDuffFunctions are internal.
My problems I'm experiencing seem to be caused by Pre-Multiplying the Alpha Channel when using DrawImage() with ColorBlendingMode or AlphaCompositionMode, Regardless of the PorterDuff function I use (Multiply,Darken etc) I always seem to get flat coloration on semi-transparent pixels unless I specifically specify compositing operators like DestATop/DestIn which Clips the top layer to the bottom through Multiplying, but that doesn't solve my issue of being able to clip an image while applying "Normal", "Multiply" or "Overlay" Blending modes, since Those seem to only work when with SrcOver(Default) and no other Compositing Operators
This is not tied to image format, as I tested this with WebP's and Png's and they both come back with the same problem.
Here is Image Sharps output

So using my own custom clipping method with the Alpha Channel - There is a Pre-Multiplying issue with Blending Modes causing the semi-opaque pixels to be a washed version of the over top color when using DrawImage() BlendPercentage = 1.0f and PixelColorBlendingMode.Normal;
Using Compositing Operators for Clipping - Cannot Be Used with Blending modes unless its using the SrcOver Composite Operator
Which is not a Clipping Operator
This is a quick example of the expected output I made in Photoshop

Here is the Source Image

Here is the Image I am Attempting to clip to the Source Image with the Default Blending mode

Beta Was this translation helpful? Give feedback.
All reactions