QColor Class Reference

#include <qcolor.h>

List of all members.


Detailed Description

The QColor class provides colors based on RGB, HSV or CMYK values.

A color is normally specified in terms of RGB (red, green, and blue) components, but it is also possible to specify it in terms of HSV (hue, saturation, and value) and CMYK (cyan, magenta, yellow and black) components. In addition a color can be specified using a color name. The color name can be any of the SVG 1.0 color names.

qcolor-rgb.png qcolor-hsv.png qcolor-cmyk.png RGB HSV CMYK

The QColor constructor creates the color based on RGB values. To create a QColor based on either HSV or CMYK values, use the toHsv() and toCmyk() functions respectively. These functions return a copy of the color using the desired format. In addition the static fromRgb(), fromHsv() and fromCmyk() functions create colors from the specified values. Alternatively, a color can be converted to any of the three formats using the convertTo() function (returning a copy of the color in the desired format), or any of the setRgb(), setHsv() and setCmyk() functions altering this color's format. The spec() function tells how the color was specified.

A color can be set by passing an RGB string (such as "#112233"), or a color name (such as "blue"), to the setNamedColor() function. The color names are taken from the SVG 1.0 color names. The name() function returns the name of the color in the format AARRGGBB. Colors can also be set using setRgb(), setHsv() and setCmyk(). To get a lighter or darker color use the light() and dark() functions respectively.

The isValid() function indicates whether a QColor is legal at all. For example, a RGB color with RGB values out of range is illegal. For performance reasons, QColor mostly disregards illegal colors, and for that reason, the result of using an invalid color is undefined.

The color components can be retrieved individually, e.g with red(), hue() and cyan(). The values of the color components can also be retrieved in one go using the getRgb(), getHsv() and getCmyk() functions. Using the RGB color model, the color components can in addition be accessed with rgb().

There are several related non-members: QRgb is a typdef for an unsigned int representing the RGB value triplet (r, g, b). Note that it also can hold a value for the alpha-channel (for more information, see the {QColor::Alpha-Blended Drawing}{Alpha-Blended Drawing} section). The qRed(), qBlue() and qGreen() functions return the respective component of the given QRgb value, while the qRgb() and qRgba() functions create and return the QRgb triplet based on the given component values. Finally, the qAlpha() function returns the alpha component of the provided QRgb, and the qGray() function calculates and return a gray value based on the given value.

QColor is platform and device independent. The QColormap class maps the color to the hardware.

For more information about painting in general, see {The Paint System} documentation.

QColor supports floating point precision and provides floating point versions of all the color components functions, e.g. getRgbF(), hueF() and fromCmykF(). Note that since the components is stored using 16-bit integers, there might be minor deviations between the values set using, for example, setRgbF() and the values returned by the getRgbF() function due to rounding. While the integer based functions take values in the range 0-255 (except hue() which must can be specified within the range 0-359), the floating point functions accept values in the range 0.0 - 1.0. @section Alpha-Blended Drawing QColor also support alpha-blended outlining and filling. The alpha channel of a color specifies the transparency effect, 0 represents a fully transparent color, while 255 represents a fully opaque color. For example: @code // Specfiy semi-transparent red painter.setBrush(QColor(255, 0, 0, 127)); painter.drawRect(0, 0, width()/2, height()); // Specify semi-transparend blue painter.setBrush(QColor(0, 0, 255, 127)); painter.drawRect(0, 0, width(), height()/2); \endcode The code above produces the following output: \img alphafill.png Alpha-blended drawing is supported on Windows, Mac OS X, and on X11 systems that have the X Render extension installed. The alpha channel of a color can be retrieved and set using the alpha() and setAlpha() functions if its value is an integer, and alphaF() and setAlphaF() if its value is qreal (double). By default, the alpha-channel is set to 255 (opaque). To retrieve and set \e all the RGB color components (including the alpha-channel) in one go, use the rgba() and setRgba() functions. @section Predefined Colors There are 20 predefined QColors: Qt::white, Qt::black, Qt::red, Qt::darkRed, Qt::green, Qt::darkGreen, Qt::blue, Qt::darkBlue, Qt::cyan, Qt::darkCyan, Qt::magenta, Qt::darkMagenta, Qt::yellow, Qt::darkYellow, Qt::gray, Qt::darkGray, Qt::lightGray, Qt::color0, Qt::color1, and Qt::transparent. \img qt-colors.png Qt Colors QColor provides the static colorNames() function which returns a QStringList containing the color names Qt knows about. The colors Qt::color0 (zero pixel value) and Qt::color1 (non-zero pixel value) are special colors for drawing in QBitmaps. Painting with Qt::color0 sets the bitmap bits to 0 (transparent, i.e. background), and painting with Qt::color1 sets the bits to 1 (opaque, i.e. foreground). @section The HSV Color Model The RGB model is hardware-oriented. Its representation is close to what most monitors show. In contrast, HSV represents color in a way more suited to the human perception of color. For example, the relationships "stronger than", "darker than", and "the opposite of" are easily expressed in HSV but are much harder to express in RGB. HSV, like RGB, has three components: \list \o H, for hue, is in the range 0 to 359 if the color is chromatic (not gray), or meaningless if it is gray. It represents degrees on the color wheel familiar to most people. Red is 0 (degrees), green is 120, and blue is 240. \inlineimage qcolor-hue.png \o S, for saturation, is in the range 0 to 255, and the bigger it is, the stronger the color is. Grayish colors have saturation near 0; very strong colors have saturation near 255. \inlineimage qcolor-saturation.png \o V, for value, is in the range 0 to 255 and represents lightness or brightness of the color. 0 is black; 255 is as far from black as possible. \inlineimage qcolor-value.png \endlist Here are some examples: pure red is H=0, S=255, V=255; a dark red, moving slightly towards the magenta, could be H=350 (equivalent to -10), S=255, V=180; a grayish light red could have H about 0 (say 350-359 or 0-10), S about 50-100, and S=255. Qt returns a hue value of -1 for achromatic colors. If you pass a hue value that is too large, Qt forces it into range. Hue 360 or 720 is treated as 0; hue 540 is treated as 180. In addition to the standard HSV model, Qt provides an alpha-channel to feature \l {QColor#Alpha-Blended Drawing}{alpha-blended drawing}. @section The CMYK Color Model While the RGB and HSV color models are used for display on computer monitors, the CMYK model is used in the four-color printing process of printing presses and some hard-copy devices. CMYK has four components, all in the range 0-255: cyan (C), magenta (M), yellow (Y) and black (K). Cyan, magenta and yellow are called subtractive colors; the CMYK color model creates color by starting with a white surface and then subtracting color by applying the appropriate components. While combining cyan, magenta and yellow gives the colorDefinition at line 47 of file qcolor.h.

Public Types

enum  Spec

Public Member Functions

 QColor ()
 QColor (Qt::GlobalColor color)
 QColor (int r, int g, int b, int a=255)
 QColor (QRgb rgb)
 QColor (const QString &name)
 QColor (const char *name)
 QColor (const QColor &color)
 QColor (Spec spec)
bool isValid () const
QString name () const
void setNamedColor (const QString &name)
Spec spec () const
int alpha () const
void setAlpha (int alpha)
qreal alphaF () const
void setAlphaF (qreal alpha)
int red () const
int green () const
int blue () const
void setRed (int red)
void setGreen (int green)
void setBlue (int blue)
qreal redF () const
qreal greenF () const
qreal blueF () const
void setRedF (qreal red)
void setGreenF (qreal green)
void setBlueF (qreal blue)
void getRgb (int *r, int *g, int *b, int *a=0) const
void setRgb (int r, int g, int b, int a=255)
void getRgbF (qreal *r, qreal *g, qreal *b, qreal *a=0) const
void setRgbF (qreal r, qreal g, qreal b, qreal a=1.0)
QRgb rgba () const
void setRgba (QRgb rgba)
QRgb rgb () const
void setRgb (QRgb rgb)
int hue () const
int saturation () const
int value () const
qreal hueF () const
qreal saturationF () const
qreal valueF () const
void getHsv (int *h, int *s, int *v, int *a=0) const
void setHsv (int h, int s, int v, int a=255)
void getHsvF (qreal *h, qreal *s, qreal *v, qreal *a=0) const
void setHsvF (qreal h, qreal s, qreal v, qreal a=1.0)
int cyan () const
int magenta () const
int yellow () const
int black () const
qreal cyanF () const
qreal magentaF () const
qreal yellowF () const
qreal blackF () const
void getCmyk (int *c, int *m, int *y, int *k, int *a=0)
void setCmyk (int c, int m, int y, int k, int a=255)
void getCmykF (qreal *c, qreal *m, qreal *y, qreal *k, qreal *a=0)
void setCmykF (qreal c, qreal m, qreal y, qreal k, qreal a=1.0)
QColor toRgb () const
QColor toHsv () const
QColor toCmyk () const
QColor convertTo (Spec colorSpec) const
QColor light (int f=150) const
QColor dark (int f=200) const
QColoroperator= (const QColor &)
QColoroperator= (Qt::GlobalColor color)
bool operator== (const QColor &c) const
bool operator!= (const QColor &c) const
 operator QVariant () const

Static Public Member Functions

static QStringList colorNames ()
static QColor fromRgb (QRgb rgb)
static QColor fromRgba (QRgb rgba)
static QColor fromRgb (int r, int g, int b, int a=255)
static QColor fromRgbF (qreal r, qreal g, qreal b, qreal a=1.0)
static QColor fromHsv (int h, int s, int v, int a=255)
static QColor fromHsvF (qreal h, qreal s, qreal v, qreal a=1.0)
static QColor fromCmyk (int c, int m, int y, int k, int a=255)
static QColor fromCmykF (qreal c, qreal m, qreal y, qreal k, qreal a=1.0)

Private Member Functions

 QColor (int, int, int, Spec)
void invalidate ()

Private Attributes

Spec cspec
union {
   struct {
      ushort   alpha
      ushort   red
      ushort   green
      ushort   blue
      ushort   pad
   }   argb
   struct {
      ushort   alpha
      ushort   hue
      ushort   saturation
      ushort   value
      ushort   pad
   }   ahsv
   struct {
      ushort   alpha
      ushort   cyan
      ushort   magenta
      ushort   yellow
      ushort   black
   }   acmyk
ct

Friends

class QColormap
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QColor &)
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QColor &)

Related Functions

(Note that these are not member functions.)

int qRed (QRgb rgb)
int qGreen (QRgb rgb)
int qBlue (QRgb rgb)
int qAlpha (QRgb rgba)
QRgb qRgb (int r, int g, int b)
QRgb qRgba (int r, int g, int b, int a)
int qGray (int r, int g, int b)
int qGray (QRgb rgb)
 QRgb


Member Enumeration Documentation

enum QColor::Spec

The type of color specified, either RGB, HSV or CMYK.

Rgb Hsv Cmyk Invalid

See also:
spec(), convertTo()

Definition at line 50 of file qcolor.h.

00050 { Invalid, Rgb, Hsv, Cmyk };


Constructor & Destructor Documentation

QColor::QColor (  )  [inline]

Constructs an invalid color with the RGB value (0, 0, 0). An invalid color is a color that is not properly set up for the underlying window system.

The alpha value of an invalid color is unspecified.

See also:
isValid()

Definition at line 219 of file qcolor.h.

References invalidate().

Referenced by convertTo(), fromCmyk(), fromCmykF(), fromHsv(), fromHsvF(), fromRgb(), fromRgbF(), and operator=().

00220 { invalidate(); }

Here is the call graph for this function:

