Learn R Programming

colorplane (version 0.5.0)

blend_colors: blend two color planes

Description

given two color planes, generate a new color plane by blending the colors using the supplied alpha multiplier.

Usage

blend_colors(bottom, top, alpha)

# S4 method for ColorPlane,ColorPlane,numeric blend_colors(bottom, top, alpha = 1)

# S4 method for ColorPlane,ColorPlane,missing blend_colors(bottom, top)

# S4 method for HexColorPlane,RGBColorPlane,numeric blend_colors(bottom, top, alpha)

# S4 method for HexColorPlane,ConstantColorPlane,numeric blend_colors(bottom, top, alpha = 1)

Value

a new ColorPlane instance with `top` and `bottom` alpha-blended.

Arguments

bottom

the bottom color plane

top

the top color plane

alpha

the alpha overlay value.

Details

The functions in this package blend colors based on the "over" operator where `top` if foreground and `bottom` is background.

References

https://en.wikipedia.org/wiki/Alpha_compositing

Examples

Run this code

top <- IntensityColorPlane(1:5, cols=rainbow(5))
bottom <- IntensityColorPlane(1:5, cols=rev(rainbow(5)))

top <- map_colors(top)
bottom <- map_colors(bottom)
bc <- blend_colors(bottom, top, .5)

Run the code above in your browser using DataLab