Here's an excellent article with illustrations by a Google engineer:
http://ssp.impulsetrain.com/porterduff.html
PorterDuff is described as a way of combining images as if they were "irregular shaped pieces of cardboard" overlayed on each other, as well as a scheme for blending the overlapping parts.
The default Android way of composing images is PorterDuff.Mode.SRC_OVER, which equates to drawing the source image/color over the target image. In other words, it does what you would expect and draws the source image (the one you're drawing) on top of the destination image (the canvas) with the destination image showing through to the degree defined by the source image's alpha.
You can use the key below to understand the algebra that the Android docs use to describe the other modes (see the article for a fuller desription with similar terms).
Where alpha is a value [0..1]
, and color is substituted once per channel (so use the formula once for each of red, green and blue)
The resulting values are specified as a pair in square braces as follows.
[<alpha-value>,<color-value>]
Where alpha-value
and color-value
are formulas for generating the resulting alpha chanel and each color chanel respectively.
It defines how to compose images based on the alpha value. See more here http://en.wikipedia.org/wiki/Alpha_compositing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With