QColor::QColor ( Qt::GlobalColor  color  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Constructs a new color with a color value of color.

See also:
isValid(), {QColor::Predefined Colors}{Predefined Colors}

Definition at line 310 of file qcolor.cpp.

References qAlpha(), qBlue(), qGreen(), qRed(), QRgb(), QRGB, QRGBA, and setRgb().

00311 {
00312 #define QRGB(r, g, b) \
00313     QRgb(((0xff << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)))
00314 #define QRGBA(r, g, b, a) \
00315     QRgb(((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff))
00316 
00317     static const QRgb global_colors[] = {
00318         QRGB(255, 255, 255), // Qt::color0
00319         QRGB(  0,   0,   0), // Qt::color1
00320         QRGB(  0,   0,   0), // black
00321         QRGB(255, 255, 255), // white
00322         /*
00323          * From the "The Palette Manager: How and Why" by Ron Gery,
00324          * March 23, 1992, archived on MSDN:
00325          *
00326          *     The Windows system palette is broken up into two
00327          *     sections, one with fixed colors and one with colors
00328          *     that can be changed by applications. The system palette
00329          *     predefines 20 entries; these colors are known as the
00330          *     static or reserved colors and consist of the 16 colors
00331          *     found in the Windows version 3.0 VGA driver and 4
00332          *     additional colors chosen for their visual appeal.  The
00333          *     DEFAULT_PALETTE stock object is, as the name implies,
00334          *     the default palette selected into a device context (DC)
00335          *     and consists of these static colors. Applications can
00336          *     set the remaining 236 colors using the Palette Manager.
00337          *
00338          * The 20 reserved entries have indices in [0,9] and
00339          * [246,255]. We reuse 17 of them.
00340          */
00341         QRGB(128, 128, 128), // index 248   medium gray
00342         QRGB(160, 160, 164), // index 247   light gray
00343         QRGB(192, 192, 192), // index 7     light gray
00344         QRGB(255,   0,   0), // index 249   red
00345         QRGB(  0, 255,   0), // index 250   green
00346         QRGB(  0,   0, 255), // index 252   blue
00347         QRGB(  0, 255, 255), // index 254   cyan
00348         QRGB(255,   0, 255), // index 253   magenta
00349         QRGB(255, 255,   0), // index 251   yellow
00350         QRGB(128,   0,   0), // index 1     dark red
00351         QRGB(  0, 128,   0), // index 2     dark green
00352         QRGB(  0,   0, 128), // index 4     dark blue
00353         QRGB(  0, 128, 128), // index 6     dark cyan
00354         QRGB(128,   0, 128), // index 5     dark magenta
00355         QRGB(128, 128,   0), // index 3     dark yellow
00356         QRGBA(0, 0, 0, 0)    //             transparent
00357     };
00358 #undef QRGB
00359 #undef QRGBA
00360 
00361     setRgb(qRed(global_colors[color]),
00362            qGreen(global_colors[color]),
00363            qBlue(global_colors[color]),
00364            qAlpha(global_colors[color]));
00365 }

Here is the call graph for this function:

QColor::QColor ( int  r,
int  g,
int  b,
int  a = 255 
) [inline]

Constructs a color with the RGB value r, g, b, and the alpha-channel (transparency) value of a.

The color is left invalid if any of the arguments are invalid.

See also:
setRgba(), isValid()

Definition at line 222 of file qcolor.h.

References setRgb().

00223 { setRgb(r, g, b, a); }

Here is the call graph for this function:

QColor::QColor ( QRgb  color  ) 

Constructs a color with the value color. The alpha component is ignored and set to solid.

See also:
fromRgb(), isValid()

Definition at line 385 of file qcolor.cpp.

References cspec, ct, qBlue(), qGreen(), qRed(), and Rgb.

00386 {
00387     cspec = Rgb;
00388     ct.argb.alpha = 0xffff;
00389     ct.argb.red   = qRed(color)   * 0x101;
00390     ct.argb.green = qGreen(color) * 0x101;
00391     ct.argb.blue  = qBlue(color)  * 0x101;
00392     ct.argb.pad   = 0;
00393 }

Here is the call graph for this function:

QColor::QColor ( const QString name  )  [inline]

Constructs a named color in the same way as setNamedColor() using the given name.

The color is left invalid if the name cannot be parsed.

See also:
setNamedColor(), name(), isValid()

Definition at line 228 of file qcolor.h.

References setNamedColor().

00229 { setNamedColor(aname); }

Here is the call graph for this function:

QColor::QColor ( const char *  name  )  [inline]

Constructs a named color in the same way as setNamedColor() using the given name.

The color is left invalid if the name cannot be parsed.

See also:
setNamedColor(), name(), isValid()

Definition at line 225 of file qcolor.h.

References setNamedColor().

00226 { setNamedColor(QLatin1String(aname)); }

Here is the call graph for this function:

QColor::QColor ( const QColor color  )  [inline]

Constructs a color that is a copy of color.

See also:
isValid()

Definition at line 231 of file qcolor.h.

References argb, and ct.

00232     : cspec(acolor.cspec)
00233 { ct.argb = acolor.ct.argb; }

QColor::QColor ( Spec  spec  ) 

Definition at line 405 of file qcolor.cpp.

References Cmyk, Hsv, Invalid, invalidate(), Rgb, setCmyk(), setHsv(), and setRgb().

00406 {
00407     switch (spec) {
00408     case Invalid:
00409         invalidate();
00410         break;
00411     case Rgb:
00412         setRgb(0, 0, 0);
00413         break;
00414     case Hsv:
00415         setHsv(0, 0, 0);
00416         break;
00417     case Cmyk:
00418         setCmyk(0, 0, 0, 0);
00419         break;
00420     }
00421 }

Here is the call graph for this function:

QColor::QColor ( int  x,
int  y,
int  z,
Spec  colorSpec 
) [private]

Use one of the other QColor constructors, or one of the static convenience functions, instead.


Member Function Documentation

bool QColor::isValid (  )  const [inline]

Returns true if the color is valid; otherwise returns false.

Definition at line 235 of file qcolor.h.

References cspec, and Invalid.

Referenced by MainWindow::brushColor(), qdesigner_internal::RichTextEditorToolBar::colorInputActivated(), Q3TextHorizontalLine::draw(), QCommonStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), Q3TextParagraph::drawString(), drawTextItemDecoration(), QColorWell::dropEvent(), QColorShowLabel::dropEvent(), QTabBarPrivate::getStyleOption(), QGLOverlayWidget::initializeGL(), Q3TextFormat::makeTextFormat(), qdesigner_internal::QtGradientStopsWidgetPrivate::newStop(), Q3TextEdit::optimSetTextFormat(), QCss::Parser::parseHexColor(), MainWindow::penColor(), qt_set_x11_resources(), resolveColor(), SpreadSheet::selectColor(), qdesigner_internal::QtColorLinePrivate::setColor(), Dialog::setColor(), Q3TextParagraph::setColorForSelection(), QPainter::setPen(), Q3TextDocument::setRichTextInternal(), QStyleSheetStyle::styleHint(), TextEdit::textColor(), toCmyk(), toHsv(), toRgb(), SpreadSheet::updateColor(), and Q3TextFormatCollection::updateDefaultFormat().

00236 { return cspec != Invalid; }

QString QColor::name (  )  const

Returns the name of the color in the format "#RRGGBB"; i.e. a "#" character followed by three two-digit hexadecimal numbers.

See also:
setNamedColor()

Definition at line 466 of file qcolor.cpp.

References blue(), green(), red(), and s.

Referenced by QTextHtmlExporter::emitBlockAttributes(), QTextHtmlExporter::emitTable(), MainWindow::fileSave(), Q3TextFormat::makeFormatChangeTags(), Dialog::setColor(), setNamedColor(), and QTextHtmlExporter::toHtml().

00467 {
00468     QString s;
00469     s.sprintf("#%02x%02x%02x", red(), green(), blue());
00470     return s;
00471 }

Here is the call graph for this function:

void QColor::setNamedColor ( const QString name  ) 

Sets the RGB value of this QColor to name, which may be in one of these formats:

RGB (each of R, G, and B is a single hex digit) RRGGBB RRRGGGBBB RRRRGGGGBBBB A name from the list of colors defined in the list of {SVG color keyword names} provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro". These color names work on all platforms. transparent - representing the absence of a color.

The color is invalid if name cannot be parsed.

See also:
QColor(), name(), isValid()

Definition at line 493 of file qcolor.cpp.

References invalidate(), QString::isEmpty(), n, name(), QRgb(), qt_get_hex_rgb(), qt_get_named_rgb(), qWarning(), rgb(), setRgb(), and QString::toLatin1().

Referenced by QCss::Parser::parseHexColor(), and QColor().

00494 {
00495     if (name.isEmpty()) {
00496         invalidate();
00497         return;
00498     }
00499 
00500     QByteArray n = name.toLatin1();
00501     if (n.startsWith('#')) {
00502         QRgb rgb;
00503         if (qt_get_hex_rgb(n, &rgb)) {
00504             setRgb(rgb);
00505         } else {
00506             qWarning("QColor::setNamedColor: Could not parse color '%s'", n.constData());
00507             invalidate();
00508         }
00509         return;
00510     }
00511 
00512     QRgb rgb;
00513     if (qt_get_named_rgb(n, &rgb)) {
00514         setRgb(rgb);
00515     } else {
00516         qWarning("QColor::setNamedColor: Unknown color name '%s'", n.constData());
00517         invalidate();
00518     }
00519 }

Here is the call graph for this function:

QStringList QColor::colorNames (  )  [static]

Returns a QStringList containing the color names Qt knows about.

See also:
{QColor::Predefined Colors}{Predefined Colors}

Definition at line 526 of file qcolor.cpp.

References qt_get_colornames().

Referenced by Window::populateWithColors(), and qdesigner_internal::RichTextEditorToolBar::RichTextEditorToolBar().

00527 {
00528     return qt_get_colornames();
00529 }

Here is the call graph for this function:

Spec QColor::spec (  )  const [inline]

Returns how the color was specified.

See also:
Spec, convertTo()

Definition at line 68 of file qcolor.h.

Referenced by qdesigner_internal::QtColorLinePrivate::checkColor().

00069     { return cspec; }

int QColor::alpha (  )  const

Referenced by setBlue(), setGreen(), and setRed().

void QColor::setAlpha ( int  alpha  ) 

Sets the alpha of this color to alpha. Integer alpha is specified in the range 0-255.

See also:
alpha(), alphaF(), {QColor::Alpha-Blended Drawing}{Alpha-Blended Drawing}

Definition at line 848 of file qcolor.cpp.

References ct, and QCOLOR_INT_RANGE_CHECK.

Referenced by PanelShape::animate(), constructColor(), QCleanlooksStyle::drawComplexControl(), QCleanlooksStyle::drawPrimitive(), ColorDock::paintEvent(), and qdesigner_internal::QtGradientStopsWidget::paintEvent().

00849 {
00850     QCOLOR_INT_RANGE_CHECK("QColor::setAlpha", alpha);
00851     ct.argb.alpha = alpha * 0x101;
00852 }

qreal QColor::alphaF (  )  const

Returns the alpha color component of this color.

See also:
setAlphaF(), alpha(), {QColor::Alpha-Blended Drawing}{Alpha-Blended Drawing}

Definition at line 860 of file qcolor.cpp.

References ct.

Referenced by QPdfEnginePrivate::addBrushPattern(), qdesigner_internal::QtColorLinePrivate::checkColor(), qdesigner_internal::QtGradientStopsModel::color(), qdesigner_internal::QtColorLinePrivate::colorFromPoint(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), qBrushSetAlphaF(), setBlueF(), setGreenF(), setRedF(), and qdesigner_internal::QtGradientStopsEditorPrivate::slotChangeAlpha().

00861 { return ct.argb.alpha / qreal(USHRT_MAX); }

void QColor::setAlphaF ( qreal  alpha  ) 

Sets the alpha of this color to alpha. qreal alpha is specified in the range 0.0-1.0.

See also:
alphaF(), alpha(), {QColor::Alpha-Blended Drawing}{Alpha-Blended Drawing}

Definition at line 871 of file qcolor.cpp.

References ct, QCOLOR_REAL_RANGE_CHECK, and qRound().

Referenced by QWidgetPrivate::drawWidget(), QCommonStyle::generatedIconPixmap(), qBrushSetAlphaF(), and QItemDelegate::selected().

00872 {
00873     QCOLOR_REAL_RANGE_CHECK("QColor::setAlphaF", alpha);
00874     qreal tmp = alpha * USHRT_MAX;
00875     ct.argb.alpha = qRound(tmp);
00876 }

Here is the call graph for this function:

int QColor::red (  )  const

Referenced by name(), setBlue(), and setGreen().

int QColor::green (  )  const

Referenced by name(), setBlue(), and setRed().

int QColor::blue (  )  const

Referenced by name(), setGreen(), and setRed().

void QColor::setRed ( int  red  ) 

Sets the red color component of this color to red. Int components are specified in the range 0-255.

See also:
red(), redF(), setRgb()

Definition at line 897 of file qcolor.cpp.

References alpha(), blue(), cspec, ct, green(), QCOLOR_INT_RANGE_CHECK, Rgb, and setRgb().

Referenced by mergedColors().

00898 {
00899     QCOLOR_INT_RANGE_CHECK("QColor::setRed", red);
00900     if (cspec != Rgb)
00901         setRgb(red, green(), blue(), alpha());
00902     else
00903         ct.argb.red = red * 0x101;
00904 }

Here is the call graph for this function:

void QColor::setGreen ( int  green  ) 

Sets the green color component of this color to green. Int components are specified in the range 0-255.

See also:
green(), greenF(), setRgb()

Definition at line 924 of file qcolor.cpp.

References alpha(), blue(), cspec, ct, QCOLOR_INT_RANGE_CHECK, red(), Rgb, and setRgb().

Referenced by mergedColors().

00925 {
00926     QCOLOR_INT_RANGE_CHECK("QColor::setGreen", green);
00927     if (cspec != Rgb)
00928         setRgb(red(), green, blue(), alpha());
00929     else
00930         ct.argb.green = green * 0x101;
00931 }

Here is the call graph for this function:

void QColor::setBlue ( int  blue  ) 

Sets the blue color component of this color to blue. Int components are specified in the range 0-255.

See also:
blue(), blueF(), setRgb()

Definition at line 953 of file qcolor.cpp.

References alpha(), cspec, ct, green(), QCOLOR_INT_RANGE_CHECK, red(), Rgb, and setRgb().

Referenced by mergedColors().

00954 {
00955     QCOLOR_INT_RANGE_CHECK("QColor::setBlue", blue);
00956     if (cspec != Rgb)
00957         setRgb(red(), green(), blue, alpha());
00958     else
00959         ct.argb.blue = blue * 0x101;
00960 }

Here is the call graph for this function:

qreal QColor::redF (  )  const

Returns the red color component of this color.

See also:
setRedF(), red(), getRgbF()

Definition at line 967 of file qcolor.cpp.

References cspec, ct, Invalid, redF(), Rgb, and toRgb().

Referenced by PanelShape::animate(), qdesigner_internal::QtGradientStopsModel::color(), qdesigner_internal::QtColorLinePrivate::colorFromPoint(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), redF(), setBlueF(), QPdfEngine::setBrush(), QPSPrintEngine::setBrush(), setGreenF(), and qdesigner_internal::QtGradientStopsEditorPrivate::slotChangeHue().

00968 {
00969     if (cspec != Invalid && cspec != Rgb)
00970         return toRgb().redF();
00971     return ct.argb.red / qreal(USHRT_MAX);
00972 }

Here is the call graph for this function:

qreal QColor::greenF (  )  const

Returns the green color component of this color.

See also:
setGreenF(), green(), getRgbF()

Definition at line 995 of file qcolor.cpp.

References cspec, ct, greenF(), Invalid, Rgb, and toRgb().

Referenced by PanelShape::animate(), qdesigner_internal::QtGradientStopsModel::color(), qdesigner_internal::QtColorLinePrivate::colorFromPoint(), greenF(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), setBlueF(), QPdfEngine::setBrush(), QPSPrintEngine::setBrush(), setRedF(), and qdesigner_internal::QtGradientStopsEditorPrivate::slotChangeSaturation().

00996 {
00997     if (cspec != Invalid && cspec != Rgb)
00998         return toRgb().greenF();
00999     return ct.argb.green / qreal(USHRT_MAX);
01000 }

Here is the call graph for this function:

qreal QColor::blueF (  )  const

Returns the blue color component of this color.

See also:
setBlueF(), blue(), getRgbF()

Definition at line 1023 of file qcolor.cpp.

References blueF(), cspec, ct, Invalid, Rgb, and toRgb().

Referenced by PanelShape::animate(), blueF(), qdesigner_internal::QtGradientStopsModel::color(), qdesigner_internal::QtColorLinePrivate::colorFromPoint(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), QPdfEngine::setBrush(), QPSPrintEngine::setBrush(), setGreenF(), setRedF(), and qdesigner_internal::QtGradientStopsEditorPrivate::slotChangeValue().

01024 {
01025     if (cspec != Invalid && cspec != Rgb)
01026         return toRgb().blueF();
01027     return ct.argb.blue / qreal(USHRT_MAX);
01028 }

Here is the call graph for this function:

void QColor::setRedF ( qreal  red  ) 

Sets the red color component of this color to red. Float components are specified in the range 0.0-1.0.

See also:
redF(), red(), setRgbF()

Definition at line 981 of file qcolor.cpp.

References alphaF(), blueF(), cspec, ct, greenF(), QCOLOR_REAL_RANGE_CHECK, qRound(), Rgb, and setRgbF().

Referenced by PanelShape::animate().

00982 {
00983     QCOLOR_REAL_RANGE_CHECK("QColor::setRedF", red);
00984     if (cspec != Rgb)
00985         setRgbF(red, greenF(), blueF(), alphaF());
00986     else
00987         ct.argb.red = qRound(red * USHRT_MAX);
00988 }

Here is the call graph for this function:

void QColor::setGreenF ( qreal  green  ) 

Sets the green color component of this color to green. Float components are specified in the range 0.0-1.0.

See also:
greenF(), green(), setRgbF()

Definition at line 1009 of file qcolor.cpp.

References alphaF(), blueF(), cspec, ct, QCOLOR_REAL_RANGE_CHECK, qRound(), redF(), Rgb, and setRgbF().

Referenced by PanelShape::animate().

01010 {
01011     QCOLOR_REAL_RANGE_CHECK("QColor::setGreenF", green);
01012     if (cspec != Rgb)
01013         setRgbF(redF(), green, blueF(), alphaF());
01014     else
01015         ct.argb.green = qRound(green * USHRT_MAX);
01016 }

Here is the call graph for this function:

void QColor::setBlueF ( qreal  blue  ) 

Sets the blue color component of this color to blue. Float components are specified in the range 0.0-1.0.

See also:
blueF(), blue(), setRgbF()

Definition at line 1036 of file qcolor.cpp.

References alphaF(), cspec, ct, greenF(), QCOLOR_REAL_RANGE_CHECK, qRound(), redF(), Rgb, and setRgbF().

Referenced by PanelShape::animate().

01037 {
01038     QCOLOR_REAL_RANGE_CHECK("QColor::setBlueF", blue);
01039     if (cspec != Rgb)
01040         setRgbF(redF(), greenF(), blue, alphaF());
01041     else
01042         ct.argb.blue = qRound(blue * USHRT_MAX);
01043 }

Here is the call graph for this function:

void QColor::getRgb ( int *  r,
int *  g,
int *  b,
int *  a = 0 
) const

Sets the contents pointed to by r, g, b, and a, to the red, green, blue, and alpha-channel (transparency) components of the color's RGB value.

Note that the components can be retrieved individually using the red(), green(), blue() and alpha() functions.

See also:
rgb(), setRgb()

Definition at line 681 of file qcolor.cpp.

References cspec, ct, getRgb(), Invalid, Rgb, and toRgb().

Referenced by getRgb().

00682 {
00683     if (!r || !g || !b)
00684         return;
00685 
00686     if (cspec != Invalid && cspec != Rgb) {
00687         toRgb().getRgb(r, g, b, a);
00688         return;
00689     }
00690 
00691     *r = ct.argb.red   >> 8;
00692     *g = ct.argb.green >> 8;
00693     *b = ct.argb.blue  >> 8;
00694 
00695     if (a)
00696         *a = ct.argb.alpha >> 8;
00697 }

Here is the call graph for this function:

void QColor::setRgb ( int  r,
int  g,
int  b,
int  a = 255 
)

Sets the RGB value to r, g, b and the alpha value to a.

All the values must be in the range 0-255.

See also:
rgb(), getRgb(), setRgbF()

Definition at line 743 of file qcolor.cpp.

References cspec, ct, invalidate(), qWarning(), and Rgb.

Referenced by Q3ColorDrag::decode(), operator>>(), qBrushDark(), qBrushLight(), qBrushSetAlphaF(), QColor(), setBlue(), setGreen(), setNamedColor(), and setRed().

00744 {
00745     if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
00746         qWarning("QColor::setRgb: RGB parameters out of range");
00747         invalidate();
00748         return;
00749     }
00750 
00751     cspec = Rgb;
00752     ct.argb.alpha = a * 0x101;
00753     ct.argb.red   = r * 0x101;
00754     ct.argb.green = g * 0x101;
00755     ct.argb.blue  = b * 0x101;
00756     ct.argb.pad   = 0;
00757 }

