Package lepl :: Package cairo :: Module colour :: Class Colour
[hide private]
[frames] | no frames]

Class Colour

source code

Instance Methods [hide private]
 
__new__(cls, r, g, b, a=1.0) source code
 
rgb(self)
Convert to an RGB triplet (alpha is not removed).
source code
 
__mul__(self, factor)
Scale the colour by some factor.
source code
 
opaque(self)
The same colour, but with alpha forced to 1.
source code
 
__add__(self, colour)
Overlay colours following normal composition (right on top).
source code
Static Methods [hide private]
 
from_rgb(rgb) source code
Class Variables [hide private]
  r = property(itemgetter(0), _replace(0))
  g = property(itemgetter(1), _replace(1))
  b = property(itemgetter(2), _replace(2))
  a = property(itemgetter(3), _replace(3))
Method Details [hide private]

__mul__(self, factor)

source code 

Scale the colour by some factor.

If factor is a single value, it is applied only to the RGB components; if it is a pair then the second value is applied to alpha (and folded in to RGB too). So 0.5 would reduce RGB by half; (1, 0.5) would reduce alpha by half (and scale RGB correspondingly); (0.5, 0.5) would scale RGB and reduce alpha (so pre-multiplied RGB would be numerically scaled by 0.25).

After scaling, values are clipped within (0, 1).