Porter/Duff in Android  

2 days ago, i have a problem to blend 2 view. If you look Android Documentation about porter/duff and I said OMG, what the hell is this, this is not helping.

pd.jpg

After searching i found a good blog explain porter duff. This blog writer is a software engineer from google.

As you can see, basic of porter duff is divide into 4 regions (Both, Source, Dest, Neither). But don’t forget we have 2 images source and destinations.

source.pngdest.png

four regions :

diagram.png

One region where only the source is present, one where only the destination is present, one where both are present, and one where neither is present.

By deciding on what happens in each of the four regions, various effects can be generated. For example, if the destination-only region is treated as blank, the source-only region is filled with the source color, and the ‘both’ region is filled with the destination color like this:

destatop-diagram.png

the result will be :

destatop.png

The Porter/Duff operator that does this is called “Dest Atop”.

There are twelve of these operators, each one characterized by its behavior in the three regions: source, destination and both. The ‘neither’ region is always blank. The source and destination regions can either be blank or filled with the source or destination colors respectively.

formula of operators :

asd.jpg

Where [s] is either 0 or the color of the source pixel, [d] either 0 or the color of the destination pixel, and [b] is either 0, the color of the source pixel, or the color of the destination pixel. With the alpha channel being interpreted as coverage, the areas are given by these formulas:

asd.jpg

Here is a table of all the Porter/Duff operators:

asd.jpg

And this is the result of all operator :

table.png

visit original souce

 
0
Kudos
 
0
Kudos

Now read this

DON’T GIVE UP

I give up, that’s something that come to my mind when i failed at something, when i don’t get what i want and don’t expect something that i don’t want. And then i feel like i’m at bottom of the sea cannot breath. And then i read this... Continue →