Here is the call graph for this function:

void QColor::getRgbF ( qreal *  r,
qreal *  g,
qreal *  b,
qreal *  a = 0 
) const

Sets the contents pointed to by r, g, b, and a, to the red, green, blue, and alpha-channel (transparency) components of the color's RGB value.

Note that the components can be retrieved individually using the redF(), greenF(), blueF() and alphaF() functions.

See also:
rgb(), setRgb()

Definition at line 652 of file qcolor.cpp.

References cspec, ct, getRgbF(), Invalid, Rgb, and toRgb().

Referenced by getRgbF().

00653 {
00654     if (!r || !g || !b)
00655         return;
00656 
00657     if (cspec != Invalid && cspec != Rgb) {
00658         toRgb().getRgbF(r, g, b, a);
00659         return;
00660     }
00661 
00662     *r = ct.argb.red   / qreal(USHRT_MAX);
00663     *g = ct.argb.green / qreal(USHRT_MAX);
00664     *b = ct.argb.blue  / qreal(USHRT_MAX);
00665 
00666     if (a)
00667         *a = ct.argb.alpha / qreal(USHRT_MAX);
00668 
00669 }

Here is the call graph for this function:

void QColor::setRgbF ( qreal  r,
qreal  g,
qreal  b,
qreal  a = 1.0 
)

Sets the color channels of this color to r (red), g (green), b (blue) and a (alpha, transparency).

All values must be in the range 0.0-1.0.

See also:
rgb(), getRgbF(), setRgb()

