dilevin / computer-graphics-raster-images

Computer Graphics Assignment about Raster Images
1 stars 7 forks source link

How to handle alpha in Porter Duff? #12

Closed andriyDev closed 4 years ago

andriyDev commented 4 years ago

In Porter Duff, we get the following equation: C = A_src [s] + A_dst [d] + A_both * [b] This works for colours, but how should alpha be handled in this situation? When I apply this equation to the alpha for the Over operator, my final product becomes much darker because the alpha is less than 1. If I force my implementation to always output 255 for alpha, everything works nicely.

Is this something wrong with my implementation? Am I misunderstanding something? Is there another equation I should be using specifically for alpha?

dilevin commented 4 years ago

It’s fine to set the alpha to 255 for this example