Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QColor QColor::fromCmykF ( qreal  c,
qreal  m,
qreal  y,
qreal  k,
qreal  a = 1.0 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Static convenience function that returns a QColor constructed from the given CMYK color values: c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).

All the values must be in the range 0.0-1.0.

See also:
toCmyk(), fromCmyk(), isValid(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1796 of file qcolor.cpp.

References acmyk, cspec, ct, and QColor().

{
    if (c < 0.0 || c > 1.0
        || m < 0.0 || m > 1.0
        || y < 0.0 || y > 1.0
        || k < 0.0 || k > 1.0
        || a < 0.0 || a > 1.0) {
        qWarning("QColor::fromCmykF: CMYK parameters out of range");
        return QColor();
    }

    QColor color;
    color.cspec = Cmyk;
    color.ct.acmyk.alpha   = qRound(a * USHRT_MAX);
    color.ct.acmyk.cyan    = qRound(c * USHRT_MAX);
    color.ct.acmyk.magenta = qRound(m * USHRT_MAX);
    color.ct.acmyk.yellow  = qRound(y * USHRT_MAX);
    color.ct.acmyk.black   = qRound(k * USHRT_MAX);
    return color;
}


Generated by  Doxygen 1.6.0   Back to index