// qcolor.sip generated by MetaSIP on Fri Sep 28 17:07:47 2007 // // This file is part of the QtGui Python extension module. // // Copyright (c) 2007 // Phil Thompson // // This file is part of PyQt. // // This copy of PyQt is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License version 2 as published by // the Free Software Foundation and appearing in the file LICENSE included in the // packaging of this file. // // PyQt is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // PyQt; see the file LICENSE. If not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. %ModuleCode #include %End class QColor { %TypeHeaderCode #include %End %ConvertToTypeCode // SIP doesn't support automatic type convertors so we explicitly allow a // Qt::GlobalColor to be used whenever a QColor is expected. Note that SIP // must process QColor before QBrush so that the former's QVariant cast // operator is applied before the latter's. if (sipIsErr == NULL) return (PyObject_TypeCheck(sipPy, sipEnum_Qt_GlobalColor) || sipCanConvertToInstance(sipPy, sipClass_QColor, SIP_NO_CONVERTORS)); if (PyObject_TypeCheck(sipPy, sipEnum_Qt_GlobalColor)) { *sipCppPtr = new QColor((Qt::GlobalColor)PyInt_AsLong(sipPy)); return sipGetState(sipTransferObj); } *sipCppPtr = reinterpret_cast(sipConvertToInstance(sipPy, sipClass_QColor, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); return 0; %End %PickleCode sipRes = Py_BuildValue((char *)"iiii", sipCpp->red(), sipCpp->green(), sipCpp->blue(), sipCpp->alpha()); %End public: enum Spec { Invalid, Rgb, Hsv, Cmyk, }; QColor(Qt::GlobalColor color); QColor(QRgb rgb); QColor(const QVariant &variant) /NoDerived/; %MethodCode sipCpp = new QColor(qVariantValue(*a0)); %End QString name() const; void setNamedColor(const QString &name); static QStringList colorNames(); QColor::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.0e+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.0e+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.0e+0); QColor toRgb() const; QColor toHsv() const; QColor toCmyk() const; QColor convertTo(QColor::Spec colorSpec) const; 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.0e+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.0e+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.0e+0); QColor light(int f = 150) const; QColor dark(int f = 200) const; bool operator==(const QColor &c) const; bool operator!=(const QColor &c) const; operator QVariant() const; QColor(); QColor(int r, int g, int b, int a = 255); QColor(const QString &aname); QColor(const QColor &acolor); bool isValid() const; %If (Qt_4_3_0 -) %If (WS_X11) static bool allowX11ColorNames(); %End %End %If (Qt_4_3_0 -) %If (WS_X11) static void setAllowX11ColorNames(bool enabled); %End %End %If (Qt_4_3_0 -) QColor lighter(int f = 150) const; %End %If (Qt_4_3_0 -) QColor darker(int f = 200) const; %End }; QDataStream &operator<<(QDataStream &, const QColor & /Constrained/); QDataStream &operator>>(QDataStream &, QColor & /Constrained/);