Definition at line 716 of file qcolor.cpp.

References cspec, ct, invalidate(), qRound(), qWarning(), and Rgb.

Referenced by qdesigner_internal::QtGradientStopsModel::color(), setBlueF(), setGreenF(), and setRedF().

00717 {
00718     if (r < 0.0 || r > 1.0
00719         || g < 0.0 || g > 1.0
00720         || b < 0.0 || b > 1.0
00721         || a < 0.0 || a > 1.0) {
00722         qWarning("QColor::setRgbF: RGB parameters out of range");
00723         invalidate();
00724         return;
00725     }
00726 
00727     cspec = Rgb;
00728     ct.argb.alpha = qRound(a * USHRT_MAX);
00729     ct.argb.red   = qRound(r * USHRT_MAX);
00730     ct.argb.green = qRound(g * USHRT_MAX);
00731     ct.argb.blue  = qRound(b * USHRT_MAX);
00732     ct.argb.pad   = 0;
00733 }

Here is the call graph for this function:

QRgb QColor::rgba (  )  const

Returns the RGB value of the color. Note that unlike rgb(), the alpha is not stripped.

For an invalid color, the alpha value of the returned color is unspecified.

See also:
setRgba(), rgb()

Definition at line 778 of file qcolor.cpp.

References cspec, ct, Invalid, qRgba(), Rgb, rgba(), and toRgb().

Referenced by QRasterBuffer::colorizeBitmap(), QPixmap::createMaskFromColor(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPixmap::fill(), qBrushDark(), qBrushLight(), qBrushSetAlphaF(), qt_plastique_draw_gradient(), qt_plastique_draw_handle(), rgba(), QSpanData::setup(), qdesigner_internal::QtColorButtonPrivate::slotEditColor(), QStyleSheetStyle::styleHint(), QCommonStyle::styleHint(), and QX11PaintEngine::updatePen().

00779 {
00780     if (cspec != Invalid && cspec != Rgb)
00781         return toRgb().rgba();
00782     return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);
00783 }

Here is the call graph for this function:

void QColor::setRgba ( QRgb  rgba  ) 

Sets the RGBA value to rgba. Note that unlike setRgb(QRgb rgb), this function does not ignore the alpha.

See also:
rgba(), rgb()

Definition at line 791 of file qcolor.cpp.

References cspec, ct, qAlpha(), qBlue(), qGreen(), qRed(), and Rgb.

00792 {
00793     cspec = Rgb;
00794     ct.argb.alpha = qAlpha(rgba) * 0x101;
00795     ct.argb.red   = qRed(rgba)   * 0x101;
00796     ct.argb.green = qGreen(rgba) * 0x101;
00797     ct.argb.blue  = qBlue(rgba)  * 0x101;
00798     ct.argb.pad   = 0;
00799 }

Here is the call graph for this function:

QRgb QColor::rgb (  )  const

Returns the RGB value of the color. The alpha is stripped for compatibility.

See also:
getRgb(), rgba()

Definition at line 808 of file qcolor.cpp.

References cspec, ct, Invalid, qRgb(), Rgb, rgb(), and toRgb().

Referenced by QMessageBox::aboutQt(), QColorWell::dropEvent(), QColorShowLabel::dropEvent(), Q3TextFormat::getKey(), QColorDialog::getRgba(), Q3TextFormat::makeFormatChangeTags(), Q3TextFormat::makeFormatEndTags(), operator<<(), QCleanlooksStyle::polish(), rgb(), QColorDialog::selectColor(), QPainter::setBackground(), QPainter::setBrush(), QGLColormap::setEntry(), setNamedColor(), QPainter::setPen(), QMotifStyle::standardPixmap(), QCommonStyle::styleHint(), QCleanlooksStyle::styleHint(), and QX11PaintEngine::updatePen().

00809 {
00810     if (cspec != Invalid && cspec != Rgb)
00811         return toRgb().rgb();
00812     return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);
00813 }

Here is the call graph for this function:

