作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/
1.RGBA色彩空间基本知识:
RGBA stands for R ed G reen B lue A lpha.
While it is sometimes described as a color space, it is actually simply
a use of the RGB color model, with extra information. The color is RGB , and may belong to any RGB color space, but an integral alpha value as invented by Catmull and Smith between 1971 and 1972 enables alpha blending and alpha compositing . The inventors named alpha after the Greek letter in the classic linear interpolation formula αA + (1-α)B.
The alpha channel is normally used as an opacity channel. If a pixel has a value of 0% in its alpha channel, it is fullytransparent
(and, thus, invisible), whereas a value of 100% in the alpha channel
gives a fully opaque pixel (traditional digital images). Values between
0% and 100% make it possible for pixels to show through a background
like a glass (translucency), an effect not possible with simple binary
(transparent or opaque) transparency. It allows easy image compositing . Alpha channel values can be expressed as a percentage, integer, or real number between 0 and 1 like RGB parameters.
Sometimes this is referred as ARGB (like RGBA, but first datum is alpha), which is used, for example, in Macromedia
products terminology. For example, 0x80FFFF00 is 50%-transparent
yellow, because all parameters are expressed on a 0-to-255 scale. 0x80
is 128, approximately half 255 (alpha 50%); 0xFF is 255, the greatest
value a parameter can have (pure red); the second 0xFF is like the
previous, but for green; and 0x00 is 0 in decimal (no blue). Red,
green, and half transparency mixture are 50% transparent yellow.
PNG is an image format that uses RGBA.
说白了就是一个像素透明度的位。
2.实例:
作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/