Logo Search packages:      
Sourcecode: inkscape version File versions

ColorRGBA ColorRGBA::average ( const ColorRGBA  second,
const float  weight = 0.5 
) const [inline]

Average two ColorRGBAs to create another one.

second The second RGBA, with this being the first
weight How much of each should be used. Zero is all this while one is all the second. Default is half and half.
This function goes through all the points in the two objects and merges them together based on the weighting. The current objects value are multiplied by 1.0 - weight and the second object by weight. This means that they should always be balanced by the parameter.

Definition at line 116 of file color-rgba.h.

References _c, and ColorRGBA().

Referenced by Inkscape::Extension::Plugin::GimpGrad::open().

        float returnval[4];

        for (int i = 0; i < 4; i++) {
            returnval[i] = _c[i] * (1.0 - weight) + second[i] * weight; 

        return ColorRGBA(returnval[0], returnval[1], returnval[2], returnval[3]);

Generated by  Doxygen 1.6.0   Back to index