QtGui/qcolor.h Source File
Go to the documentation of this file.
59 #ifndef QT_NO_DEBUG_STREAM
62 #ifndef QT_NO_DATASTREAM
67 class Q_GUI_EXPORT QColor
70 enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl };
74 QColor(
int r,
int g,
int b,
int a = 255);
77 QColor(
const char *
name);
78 QColor(
const QColor &
color);
92 void setAlpha(
int alpha);
95 void setAlphaF(qreal
alpha);
100 void setRed(
int red);
101 void setGreen(
int green);
102 void setBlue(
int blue);
105 qreal greenF()
const;
107 void setRedF(qreal
red);
108 void setGreenF(qreal
green);
109 void setBlueF(qreal
blue);
111 void getRgb(
int *
r,
int *
g,
int *
b,
int *
a = 0)
const;
112 void setRgb(
int r,
int g,
int b,
int a = 255);
114 void getRgbF(qreal *
r, qreal *
g, qreal *
b, qreal *
a = 0)
const;
115 void setRgbF(qreal
r, qreal
g, qreal
b, qreal
a = 1.0);
118 void setRgba(
QRgb rgba);
121 void setRgb(
QRgb rgb);
124 int saturation()
const;
126 int hsvSaturation()
const;
130 qreal saturationF()
const;
131 qreal hsvHueF()
const;
132 qreal hsvSaturationF()
const;
133 qreal valueF()
const;
135 void getHsv(
int *
h,
int *
s,
int *
v,
int *
a = 0)
const;
136 void setHsv(
int h,
int s,
int v,
int a = 255);
138 void getHsvF(qreal *
h, qreal *
s, qreal *
v, qreal *
a = 0)
const;
139 void setHsvF(qreal
h, qreal
s, qreal
v, qreal
a = 1.0);
147 qreal magentaF()
const;
148 qreal yellowF()
const;
149 qreal blackF()
const;
151 void getCmyk(
int *
c,
int *m,
int *
y,
int *k,
int *
a = 0);
152 void setCmyk(
int c,
int m,
int y,
int k,
int a = 255);
154 void getCmykF(qreal *
c, qreal *m, qreal *
y, qreal *k, qreal *
a = 0);
155 void setCmykF(qreal
c, qreal m, qreal
y, qreal k, qreal
a = 1.0);
158 int hslSaturation()
const;
159 int lightness()
const;
161 qreal hslHueF()
const;
162 qreal hslSaturationF()
const;
163 qreal lightnessF()
const;
165 void getHsl(
int *
h,
int *
s,
int *l,
int *
a = 0)
const;
166 void setHsl(
int h,
int s,
int l,
int a = 255);
168 void getHslF(qreal *
h, qreal *
s, qreal *l, qreal *
a = 0)
const;
169 void setHslF(qreal
h, qreal
s, qreal l, qreal
a = 1.0);
171 QColor toRgb()
const;
172 QColor toHsv()
const;
173 QColor toCmyk()
const;
174 QColor toHsl()
const;
176 QColor convertTo(Spec colorSpec)
const;
178 static QColor fromRgb(
QRgb rgb);
179 static QColor fromRgba(
QRgb rgba);
181 static QColor fromRgb(
int r,
int g,
int b,
int a = 255);
182 static QColor fromRgbF(qreal
r, qreal
g, qreal
b, qreal
a = 1.0);
184 static QColor fromHsv(
int h,
int s,
int v,
int a = 255);
185 static QColor fromHsvF(qreal
h, qreal
s, qreal
v, qreal
a = 1.0);
187 static QColor fromCmyk(
int c,
int m,
int y,
int k,
int a = 255);
188 static QColor fromCmykF(qreal
c, qreal m, qreal
y, qreal k, qreal
a = 1.0);
190 static QColor fromHsl(
int h,
int s,
int l,
int a = 255);
191 static QColor fromHslF(qreal
h, qreal
s, qreal l, qreal
a = 1.0);
193 QColor light(
int f = 150)
const;
194 QColor lighter(
int f = 150)
const;
195 QColor dark(
int f = 200)
const;
196 QColor darker(
int f = 200)
const;
198 QColor &operator=(
const QColor &);
204 operator QVariant()
const;
207 static bool allowX11ColorNames();
208 static void setAllowX11ColorNames(
bool enabled);
212 inline QT3_SUPPORT_CONSTRUCTOR QColor(
int x,
int y,
int z, Spec colorSpec)
213 {
if (colorSpec == Hsv) setHsv(x, y, z);
else setRgb(x, y, z); }
215 inline QT3_SUPPORT
void rgb(
int *
r,
int *
g,
int *
b)
const
217 inline QT3_SUPPORT
void hsv(
int *
h,
int *
s,
int *
v)
const
220 inline QT3_SUPPORT
void setRgba(
int r,
int g,
int b,
int a)
221 { setRgb(r, g, b, a); }
222 inline QT3_SUPPORT
void getRgba(
int *
r,
int *
g,
int *
b,
int *
a)
const
223 { getRgb(r, g, b, a); }
225 QT3_SUPPORT uint pixel(
int screen = -1)
const;
233 QColor(
int,
int,
int, Spec);
272 friend class QColormap;
273 #ifndef QT_NO_DATASTREAM
292 : cspec(acolor.cspec)
293 { ct.argb = acolor.ct.
argb; }
GLdouble GLdouble GLdouble r
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QColor &)
QColor darker(int f=200) const
QT_BEGIN_HEADER QT_BEGIN_NAMESPACE typedef unsigned int QRgb
QColor lighter(int f=150) const
void setNamedColor(const QString &name)
bool operator==(const Attribute &cA, const AttributeInstance< type > &cB)
This operator compares the two attributes and NOT their values.
AttributeInstance< Color > acolor
#define QT_BEGIN_NAMESPACE
QColor light(int f=150) const
GLclampf GLclampf GLclampf alpha
bool operator!=(const QByteArray &a1, const QByteArray &a2)
struct QColor::@88::@89 argb
GLsizei const GLfloat * value
int int int int int int h
GLuint const GLchar * name
GLubyte GLubyte GLubyte a
Q_GUI_EXPORT QDebug operator<<(QDebug, const QColor &)
void setRgb(int r, int g, int b, int a=255)
QColor dark(int f=200) const