Computer Graphics
Advertisement

Alpha blending

Often, a fourth component is added to color models. The fourth component is called alpha, andcolor models that use it are referred to by names such as RGBA and HSLA. Alpha is not a color as such. It is usually used to represent transparency. A color with maximal alpha value is fully opaque; that is, itis not at all transparent. A color with alpha equal to zero is completely transparent and therefore invisible. Intermediate values give translucent, or partly transparent, colors. Transparency determineswhat happens when you draw with one color (the foreground color) on top of another color (thebackground color). If the foreground color is fully opaque, it simply replaces the background color. If the foreground color is partly transparent, then it is blended with the background color. Assuming that the alpha component ranges from 0 to 1, the color that you get can be computed as

new_color = (alpha)*(foreground_color) + (1 - alpha)*(background_color)

This computation is done separately for the red, blue, and green color components. This is called alpha blending. The value of the resulting color when color Value1 with an alpha value of Alpha is drawn over a background of color Value0 is given by:

Value = Value0(1.0 - Alpha) + Value1(Alpha)

The alpha component may be used to blend to red, green and blue components equally, as in 32-bit RGBA, or, alternatively, there may be three alpha values specified corresponding to each of the primary colors for spectral color filtering.

Alpha blending is natively supported by these operating systems/GUIs:

  • Mac OS X
  • Windows 2000, XP
  • Most Linux graphical user interfaces (GUIs)

See also[]

  • Alpha compositing


This article is a stub. You can help the Computer Graphics Wiki by expanding it.
Advertisement