dilevin / computer-graphics-raster-images

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

Porterduff over operator #44

Closed RaihanFaruque closed 4 years ago

RaihanFaruque commented 4 years ago

When I used this formula in wikipedia page wikipedia_formula

I set the resulting alpha to 255;

This is the result I got: porterduff_wikipedia

When I use this formula: android_formula I get this result: Porterduff_android

Not sure what is causing the problem

dilevin commented 4 years ago

The major issue is not the formula you are using.

Hint 1: what is the alpha for an opaque pixel ? Hint 2: its not 255.

NPTP commented 4 years ago

May not be related to your problem, but with the first formula example, I initially got a similar looking image just by forgetting to make sure I was using floats/doubles when normalizing my alpha values, so that they all just turned into zeros (alpha_a and alpha_b).

RaihanFaruque commented 4 years ago

Thank you. It works after I divided by 255.0