void QColor::setRgb ( QRgb  rgb  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the RGB value to rgb, ignoring the alpha.

Definition at line 820 of file qcolor.cpp.

References cspec, ct, qBlue(), qGreen(), qRed(), and Rgb.

00821 {
00822     cspec = Rgb;
00823     ct.argb.alpha = 0xffff;
00824     ct.argb.red   = qRed(rgb)   * 0x101;
00825     ct.argb.green = qGreen(rgb) * 0x101;
00826     ct.argb.blue  = qBlue(rgb)  * 0x101;
00827     ct.argb.pad   = 0;
00828 }

Here is the call graph for this function:

int QColor::hue (  )  const

Referenced by toHsv().

int QColor::saturation (  )  const

int QColor::value (  )  const

qreal QColor::hueF (  )  const

Returns the hue color component of this color.

See also:
hue(), getHsvF(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 1090 of file qcolor.cpp.

References cspec, ct, Hsv, hueF(), Invalid, and toHsv().

Referenced by qdesigner_internal::QtColorLinePrivate::colorFromPoint(), hueF(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), and qdesigner_internal::QtGradientStopsEditorPrivate::slotChangeHue().

01091 {
01092     if (cspec != Invalid && cspec != Hsv)
01093         return toHsv().hueF();
01094     return ct.ahsv.hue == USHRT_MAX ? -1.0 : ct.ahsv.hue / 36000.0;
01095 }

Here is the call graph for this function:

qreal QColor::saturationF (  )  const

Returns the saturation color component of this color.

See also:
saturation() getHsvF(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 1103 of file qcolor.cpp.

References cspec, ct, Hsv, Invalid, saturationF(), and toHsv().

Referenced by qdesigner_internal::QtColorLinePrivate::checkColor(), qdesigner_internal::QtColorLinePrivate::colorFromPoint(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), saturationF(), and qdesigner_internal::QtGradientStopsEditorPrivate::slotChangeSaturation().

01104 {
01105     if (cspec != Invalid && cspec != Hsv)
01106         return toHsv().saturationF();
01107     return ct.ahsv.saturation / qreal(USHRT_MAX);
01108 }

Here is the call graph for this function:

qreal QColor::valueF (  )  const

Returns the value color component of this color.

See also:
value() getHsvF(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 1116 of file qcolor.cpp.

References cspec, ct, Hsv, Invalid, toHsv(), and valueF().

Referenced by qdesigner_internal::QtColorLinePrivate::checkColor(), qdesigner_internal::QtColorLinePrivate::colorFromPoint(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), qdesigner_internal::QtGradientStopsEditorPrivate::slotChangeValue(), and valueF().

01117 {
01118     if (cspec != Invalid && cspec != Hsv)
01119         return toHsv().valueF();
01120     return ct.ahsv.value / qreal(USHRT_MAX);
01121 }

Here is the call graph for this function:

void QColor::getHsv ( int *  h,
int *  s,
int *  v,
int *  a = 0 
) const

Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.

Note that the components can be retrieved individually using the hue(), saturation(), value() and alpha() functions.

See also:
setHsv(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 569 of file qcolor.cpp.

References cspec, ct, getHsv(), Hsv, Invalid, and toHsv().

Referenced by QCommonStyle::drawPrimitive(), getHsv(), QPalette::QPalette(), qt_palette_from_color(), qt_set_x11_resources(), and QInputContext::standardFormat().

00570 {
00571     if (!h || !s || !v)
00572         return;
00573 
00574     if (cspec != Invalid && cspec != Hsv) {
00575         toHsv().getHsv(h, s, v, a);
00576         return;
00577     }
00578 
00579     *h = ct.ahsv.hue == USHRT_MAX ? -1 : ct.ahsv.hue / 100;
00580     *s = ct.ahsv.saturation >> 8;
00581     *v = ct.ahsv.value      >> 8;
00582 
00583     if (a)
00584         *a = ct.ahsv.alpha >> 8;
00585 }

Here is the call graph for this function:

void QColor::setHsv ( int  h,
int  s,
int  v,
int  a = 255 
)

Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.

The saturation, value and alpha-channel values must be in the range 0-255, and the hue value must be greater than -1.

See also:
getHsv(), setHsvF(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 626 of file qcolor.cpp.

References cspec, ct, Hsv, invalidate(), and qWarning().

Referenced by QCleanlooksStyle::drawComplexControl(), QCleanlooksStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), WigglyWidget::paintEvent(), QColor(), qt_cleanlooks_draw_mdibutton(), qt_set_x11_resources(), and QInputContext::standardFormat().

00627 {
00628     if (h < -1 || (uint)s > 255 || (uint)v > 255 || (uint)a > 255) {
00629         qWarning("QColor::setHsv: HSV parameters out of range");
00630         invalidate();
00631         return;
00632     }
00633 
00634     cspec = Hsv;
00635     ct.ahsv.alpha      = a * 0x101;
00636     ct.ahsv.hue        = h == -1 ? USHRT_MAX : (h % 360) * 100;
00637     ct.ahsv.saturation = s * 0x101;
00638     ct.ahsv.value      = v * 0x101;
00639     ct.ahsv.pad        = 0;
00640 }

Here is the call graph for this function:

void QColor::getHsvF ( qreal *  h,
qreal *  s,
qreal *  v,
qreal *  a = 0 
) const

Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.

Note that the components can be retrieved individually using the hueF(), saturationF(), valueF() and alphaF() functions.

See also:
setHsv() {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 541 of file qcolor.cpp.

References cspec, ct, getHsvF(), Hsv, Invalid, and toHsv().

Referenced by getHsvF().

00542 {
00543         if (!h || !s || !v)
00544         return;
00545 
00546     if (cspec != Invalid && cspec != Hsv) {
00547         toHsv().getHsvF(h, s, v, a);
00548         return;
00549     }
00550 
00551     *h = ct.ahsv.hue == USHRT_MAX ? -1.0 : ct.ahsv.hue / 36000.0;
00552     *s = ct.ahsv.saturation / qreal(USHRT_MAX);
00553     *v = ct.ahsv.value / qreal(USHRT_MAX);
00554 
00555     if (a)
00556         *a = ct.ahsv.alpha / qreal(USHRT_MAX);
00557 }

Here is the call graph for this function:

void QColor::setHsvF ( qreal  h,
qreal  s,
qreal  v,
qreal  a = 1.0 
)

Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.

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

See also:
getHsvF(), setHsv(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 597 of file qcolor.cpp.

References cspec, ct, Hsv, qRound(), and qWarning().

Referenced by qdesigner_internal::QtColorLinePrivate::checkColor().

00598 {
00599     if (((h < 0.0 || h > 1.0) && h != -1.0)
00600         || (s < 0.0 || s > 1.0)
00601         || (v < 0.0 || v > 1.0)
00602         || (a < 0.0 || a > 1.0)) {
00603         qWarning("QColor::setHsvF: HSV parameters out of range");
00604         return;
00605     }
00606 
00607     cspec = Hsv;
00608     ct.ahsv.alpha      = qRound(a * USHRT_MAX);
00609     ct.ahsv.hue        = h == -1.0 ? USHRT_MAX : qRound(h * 36000);
00610     ct.ahsv.saturation = qRound(s * USHRT_MAX);
00611     ct.ahsv.value      = qRound(v * USHRT_MAX);
00612     ct.ahsv.pad        = 0;
00613 }

Here is the call graph for this function:

int QColor::cyan (  )  const

int QColor::magenta (  )  const

int QColor::yellow (  )  const

int QColor::black (  )  const

qreal QColor::cyanF (  )  const

Returns the cyan color component of this color.

See also:
cyan(), getCmykF(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1182 of file qcolor.cpp.

References Cmyk, cspec, ct, cyanF(), Invalid, and toCmyk().

Referenced by cyanF().

01183 {
01184     if (cspec != Invalid && cspec != Cmyk)
01185         return toCmyk().cyanF();
01186     return ct.acmyk.cyan / qreal(USHRT_MAX);
01187 }

Here is the call graph for this function:

qreal QColor::magentaF (  )  const

Returns the magenta color component of this color.

See also:
magenta(), getCmykF(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1195 of file qcolor.cpp.

References Cmyk, cspec, ct, Invalid, magentaF(), and toCmyk().

Referenced by magentaF().

01196 {
01197     if (cspec != Invalid && cspec != Cmyk)
01198         return toCmyk().magentaF();
01199     return ct.acmyk.magenta / qreal(USHRT_MAX);
01200 }

Here is the call graph for this function:

qreal QColor::yellowF (  )  const

Returns the yellow color component of this color.

See also:
yellow(), getCmykF(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1208 of file qcolor.cpp.

References Cmyk, cspec, ct, Invalid, toCmyk(), and yellowF().

Referenced by yellowF().

01209 {
01210     if (cspec != Invalid && cspec != Cmyk)
01211         return toCmyk().yellowF();
01212     return ct.acmyk.yellow / qreal(USHRT_MAX);
01213 }

Here is the call graph for this function:

qreal QColor::blackF (  )  const

Returns the black color component of this color.

See also:
black(), getCmykF(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1221 of file qcolor.cpp.

References blackF(), Cmyk, cspec, ct, Invalid, and toCmyk().

Referenced by blackF().

01222 {
01223     if (cspec != Invalid && cspec != Cmyk)
01224         return toCmyk().blackF();
01225     return ct.acmyk.black / qreal(USHRT_MAX);
01226 }

Here is the call graph for this function:

void QColor::getCmyk ( int *  c,
int *  m,
int *  y,
int *  k,
int *  a = 0 
)

Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.

Note that the components can be retrieved individually using the cyan(), magenta(), yellow(), black() and alpha() functions.

See also:
setCmyk(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1602 of file qcolor.cpp.

References Cmyk, cspec, ct, getCmyk(), Invalid, and toCmyk().

Referenced by getCmyk().

01603 {
01604     if (!c || !m || !y || !k)
01605         return;
01606 
01607     if (cspec != Invalid && cspec != Cmyk) {
01608         toCmyk().getCmyk(c, m, y, k, a);
01609         return;
01610     }
01611 
01612     *c = ct.acmyk.cyan >> 8;
01613     *m = ct.acmyk.magenta >> 8;
01614     *y = ct.acmyk.yellow >> 8;
01615     *k = ct.acmyk.black >> 8;
01616 
01617     if (a)
01618         *a = ct.acmyk.alpha >> 8;
01619 }

Here is the call graph for this function:

void QColor::setCmyk ( int  c,
int  m,
int  y,
int  k,
int  a = 255 
)

Sets the color to CMYK 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-255.

See also:
getCmyk(), setCmykF(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1659 of file qcolor.cpp.

References Cmyk, cspec, ct, and qWarning().

Referenced by QColor().

01660 {
01661     if (c < 0 || c > 255
01662         || m < 0 || m > 255
01663         || y < 0 || y > 255
01664         || k < 0 || k > 255
01665         || a < 0 || a > 255) {
01666         qWarning("QColor::setCmyk: CMYK parameters out of range");
01667         return;
01668     }
01669 
01670     cspec = Cmyk;
01671     ct.acmyk.alpha   = a * 0x101;
01672     ct.acmyk.cyan    = c * 0x101;
01673     ct.acmyk.magenta = m * 0x101;
01674     ct.acmyk.yellow  = y * 0x101;
01675     ct.acmyk.black   = k * 0x101;
01676 }

Here is the call graph for this function:

void QColor::getCmykF ( qreal *  c,
qreal *  m,
qreal *  y,
qreal *  k,
qreal *  a = 0 
)

Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.

Note that the components can be retrieved individually using the cyanF(), magentaF(), yellowF(), blackF() and alphaF() functions.

See also:
setCmykF(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1631 of file qcolor.cpp.

References Cmyk, cspec, ct, getCmykF(), Invalid, and toCmyk().

Referenced by getCmykF().

01632 {
01633     if (!c || !m || !y || !k)
01634         return;
01635 
01636     if (cspec != Invalid && cspec != Cmyk) {
01637         toCmyk().getCmykF(c, m, y, k, a);
01638         return;
01639     }
01640 
01641     *c = ct.acmyk.cyan    / qreal(USHRT_MAX);
01642     *m = ct.acmyk.magenta / qreal(USHRT_MAX);
01643     *y = ct.acmyk.yellow  / qreal(USHRT_MAX);
01644     *k = ct.acmyk.black   / qreal(USHRT_MAX);
01645 
01646     if (a)
01647         *a = ct.acmyk.alpha / qreal(USHRT_MAX);
01648 }

Here is the call graph for this function:

void QColor::setCmykF ( qreal  c,
qreal  m,
qreal  y,
qreal  k,
qreal  a = 1.0 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the color to CMYK 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:
getCmykF() setCmyk(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 1689 of file qcolor.cpp.

References Cmyk, cspec, ct, qRound(), and qWarning().

01690 {
01691     if (c < 0.0 || c > 1.0
01692         || m < 0.0 || m > 1.0
01693         || y < 0.0 || y > 1.0
01694         || k < 0.0 || k > 1.0
01695         || a < 0.0 || a > 1.0) {
01696         qWarning("QColor::setCmykF: CMYK parameters out of range");
01697         return;
01698     }
01699 
01700     cspec = Cmyk;
01701     ct.acmyk.alpha   = qRound(a * USHRT_MAX);
01702     ct.acmyk.cyan    = qRound(c * USHRT_MAX);
01703     ct.acmyk.magenta = qRound(m * USHRT_MAX);
01704     ct.acmyk.yellow  = qRound(y * USHRT_MAX);
01705     ct.acmyk.black   = qRound(k * USHRT_MAX);
01706 }

Here is the call graph for this function:

QColor QColor::toRgb (  )  const

Create and returns an RGB QColor based on this color.

See also:
fromRgb(), convertTo(), isValid()

Definition at line 1233 of file qcolor.cpp.

References argb, c, Cmyk, cspec, ct, h, Hsv, i, int, isValid(), m, p, qRound(), Rgb, s, t, and y.

Referenced by blueF(), qdesigner_internal::QtColorLinePrivate::checkColor(), convertTo(), getRgb(), getRgbF(), greenF(), QColormap::pixel(), redF(), rgb(), rgba(), toCmyk(), and toHsv().

01234 {
01235     if (!isValid() || cspec == Rgb)
01236         return *this;
01237 
01238     QColor color;
01239     color.cspec = Rgb;
01240     color.ct.argb.alpha = ct.argb.alpha;
01241     color.ct.argb.pad = 0;
01242 
01243     switch (cspec) {
01244     case Hsv:
01245         {
01246             if (ct.ahsv.saturation == 0 || ct.ahsv.hue == USHRT_MAX) {
01247                 // achromatic case
01248                 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsv.value;
01249                 break;
01250             }
01251 
01252             // chromatic case
01253             const qreal h = ct.ahsv.hue / 6000.;
01254             const qreal s = ct.ahsv.saturation / qreal(USHRT_MAX);
01255             const qreal v = ct.ahsv.value / qreal(USHRT_MAX);
01256             const int i = int(h);
01257             const qreal f = h - i;
01258             const qreal p = v * (1.0 - s);
01259 
01260             if (i & 1) {
01261                 const qreal q = v * (1.0 - (s * f));
01262 
01263                 switch (i) {
01264                 case 1:
01265                     color.ct.argb.red   = qRound(q * USHRT_MAX);
01266                     color.ct.argb.green = qRound(v * USHRT_MAX);
01267                     color.ct.argb.blue  = qRound(p * USHRT_MAX);
01268                     break;
01269                 case 3:
01270                     color.ct.argb.red   = qRound(p * USHRT_MAX);
01271                     color.ct.argb.green = qRound(q * USHRT_MAX);
01272                     color.ct.argb.blue  = qRound(v * USHRT_MAX);
01273                     break;
01274                 case 5:
01275                     color.ct.argb.red   = qRound(v * USHRT_MAX);
01276                     color.ct.argb.green = qRound(p * USHRT_MAX);
01277                     color.ct.argb.blue  = qRound(q * USHRT_MAX);
01278                     break;
01279                 }
01280             } else {
01281                 const qreal t = v * (1.0 - (s * (1.0 - f)));
01282 
01283                 switch (i) {
01284                 case 0:
01285                     color.ct.argb.red   = qRound(v * USHRT_MAX);
01286                     color.ct.argb.green = qRound(t * USHRT_MAX);
01287                     color.ct.argb.blue  = qRound(p * USHRT_MAX);
01288                     break;
01289                 case 2:
01290                     color.ct.argb.red   = qRound(p * USHRT_MAX);
01291                     color.ct.argb.green = qRound(v * USHRT_MAX);
01292                     color.ct.argb.blue  = qRound(t * USHRT_MAX);
01293                     break;
01294                 case 4:
01295                     color.ct.argb.red   = qRound(t * USHRT_MAX);
01296                     color.ct.argb.green = qRound(p * USHRT_MAX);
01297                     color.ct.argb.blue  = qRound(v * USHRT_MAX);
01298                     break;
01299                 }
01300             }
01301             break;
01302         }
01303     case Cmyk:
01304         {
01305             const qreal c = ct.acmyk.cyan / qreal(USHRT_MAX);
01306             const qreal m = ct.acmyk.magenta / qreal(USHRT_MAX);
01307             const qreal y = ct.acmyk.yellow / qreal(USHRT_MAX);
01308             const qreal k = ct.acmyk.black / qreal(USHRT_MAX);
01309 
01310             color.ct.argb.red   = qRound((1.0 - (c * (1.0 - k) + k)) * USHRT_MAX);
01311             color.ct.argb.green = qRound((1.0 - (m * (1.0 - k) + k)) * USHRT_MAX);
01312             color.ct.argb.blue  = qRound((1.0 - (y * (1.0 - k) + k)) * USHRT_MAX);
01313             break;
01314         }
01315     default:
01316         break;
01317     }
01318 
01319     return color;
01320 }

Here is the call graph for this function:

QColor QColor::toHsv (  )  const

Creates and returns an HSV QColor based on this color.

See also:
fromHsv(), convertTo(), isValid(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 1333 of file qcolor.cpp.

References ahsv, b, cspec, ct, g, Hsv, hue(), isValid(), Q_MAX_3, Q_MIN_3, qRound(), Rgb, toHsv(), and toRgb().

Referenced by qdesigner_internal::QtColorLinePrivate::checkColor(), convertTo(), dark(), getHsv(), getHsvF(), hueF(), light(), saturationF(), toHsv(), and valueF().

01334 {
01335     if (!isValid())
01336         return *this;
01337 
01338     if (cspec != Rgb)
01339         return toRgb().toHsv();
01340 
01341     QColor color;
01342     color.cspec = Hsv;
01343     color.ct.ahsv.alpha = ct.argb.alpha;
01344     color.ct.ahsv.pad = 0;
01345 
01346     const qreal r = ct.argb.red   / qreal(USHRT_MAX);
01347     const qreal g = ct.argb.green / qreal(USHRT_MAX);
01348     const qreal b = ct.argb.blue  / qreal(USHRT_MAX);
01349     const qreal max = Q_MAX_3(r, g, b);
01350     const qreal min = Q_MIN_3(r, g, b);
01351     const qreal delta = max - min;
01352     color.ct.ahsv.value = qRound(max * USHRT_MAX);
01353     if (delta == 0.0) {
01354         // achromatic case, hue is undefined
01355         color.ct.ahsv.hue = USHRT_MAX;
01356         color.ct.ahsv.saturation = 0;
01357     } else {
01358         // chromatic case
01359         qreal hue = 0;
01360         color.ct.ahsv.saturation = qRound((delta / max) * USHRT_MAX);
01361         if (r == max) {
01362             hue = ((g - b) /delta);
01363         } else if (g == max) {
01364             hue = (2.0 + (b - r) / delta);
01365         } else if (b == max) {
01366             hue = (4.0 + (r - g) / delta);
01367         } else {
01368             Q_ASSERT_X(false, "QColor::toHsv", "internal error");
01369         }
01370         hue *= 60.0;
01371         if (hue < 0.0)
01372             hue += 360.0;
01373         color.ct.ahsv.hue = qRound(hue * 100);
01374     }
01375 
01376     return color;
01377 }

Here is the call graph for this function:

QColor QColor::toCmyk (  )  const

Creates and returns a CMYK QColor based on this color.

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

Definition at line 1385 of file qcolor.cpp.

References acmyk, b, c, Cmyk, cspec, ct, g, isValid(), m, qMin(), qRound(), Rgb, toCmyk(), toRgb(), and y.

Referenced by blackF(), convertTo(), cyanF(), getCmyk(), getCmykF(), magentaF(), toCmyk(), and yellowF().

01386 {
01387     if (!isValid())
01388         return *this;
01389     if (cspec != Rgb)
01390         return toRgb().toCmyk();
01391 
01392     QColor color;
01393     color.cspec = Cmyk;
01394     color.ct.acmyk.alpha = ct.argb.alpha;
01395 
01396     // rgb -> cmy
01397     const qreal r = ct.argb.red   / qreal(USHRT_MAX);
01398     const qreal g = ct.argb.green / qreal(USHRT_MAX);
01399     const qreal b = ct.argb.blue  / qreal(USHRT_MAX);
01400     qreal c = 1.0 - r;
01401     qreal m = 1.0 - g;
01402     qreal y = 1.0 - b;
01403 
01404     // cmy -> cmyk
01405     const qreal k = qMin(c, qMin(m, y));
01406 
01407     if (!qFuzzyCompare(k,1)) {
01408         c = (c - k) / (1.0 - k);
01409         m = (m - k) / (1.0 - k);
01410         y = (y - k) / (1.0 - k);
01411     }
01412 
01413     color.ct.acmyk.cyan    = qRound(c * USHRT_MAX);
01414     color.ct.acmyk.magenta = qRound(m * USHRT_MAX);
01415     color.ct.acmyk.yellow  = qRound(y * USHRT_MAX);
01416     color.ct.acmyk.black   = qRound(k * USHRT_MAX);
01417 
01418     return color;
01419 }

Here is the call graph for this function:

QColor QColor::convertTo ( QColor::Spec  colorSpec  )  const

Creates a copy of this color in the format specified by colorSpec.

See also:
spec(), toCmyk(), toHsv(), toRgb(), isValid()

Definition at line 1421 of file qcolor.cpp.

References Cmyk, cspec, Hsv, Invalid, QColor(), Rgb, toCmyk(), toHsv(), and toRgb().

Referenced by dark(), and light().

01422 {
01423     if (colorSpec == cspec)
01424         return *this;
01425     switch (colorSpec) {
01426     case Rgb:
01427         return toRgb();
01428     case Hsv:
01429         return toHsv();
01430     case Cmyk:
01431         return toCmyk();
01432     case Invalid:
01433         break;
01434     }
01435     return QColor(); // must be invalid
01436 }

Here is the call graph for this function:

QColor QColor::fromRgb ( QRgb  rgb  )  [static]

Static convenience function that returns a QColor constructed from the given QRgb value rgb.

Note that the alpha component of rgb is ignored (i.e. it is automatically set to 255), use the fromRgba() function to include the alpha-channel specified by the given QRgb value.

See also:
fromRgba(), fromRgbF(), toRgb(), isValid()

Definition at line 1450 of file qcolor.cpp.

References qBlue(), qGreen(), and qRed().

Referenced by fromRgba(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), qdesigner_internal::QtBrushButton::QtBrushButton(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), QAbstractFormBuilder::setupBrush(), qdesigner_internal::QtBrushButtonPrivate::slotEditBrush(), and qdesigner_internal::QtBrushEditorPrivate::slotPatternChooserClicked().

01451 {
01452     return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
01453 }

Here is the call graph for this function:

QColor QColor::fromRgba ( QRgb  rgba  )  [static]

Static convenience function that returns a QColor constructed from the given QRgb value rgba.

Note that unlike the fromRgb() function, the alpha-channel specified by the given QRgb value is included.

See also:
fromRgb(), isValid()

Definition at line 1466 of file qcolor.cpp.

References fromRgb(), qAlpha(), qBlue(), qGreen(), and qRed().

Referenced by GradientWidget::setDefault().

01467 {
01468     return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
01469 }

Here is the call graph for this function:

QColor QColor::fromRgb ( int  r,
int  g,
int  b,
int  a = 255 
) [static]

Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).

All the values must be in the range 0-255.

See also:
toRgb(), fromRgbF(), isValid()

Definition at line 1480 of file qcolor.cpp.

References argb, cspec, ct, QColor(), qWarning(), and Rgb.

01481 {
01482     if (r < 0 || r > 255
01483         || g < 0 || g > 255
01484         || b < 0 || b > 255
01485         || a < 0 || a > 255) {
01486         qWarning("QColor::fromRgb: RGB parameters out of range");
01487         return QColor();
01488     }
01489 
01490     QColor color;
01491     color.cspec = Rgb;
01492     color.ct.argb.alpha = a * 0x101;
01493     color.ct.argb.red   = r * 0x101;
01494     color.ct.argb.green = g * 0x101;
01495     color.ct.argb.blue  = b * 0x101;
01496     color.ct.argb.pad   = 0;
01497     return color;
01498 }

Here is the call graph for this function:

QColor QColor::fromRgbF ( qreal  r,
qreal  g,
qreal  b,
qreal  a = 1.0 
) [static]

Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).

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

See also:
fromRgb(), toRgb(), isValid()

Definition at line 1509 of file qcolor.cpp.

References argb, cspec, ct, QColor(), qRound(), qWarning(), and Rgb.

Referenced by qdesigner_internal::QtGradientStopsModel::color(), qdesigner_internal::QtGradientWidget::paintEvent(), and query_colormap().

01510 {
01511     if (r < 0.0 || r > 1.0
01512         || g < 0.0 || g > 1.0
01513         || b < 0.0 || b > 1.0
01514         || a < 0.0 || a > 1.0) {
01515         qWarning("QColor::fromRgbF: RGB parameters out of range");
01516         return QColor();
01517     }
01518 
01519     QColor color;
01520     color.cspec = Rgb;
01521     color.ct.argb.alpha = qRound(a * USHRT_MAX);
01522     color.ct.argb.red   = qRound(r * USHRT_MAX);
01523     color.ct.argb.green = qRound(g * USHRT_MAX);
01524     color.ct.argb.blue  = qRound(b * USHRT_MAX);
01525     color.ct.argb.pad   = 0;
01526     return color;
01527 }

Here is the call graph for this function:

QColor QColor::fromHsv ( int  h,
int  s,
int  v,
int  a = 255 
) [static]

Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).

The value of s, v, and a must all be in the range 0-255; the value of h must be in the range 0-359.

See also:
toHsv(), fromHsvF(), isValid(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 1540 of file qcolor.cpp.

References ahsv, cspec, ct, Hsv, QColor(), and qWarning().

Referenced by qdesigner_internal::QtColorLinePrivate::hueGradientPixmap(), SortingBox::initialItemColor(), SortingBox::randomItemColor(), and qdesigner_internal::QtColorLinePrivate::recreateMainPixmap().

01541 {
01542     if (((h < 0 || h >= 360) && h != -1)
01543         || s < 0 || s > 255
01544         || v < 0 || v > 255
01545         || a < 0 || a > 255) {
01546         qWarning("QColor::fromHsv: HSV parameters out of range");
01547         return QColor();
01548     }
01549 
01550     QColor color;
01551     color.cspec = Hsv;
01552     color.ct.ahsv.alpha      = a * 0x101;
01553     color.ct.ahsv.hue        = h == -1 ? USHRT_MAX : (h % 360) * 100;
01554     color.ct.ahsv.saturation = s * 0x101;
01555     color.ct.ahsv.value      = v * 0x101;
01556     color.ct.ahsv.pad        = 0;
01557     return color;
01558 }

Here is the call graph for this function:

QColor QColor::fromHsvF ( qreal  h,
qreal  s,
qreal  v,
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 HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).

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

See also:
toHsv(), fromHsv(), isValid(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 1572 of file qcolor.cpp.

References ahsv, cspec, ct, Hsv, QColor(), qRound(), and qWarning().

Referenced by CompositionRenderer::drawSource().

01573 {
01574     if (((h < 0.0 || h > 1.0) && h != -1.0)
01575         || (s < 0.0 || s > 1.0)
01576         || (v < 0.0 || v > 1.0)
01577         || (a < 0.0 || a > 1.0)) {
01578         qWarning("QColor::fromHsvF: HSV parameters out of range");
01579         return QColor();
01580     }
01581 
01582     QColor color;
01583     color.cspec = Hsv;
01584     color.ct.ahsv.alpha      = qRound(a * USHRT_MAX);
01585     color.ct.ahsv.hue        = h == -1.0 ? USHRT_MAX : qRound(h * 36000);
01586     color.ct.ahsv.saturation = qRound(s * USHRT_MAX);
01587     color.ct.ahsv.value      = qRound(v * USHRT_MAX);
01588     color.ct.ahsv.pad        = 0;
01589     return color;
01590 }

Here is the call graph for this function:

QColor QColor::fromCmyk ( int  c,
int  m,
int  y,
int  k,
int  a = 255 
) [static]

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-255.

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

Definition at line 1719 of file qcolor.cpp.

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

01720 {
01721     if (c < 0 || c > 255
01722         || m < 0 || m > 255
01723         || y < 0 || y > 255
01724         || k < 0 || k > 255
01725         || a < 0 || a > 255) {
01726         qWarning("QColor::fromCmyk: CMYK parameters out of range");
01727         return QColor();
01728     }
01729 
01730     QColor color;
01731     color.cspec = Cmyk;
01732     color.ct.acmyk.alpha   = a * 0x101;
01733     color.ct.acmyk.cyan    = c * 0x101;
01734     color.ct.acmyk.magenta = m * 0x101;
01735     color.ct.acmyk.yellow  = y * 0x101;
01736     color.ct.acmyk.black   = k * 0x101;
01737     return color;
01738 }

Here is the call graph for this function:

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 1753 of file qcolor.cpp.

References acmyk, Cmyk, cspec, ct, QColor(), qRound(), and qWarning().

01754 {
01755     if (c < 0.0 || c > 1.0
01756         || m < 0.0 || m > 1.0
01757         || y < 0.0 || y > 1.0
01758         || k < 0.0 || k > 1.0
01759         || a < 0.0 || a > 1.0) {
01760         qWarning("QColor::fromCmykF: CMYK parameters out of range");
01761         return QColor();
01762     }
01763 
01764     QColor color;
01765     color.cspec = Cmyk;
01766     color.ct.acmyk.alpha   = qRound(a * USHRT_MAX);
01767     color.ct.acmyk.cyan    = qRound(c * USHRT_MAX);
01768     color.ct.acmyk.magenta = qRound(m * USHRT_MAX);
01769     color.ct.acmyk.yellow  = qRound(y * USHRT_MAX);
01770     color.ct.acmyk.black   = qRound(k * USHRT_MAX);
01771     return color;
01772 }

Here is the call graph for this function:

QColor QColor::light ( int  factor = 150  )  const

Returns a lighter (or darker) color, but does not change this object.

If the factor is greater than 100, this functions returns a lighter color. Setting factor to 150 returns a color that is 50% brighter. If the factor is less than 100, the return color is darker, but we recommend using the dark() function for this purpose. If the factor is 0 or negative, the return value is unspecified.

The function converts the current RGB color to HSV, multiplies the value (V) component by factor and converts the color back to RGB.

See also:
dark(), isValid()

Definition at line 1791 of file qcolor.cpp.

References ahsv, convertTo(), cspec, ct, dark(), s, and toHsv().

Referenced by PaletteEditorAdvanced::buildDisabledEffect(), MainWindow::buildDisabledEffect(), PaletteEditorAdvanced::buildInactiveEffect(), MainWindow::buildInactiveEffect(), Calculator::Calculator(), dark(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMotifStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), CompositionRenderer::drawSource(), TetrixBoard::drawSquare(), Chip::paint(), RobotLimb::paint(), RobotTorso::paint(), RobotHead::paint(), PreviewView::paintPage(), QCleanlooksStyle::polish(), qBrushLight(), qt_cleanlooks_draw_mdibutton(), qt_plastique_drawFrame(), qt_plastique_drawShadedPanel(), qt_set_x11_resources(), QCleanlooksStyle::standardPalette(), and SpreadSheet::updateColor().

01792 {
01793     if (factor <= 0)                                // invalid lightness factor
01794         return *this;
01795     else if (factor < 100)                        // makes color darker
01796         return dark(10000/factor);
01797 
01798     QColor hsv = toHsv();
01799     int s = hsv.ct.ahsv.saturation;
01800     int v = hsv.ct.ahsv.value;
01801 
01802     v = (factor*v)/100;
01803     if (v > USHRT_MAX) {
01804         // overflow... adjust saturation
01805         s -= v - USHRT_MAX;
01806         if (s < 0)
01807             s = 0;
01808         v = USHRT_MAX;
01809     }
01810 
01811     hsv.ct.ahsv.saturation = s;
01812     hsv.ct.ahsv.value = v;
01813 
01814     // convert back to same color spec as original color
01815     return hsv.convertTo(cspec);
01816 }

Here is the call graph for this function:

QColor QColor::dark ( int  factor = 200  )  const

Returns a darker (or lighter) color, but does not change this object.

If the factor is greater than 100, this functions returns a darker color. Setting factor to 300 returns a color that has one-third the brightness. If the factor is less than 100, the return color is lighter, but we recommend using the light() function for this purpose. If the factor is 0 or negative, the return value is unspecified.

The function converts the current RGB color to HSV, divides the value (V) component by factor and converts the color back to RGB.

See also:
light(), isValid()

Definition at line 1835 of file qcolor.cpp.

References ahsv, convertTo(), cspec, ct, light(), and toHsv().

Referenced by PaletteEditorAdvanced::buildDisabledEffect(), MainWindow::buildDisabledEffect(), PaletteEditorAdvanced::buildInactiveEffect(), MainWindow::buildInactiveEffect(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMotifStyle::drawControl(), QWindowsXPStyle::drawControl(), QCommonStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), CompositionRenderer::drawSource(), TetrixBoard::drawSquare(), GLWidget::extrude(), light(), Chip::paint(), QMotifStyle::polish(), QPlastiqueStyle::polish(), NorwegianWoodStyle::polish(), QWindowsXPStyle::polish(), qBrushDark(), qt_cleanlooks_draw_mdibutton(), qt_plastique_draw_handle(), qt_plastique_drawFrame(), qt_plastique_drawShadedPanel(), qt_set_x11_resources(), QCleanlooksStyle::standardPalette(), QCleanlooksStyle::styleHint(), and SpreadSheet::updateColor().

01836 {
01837     if (factor <= 0)                                // invalid darkness factor
01838         return *this;
01839     else if (factor < 100)                        // makes color lighter
01840         return light(10000/factor);
01841 
01842     QColor hsv = toHsv();
01843     hsv.ct.ahsv.value = (hsv.ct.ahsv.value * 100) / factor;
01844 
01845     // convert back to same color spec as original color
01846     return hsv.convertTo(cspec);
01847 }

Here is the call graph for this function:

QColor & QColor::operator= ( const QColor color  ) 

Assigns a copy of the color color to this color, and returns a reference to it.

Definition at line 1853 of file qcolor.cpp.

References argb, cspec, and ct.

Referenced by operator=().

01854 {
01855     cspec = color.cspec;
01856     ct.argb = color.ct.argb;
01857     return *this;
01858 }

QColor & QColor::operator= ( Qt::GlobalColor  color  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Assigns a copy of the color and returns a reference to this color.

Definition at line 1863 of file qcolor.cpp.

References operator=(), and QColor().

01864 {
01865     return operator=(QColor(color));
01866 }

Here is the call graph for this function:

bool QColor::operator== ( const QColor color  )  const

Returns true if this color has the same RGB value as the color color; otherwise returns false.

Definition at line 1872 of file qcolor.cpp.

References argb, cspec, and ct.

Referenced by operator!=().

01873 {
01874     return (cspec == color.cspec
01875             && ct.argb.alpha == color.ct.argb.alpha
01876             && ct.argb.red   == color.ct.argb.red
01877             && ct.argb.green == color.ct.argb.green
01878             && ct.argb.blue  == color.ct.argb.blue
01879             && ct.argb.pad   == color.ct.argb.pad);
01880 }

bool QColor::operator!= ( const QColor color  )  const

Returns true if this color has a different RGB value from the color color; otherwise returns false.

Definition at line 1886 of file qcolor.cpp.

References operator==().

01887 { return !operator==(color); }

Here is the call graph for this function:

QColor::operator QVariant (  )  const

Returns the color as a QVariant

Definition at line 1893 of file qcolor.cpp.

References QVariant::Color.

01894 {
01895     return QVariant(QVariant::Color, this);
01896 }

void QColor::invalidate (  )  [private]

Definition at line 1903 of file qcolor.cpp.

References cspec, ct, and Invalid.

Referenced by QColor(), setHsv(), setNamedColor(), setRgb(), and setRgbF().

01904 {
01905     cspec = Invalid;
01906     ct.argb.alpha = USHRT_MAX;
01907     ct.argb.red = 0;
01908     ct.argb.green = 0;
01909     ct.argb.blue = 0;
01910     ct.argb.pad = 0;
01911 }


Friends And Related Function Documentation

friend class QColormap [friend]

Definition at line 212 of file qcolor.h.

QDataStream & operator<< ( QDataStream stream,
const QColor color 
) [friend]

Writes the color to the stream.

See also:
{Format of the QDataStream Operators}

Definition at line 1973 of file qcolor.cpp.

01974 {
01975     if (stream.version() < 7) {
01976         quint32 p = (quint32)color.rgb();
01977         if (stream.version() == 1) // Swap red and blue
01978             p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
01979         return stream << p;
01980     }
01981 
01982     qint8   s = color.cspec;
01983     quint16 a = color.ct.argb.alpha;
01984     quint16 r = color.ct.argb.red;
01985     quint16 g = color.ct.argb.green;
01986     quint16 b = color.ct.argb.blue;
01987     quint16 p = color.ct.argb.pad;
01988 
01989     stream << s;
01990     stream << a;
01991     stream << r;
01992     stream << g;
01993     stream << b;
01994     stream << p;
01995 
01996     return stream;
01997 }

QDataStream & operator>> ( QDataStream stream,
QColor color 
) [friend]

Reads the color from the stream.

See also:
{ Format of the QDataStream Operators}

Definition at line 2007 of file qcolor.cpp.

02008 {
02009     if (stream.version() < 7) {
02010         quint32 p;
02011         stream >> p;
02012         if (stream.version() == 1) // Swap red and blue
02013             p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
02014         color.setRgb(p);
02015         return stream;
02016     }
02017 
02018     qint8 s;
02019     quint16 a, r, g, b, p;
02020     stream >> s;
02021     stream >> a;
02022     stream >> r;
02023     stream >> g;
02024     stream >> b;
02025     stream >> p;
02026 
02027     color.cspec = QColor::Spec(s);
02028     color.ct.argb.alpha = a;
02029     color.ct.argb.red   = r;
02030     color.ct.argb.green = g;
02031     color.ct.argb.blue  = b;
02032     color.ct.argb.pad   = p;
02033 
02034     return stream;
02035 }

int qRed ( QRgb  rgb  )  [related]

Returns the red component of the ARGB quadruplet rgb.

See also:
qRgb(), QColor::red()

Definition at line 37 of file qrgb.h.

Referenced by blendShade(), compress(), convert_RGB_to_Indexed8(), fromRgb(), fromRgba(), init_gray(), init_indexed(), main(), pixel_distance(), pnmscale(), QColor(), qGray(), qIsGray(), qStoreColors(), qt_write_dib(), query_colormap(), setRgb(), setRgba(), write_jpeg_image(), write_pbm_image(), and write_xpm_image().

00038 { return ((rgb >> 16) & 0xff); }

int qGreen ( QRgb  rgb  )  [related]

Returns the green component of the ARGB quadruplet rgb.

See also:
qRgb(), QColor::green()

Definition at line 40 of file qrgb.h.

Referenced by blendShade(), compress(), convert_RGB_to_Indexed8(), fromRgb(), fromRgba(), init_gray(), init_indexed(), main(), pixel_distance(), pnmscale(), QColor(), qGray(), qIsGray(), qStoreColors(), qt_write_dib(), query_colormap(), setRgb(), setRgba(), write_jpeg_image(), write_pbm_image(), and write_xpm_image().

00041 { return ((rgb >> 8) & 0xff); }

int qBlue ( QRgb  rgb  )  [related]

Returns the blue component of the ARGB quadruplet rgb.

See also:
qRgb(), QColor::blue()

Definition at line 43 of file qrgb.h.

Referenced by blendShade(), compress(), convert_RGB_to_Indexed8(), fromRgb(), fromRgba(), init_gray(), init_indexed(), main(), pixel_distance(), pnmscale(), QColor(), qGray(), qIsGray(), qStoreColors(), qt_write_dib(), query_colormap(), setRgb(), setRgba(), write_jpeg_image(), write_pbm_image(), and write_xpm_image().

00044 { return (rgb & 0xff); }

int qAlpha ( QRgb  rgba  )  [related]

Returns the alpha component of the ARGB quadruplet rgba.

See also:
qRgb(), QColor::alpha()

Definition at line 46 of file qrgb.h.

Referenced by blend_color_argb(), blend_untransformed_argb(), blendShade(), comp_func_DestinationAtop(), comp_func_DestinationIn(), comp_func_DestinationOut(), comp_func_DestinationOver(), comp_func_solid_DestinationAtop(), comp_func_solid_DestinationIn(), comp_func_solid_DestinationOut(), comp_func_solid_DestinationOver(), comp_func_solid_SourceAtop(), comp_func_solid_SourceIn(), comp_func_solid_SourceOut(), comp_func_solid_SourceOver(), comp_func_solid_XOR(), comp_func_SourceAtop(), comp_func_SourceIn(), comp_func_SourceOut(), comp_func_SourceOver(), comp_func_XOR(), fix_color_table(), fromRgba(), getOperator(), main(), pixel_distance(), pnmscale(), QColor(), setRgba(), and write_xpm_image().

00047 { return ((rgb >> 24) & 0xff); }

QRgb qRgb ( int  r,
int  g,
int  b 
) [related]

Returns the ARGB quadruplet (255, {r}, {g}, {b}).

See also:
qRgba(), qRed(), qGreen(), qBlue()

Definition at line 49 of file qrgb.h.

Referenced by convert_RGB_to_Indexed8(), init_gray(), init_indexed(), initRGB(), pnmscale(), qt_get_hex_rgb(), query_colormap(), read_dib_body(), read_jpeg_image(), read_pbm_body(), read_xbm_body(), rgb(), and setup_qt().

00050 { return (0xff << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }

QRgb qRgba ( int  r,
int  g,
int  b,
int  a 
) [related]

Returns the ARGB quadruplet ({a}, {r}, {g}, {b}).

See also:
qRgb(), qRed(), qGreen(), qBlue()

Definition at line 52 of file qrgb.h.

Referenced by blendShade(), main(), pnmscale(), rgba(), and setup_qt().

00053 { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }

int qGray ( int  r,
int  g,
int  b 
) [related]

Returns a gray value (0 to 255) from the (r, g, b) triplet.

The gray value is calculated using the formula (r * 11 + g * 16 + b * 5)/32.

Definition at line 55 of file qrgb.h.

Referenced by compress(), destStoreMono(), destStoreMonoLsb(), dither_to_Mono(), qGray(), query_colormap(), read_dib_body(), write_pbm_image(), and write_xbm_image().

00056 { return (r*11+g*16+b*5)/32; }

int qGray ( QRgb  rgb  )  [related]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a gray value (0 to 255) from the given ARGB quadruplet rgb.

The gray value is calculated using the formula (R * 11 + G * 16 + B * 5)/32. Note that the alpha-channel is ignored.

Definition at line 58 of file qrgb.h.

00059 { return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); }

QRgb [related]

An ARGB quadruplet on the format AARRGGBB, equivalent to an unsigned int.

Note that the type also holds a value for the alpha-channel. The default alpha channel is ff, i.e opaque. For more information, see the {QColor::Alpha-Blended Drawing}{Alpha-Blended Drawing} section.

See also:
QColor::rgb(), QColor::rgba()

Referenced by compress(), convert_ARGB_PM_to_ARGB(), convert_ARGB_PM_to_RGB(), convert_ARGB_to_ARGB_PM(), convert_RGB_to_Indexed8(), convertWithPalette(), embedData(), init_gray(), init_indexed(), main(), pnmscale(), qBrushDark(), qBrushLight(), qBrushSetAlphaF(), QColor(), qStoreColors(), qt_conv16ToRgb(), qt_get_rgb_val(), qt_write_dib(), query_colormap(), read_dib_body(), read_jpeg_image(), read_pbm_body(), read_xpm_body(), rotated270(), rotated90(), setNamedColor(), swapPixel01(), write_jpeg_image(), write_pbm_image(), and write_xpm_image().


Member Data Documentation

Spec QColor::cspec [private]

Definition at line 187 of file qcolor.h.

Referenced by blackF(), blueF(), convertTo(), cyanF(), dark(), fromCmyk(), fromCmykF(), fromHsv(), fromHsvF(), fromRgb(), fromRgbF(), getCmyk(), getCmykF(), getHsv(), getHsvF(), getRgb(), getRgbF(), greenF(), hueF(), invalidate(), isValid(), light(), magentaF(), operator<<(), operator=(), operator==(), operator>>(), QColor(), redF(), rgb(), rgba(), saturationF(), setBlue(), setBlueF(), setCmyk(), setCmykF(), setGreen(), setGreenF(), setHsv(), setHsvF(), setRed(), setRedF(), setRgb(), setRgba(), setRgbF(), toCmyk(), toHsv(), toRgb(), valueF(), and yellowF().

int QColor::alpha [private]

Returns the alpha color component of this color.

See also:
setAlpha(), alphaF(), {QColor::Alpha-Blended Drawing}{Alpha-Blended Drawing}

Definition at line 190 of file qcolor.h.

Referenced by PanelShape::animate(), TitleShape::animate(), QSvgAnimateColor::apply(), Q3SVGPaintEnginePrivate::applyStyle(), VariantDelegate::displayText(), QPixmap::fill(), QX11PaintEnginePrivate::fillPolygon_dev(), qdesigner_internal::QtColorLinePrivate::isMainPixmapValid(), QBrush::isOpaque(), qt_set_x11_resources(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), qdesigner_internal::QtGradientStopsEditorPrivate::setColorSpinBoxes(), qdesigner_internal::QtBrushPatternEditorPrivate::setColorSpinBoxes(), QX11PaintEngine::updateBrush(), and QX11PaintEngine::updatePen().

int QColor::red [private]

Returns the red color component of this color.

See also:
setRed(), redF(), getRgb()

Definition at line 191 of file qcolor.h.

Referenced by QSvgAnimateColor::apply(), Q3SVGPaintEnginePrivate::applyStyle(), ColorItem::ColorItem(), QAbstractFormBuilder::createProperty(), VariantDelegate::displayText(), QWindowsXPStyle::drawControl(), QAbstractTextDocumentLayout::drawInlineObject(), QWindowsStyle::drawPrimitive(), QPixmap::fill(), QCommonStyle::generatedIconPixmap(), qdesigner_internal::QtColorLinePrivate::isMainPixmapValid(), mergedColors(), BasicToolsPlugin::mouseMove(), PaintArea::mousePressEvent(), ColorItem::mousePressEvent(), operator<(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), qt_set_x11_resources(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), QMngHandlerPrivate::setBackgroundColor(), Q3ColorDrag::setColor(), qdesigner_internal::QtGradientStopsEditorPrivate::setColorSpinBoxes(), qdesigner_internal::QtBrushPatternEditorPrivate::setColorSpinBoxes(), and KAsteroidsView::showText().

int QColor::green [private]

Returns the green color component of this color.

See also:
setGreen(), greenF(), getRgb()

Definition at line 192 of file qcolor.h.

Referenced by QSvgAnimateColor::apply(), Q3SVGPaintEnginePrivate::applyStyle(), ColorItem::ColorItem(), QAbstractFormBuilder::createProperty(), VariantDelegate::displayText(), QWindowsXPStyle::drawControl(), QAbstractTextDocumentLayout::drawInlineObject(), QWindowsStyle::drawPrimitive(), QPixmap::fill(), QCommonStyle::generatedIconPixmap(), qdesigner_internal::QtColorLinePrivate::isMainPixmapValid(), mergedColors(), BasicToolsPlugin::mouseMove(), PaintArea::mousePressEvent(), ColorItem::mousePressEvent(), operator<(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), qt_set_x11_resources(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), QMngHandlerPrivate::setBackgroundColor(), Q3ColorDrag::setColor(), qdesigner_internal::QtGradientStopsEditorPrivate::setColorSpinBoxes(), qdesigner_internal::QtBrushPatternEditorPrivate::setColorSpinBoxes(), and KAsteroidsView::showText().

int QColor::blue [private]

Returns the blue color component of this color.

See also:
setBlue(), blueF(), getRgb()

Definition at line 193 of file qcolor.h.

Referenced by QSvgAnimateColor::apply(), Q3SVGPaintEnginePrivate::applyStyle(), ColorItem::ColorItem(), QAbstractFormBuilder::createProperty(), VariantDelegate::displayText(), QWindowsXPStyle::drawControl(), QAbstractTextDocumentLayout::drawInlineObject(), QWindowsStyle::drawPrimitive(), QPixmap::fill(), QCommonStyle::generatedIconPixmap(), qdesigner_internal::QtColorLinePrivate::isMainPixmapValid(), mergedColors(), BasicToolsPlugin::mouseMove(), PaintArea::mousePressEvent(), ColorItem::mousePressEvent(), operator<(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), qt_set_x11_resources(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), QMngHandlerPrivate::setBackgroundColor(), Q3ColorDrag::setColor(), qdesigner_internal::QtGradientStopsEditorPrivate::setColorSpinBoxes(), qdesigner_internal::QtBrushPatternEditorPrivate::setColorSpinBoxes(), and KAsteroidsView::showText().

ushort QColor::pad [private]

Definition at line 194 of file qcolor.h.

struct { ... } QColor::argb [private]

Referenced by fromRgb(), fromRgbF(), operator<<(), operator=(), operator==(), operator>>(), QColor(), and toRgb().

int QColor::hue [private]

Returns the hue color component of this color.

See also:
hueF(), getHsv(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 198 of file qcolor.h.

Referenced by qdesigner_internal::QtColorLinePrivate::checkColor(), QCleanlooksStyle::drawComplexControl(), QCleanlooksStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), qdesigner_internal::QtColorLinePrivate::isMainPixmapValid(), qdesigner_internal::QtColorLinePrivate::pointFromColor(), qt_cleanlooks_draw_mdibutton(), qt_set_x11_resources(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), qdesigner_internal::QtGradientStopsEditorPrivate::setColorSpinBoxes(), and qdesigner_internal::QtBrushPatternEditorPrivate::setColorSpinBoxes().

int QColor::saturation [private]

Returns the saturation color component of this color.

See also:
saturationF(), getHsv(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 199 of file qcolor.h.

Referenced by QCleanlooksStyle::drawComplexControl(), QCleanlooksStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), qdesigner_internal::QtColorLinePrivate::isMainPixmapValid(), qt_cleanlooks_draw_mdibutton(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), qdesigner_internal::QtGradientStopsEditorPrivate::setColorSpinBoxes(), and qdesigner_internal::QtBrushPatternEditorPrivate::setColorSpinBoxes().

int QColor::value [private]

Returns the value color component of this color.

See also:
valueF(), getHsv(), {QColor::The HSV Color Model}{The HSV Color Model}

Definition at line 200 of file qcolor.h.

Referenced by QCleanlooksStyle::drawComplexControl(), QCleanlooksStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), qdesigner_internal::QtColorLinePrivate::isMainPixmapValid(), qBrushSetAlphaF(), qt_cleanlooks_draw_mdibutton(), qt_set_x11_resources(), qdesigner_internal::QtColorLinePrivate::recreateMainPixmap(), qdesigner_internal::QtGradientStopsEditorPrivate::setColorSpinBoxes(), and qdesigner_internal::QtBrushPatternEditorPrivate::setColorSpinBoxes().

struct { ... } QColor::ahsv [private]

Referenced by dark(), fromHsv(), fromHsvF(), light(), and toHsv().

int QColor::cyan [private]

Returns the cyan color component of this color.

See also:
cyanF(), getCmyk(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 205 of file qcolor.h.

int QColor::magenta [private]

Returns the magenta color component of this color.

See also:
magentaF(), getCmyk(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 206 of file qcolor.h.

int QColor::yellow [private]

Returns the yellow color component of this color.

See also:
yellowF(), getCmyk(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 207 of file qcolor.h.

int QColor::black [private]

Returns the black color component of this color.

See also:
blackF(), getCmyk(), {QColor::The CMYK Color Model}{The CMYK Color Model}

Definition at line 208 of file qcolor.h.

struct { ... } QColor::acmyk [private]

Referenced by fromCmyk(), fromCmykF(), and toCmyk().

union { ... } QColor::ct [private]

Referenced by alphaF(), blackF(), blueF(), cyanF(), dark(), fromCmyk(), fromCmykF(),