[R] color blending and transparency

baptiste auguie baptiste.auguie at googlemail.com
Wed Feb 3 19:40:52 CET 2010

Thanks for this complementary information. My head itches slightly
when reading about these virtual layers with unidirectional absorption
and reflection properties but I guess that's imputable to my personal
background as a physicist.

I still have a few questions,

- is this behavior documented? (I'm happy to look at the source, but
I'm not even sure if it's in grDevices, device specific, or somewhere
else altogether)

- have there been any attempts at implementing other options for
colour blending? It would be nice to be able to switch between
additive and substrative colour mixing rules on occasion, but as far
as I understand the scheme we discussed is hard coded deep into R's
internals (correct?). An option not to use the background at all in
the "mixing" / "reflection" process would be great already.

Thanks again,


On 3 February 2010 17:04, Thomas Lumley <tlumley at u.washington.edu> wrote:

> My mental model for this, which I haven't bothered to check against the
> actual algorithms, is that colors are composed of reflective/absorbing
> pigment particles and that alpha says how densely they are packed. Alpha=0
> means all the light gets through to bounce of what ever is below, eventually
> to the white paper, and alpha=1 means that all the light is reflected from
> the top layer of paint.
> With 50% blue over 50% red, you reflect 50% of the blue light and absorb 50%
> of the red and green light in the top layer of paint.  Of the remaining
> light, 50% of the red is reflected and 50% of the green and blue absorbed by
> the particles in the bottom layer of paint. Anything that makes it through
> will reflect off the white paper.
> There is the additional complication that a transparent  background still
> behaves as if it had white paper behind it (it's drawn on an acetate sheet
> which you lay on paper to see it more clearly).
>     -thomas
> Thomas Lumley                   Assoc. Professor, Biostatistics
> tlumley at u.washington.edu        University of Washington, Seattle

More information about the R-help mailing list