1// qbrush.sip generated by MetaSIP
2//
3// This file is part of the QtGui Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QBrush /TypeHintIn="Union[QBrush, QColor, QGradient]"/
24{
25%TypeHeaderCode
26#include <qbrush.h>
27%End
28
29%ConvertToTypeCode
30// SIP doesn't support automatic type convertors so we explicitly allow a
31// QColor or a QGradient to be used whenever a QBrush is expected.  Note that
32// SIP must process QColor before QBrush so that the former's QVariant cast
33// operator is applied before the latter's.
34
35if (sipIsErr == NULL)
36    return (sipCanConvertToType(sipPy, sipType_QBrush, SIP_NO_CONVERTORS) ||
37            sipCanConvertToType(sipPy, sipType_QColor, 0) ||
38            sipCanConvertToType(sipPy, sipType_QGradient, 0));
39
40if (sipCanConvertToType(sipPy, sipType_QBrush, SIP_NO_CONVERTORS))
41{
42    *sipCppPtr = reinterpret_cast<QBrush *>(sipConvertToType(sipPy, sipType_QBrush, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
43
44    return 0;
45}
46
47int state;
48
49if (sipCanConvertToType(sipPy, sipType_QColor, 0))
50{
51    QColor *c = reinterpret_cast<QColor *>(sipConvertToType(sipPy, sipType_QColor, 0, 0, &state, sipIsErr));
52
53    if (*sipIsErr)
54    {
55        sipReleaseType(c, sipType_QColor, state);
56        return 0;
57    }
58
59    *sipCppPtr = new QBrush(*c);
60
61    sipReleaseType(c, sipType_QColor, state);
62
63    return sipGetState(sipTransferObj);
64}
65
66QGradient *g = reinterpret_cast<QGradient *>(sipConvertToType(sipPy, sipType_QGradient, 0, 0, &state, sipIsErr));
67
68if (*sipIsErr)
69{
70    sipReleaseType(g, sipType_QGradient, state);
71    return 0;
72}
73
74*sipCppPtr = new QBrush(*g);
75
76sipReleaseType(g, sipType_QGradient, state);
77
78return sipGetState(sipTransferObj);
79%End
80
81public:
82    QBrush();
83    QBrush(Qt::BrushStyle bs);
84    QBrush(const QColor &color, Qt::BrushStyle style = Qt::SolidPattern);
85    QBrush(const QColor &color, const QPixmap &pixmap);
86    QBrush(const QPixmap &pixmap);
87    QBrush(const QImage &image);
88    QBrush(const QBrush &brush);
89    QBrush(const QVariant &variant /GetWrapper/) /NoDerived/;
90%MethodCode
91        if (a0->canConvert<QBrush>())
92            sipCpp = new QBrush(a0->value<QBrush>());
93        else
94            sipError = sipBadCallableArg(0, a0Wrapper);
95%End
96
97    ~QBrush();
98    void setStyle(Qt::BrushStyle);
99    QPixmap texture() const;
100    void setTexture(const QPixmap &pixmap);
101    void setColor(const QColor &color);
102    const QGradient *gradient() const;
103    bool isOpaque() const;
104    bool operator==(const QBrush &b) const;
105    bool operator!=(const QBrush &b) const;
106    void setColor(Qt::GlobalColor acolor);
107    Qt::BrushStyle style() const;
108    const QColor &color() const;
109    void setTextureImage(const QImage &image);
110    QImage textureImage() const;
111    void setTransform(const QTransform &);
112    QTransform transform() const;
113    void swap(QBrush &other /Constrained/);
114};
115
116QDataStream &operator>>(QDataStream &, QBrush & /Constrained/) /ReleaseGIL/;
117QDataStream &operator<<(QDataStream &, const QBrush & /Constrained/) /ReleaseGIL/;
118typedef QVector<QPair<qreal, QColor>> QGradientStops;
119
120class QGradient
121{
122%TypeHeaderCode
123#include <qbrush.h>
124%End
125
126%ConvertToSubClassCode
127    switch (sipCpp->type())
128    {
129    case QGradient::ConicalGradient:
130        sipType = sipType_QConicalGradient;
131        break;
132
133    case QGradient::LinearGradient:
134        sipType = sipType_QLinearGradient;
135        break;
136
137    case QGradient::RadialGradient:
138        sipType = sipType_QRadialGradient;
139        break;
140
141    default:
142        sipType = 0;
143    }
144%End
145
146public:
147    enum CoordinateMode
148    {
149        LogicalMode,
150        StretchToDeviceMode,
151        ObjectBoundingMode,
152%If (Qt_5_12_0 -)
153        ObjectMode,
154%End
155    };
156
157    enum Type
158    {
159        LinearGradient,
160        RadialGradient,
161        ConicalGradient,
162        NoGradient,
163    };
164
165    enum Spread
166    {
167        PadSpread,
168        ReflectSpread,
169        RepeatSpread,
170    };
171
172%If (Qt_5_12_0 -)
173
174    enum Preset
175    {
176        WarmFlame,
177        NightFade,
178        SpringWarmth,
179        JuicyPeach,
180        YoungPassion,
181        LadyLips,
182        SunnyMorning,
183        RainyAshville,
184        FrozenDreams,
185        WinterNeva,
186        DustyGrass,
187        TemptingAzure,
188        HeavyRain,
189        AmyCrisp,
190        MeanFruit,
191        DeepBlue,
192        RipeMalinka,
193        CloudyKnoxville,
194        MalibuBeach,
195        NewLife,
196        TrueSunset,
197        MorpheusDen,
198        RareWind,
199        NearMoon,
200        WildApple,
201        SaintPetersburg,
202        PlumPlate,
203        EverlastingSky,
204        HappyFisher,
205        Blessing,
206        SharpeyeEagle,
207        LadogaBottom,
208        LemonGate,
209        ItmeoBranding,
210        ZeusMiracle,
211        OldHat,
212        StarWine,
213        HappyAcid,
214        AwesomePine,
215        NewYork,
216        ShyRainbow,
217        MixedHopes,
218        FlyHigh,
219        StrongBliss,
220        FreshMilk,
221        SnowAgain,
222        FebruaryInk,
223        KindSteel,
224        SoftGrass,
225        GrownEarly,
226        SharpBlues,
227        ShadyWater,
228        DirtyBeauty,
229        GreatWhale,
230        TeenNotebook,
231        PoliteRumors,
232        SweetPeriod,
233        WideMatrix,
234        SoftCherish,
235        RedSalvation,
236        BurningSpring,
237        NightParty,
238        SkyGlider,
239        HeavenPeach,
240        PurpleDivision,
241        AquaSplash,
242        SpikyNaga,
243        LoveKiss,
244        CleanMirror,
245        PremiumDark,
246        ColdEvening,
247        CochitiLake,
248        SummerGames,
249        PassionateBed,
250        MountainRock,
251        DesertHump,
252        JungleDay,
253        PhoenixStart,
254        OctoberSilence,
255        FarawayRiver,
256        AlchemistLab,
257        OverSun,
258        PremiumWhite,
259        MarsParty,
260        EternalConstance,
261        JapanBlush,
262        SmilingRain,
263        CloudyApple,
264        BigMango,
265        HealthyWater,
266        AmourAmour,
267        RiskyConcrete,
268        StrongStick,
269        ViciousStance,
270        PaloAlto,
271        HappyMemories,
272        MidnightBloom,
273        Crystalline,
274        PartyBliss,
275        ConfidentCloud,
276        LeCocktail,
277        RiverCity,
278        FrozenBerry,
279        ChildCare,
280        FlyingLemon,
281        NewRetrowave,
282        HiddenJaguar,
283        AboveTheSky,
284        Nega,
285        DenseWater,
286        Seashore,
287        MarbleWall,
288        CheerfulCaramel,
289        NightSky,
290        MagicLake,
291        YoungGrass,
292        ColorfulPeach,
293        GentleCare,
294        PlumBath,
295        HappyUnicorn,
296        AfricanField,
297        SolidStone,
298        OrangeJuice,
299        GlassWater,
300        NorthMiracle,
301        FruitBlend,
302        MillenniumPine,
303        HighFlight,
304        MoleHall,
305        SpaceShift,
306        ForestInei,
307        RoyalGarden,
308        RichMetal,
309        JuicyCake,
310        SmartIndigo,
311        SandStrike,
312        NorseBeauty,
313        AquaGuidance,
314        SunVeggie,
315        SeaLord,
316        BlackSea,
317        GrassShampoo,
318        LandingAircraft,
319        WitchDance,
320        SleeplessNight,
321        AngelCare,
322        CrystalRiver,
323        SoftLipstick,
324        SaltMountain,
325        PerfectWhite,
326        FreshOasis,
327        StrictNovember,
328        MorningSalad,
329        DeepRelief,
330        SeaStrike,
331        NightCall,
332        SupremeSky,
333        LightBlue,
334        MindCrawl,
335        LilyMeadow,
336        SugarLollipop,
337        SweetDessert,
338        MagicRay,
339        TeenParty,
340        FrozenHeat,
341        GagarinView,
342        FabledSunset,
343        PerfectBlue,
344%If (Qt_5_14_0 -)
345        NumPresets,
346%End
347    };
348
349%End
350    QGradient();
351%If (Qt_5_12_0 -)
352    QGradient(QGradient::Preset);
353%End
354%If (Qt_5_14_0 -)
355    ~QGradient();
356%End
357    QGradient::Type type() const;
358    QGradient::Spread spread() const;
359    void setColorAt(qreal pos, const QColor &color);
360    void setStops(const QGradientStops &stops);
361    QGradientStops stops() const;
362    bool operator==(const QGradient &gradient) const;
363    bool operator!=(const QGradient &other) const;
364    void setSpread(QGradient::Spread aspread);
365    QGradient::CoordinateMode coordinateMode() const;
366    void setCoordinateMode(QGradient::CoordinateMode mode);
367};
368
369class QLinearGradient : QGradient
370{
371%TypeHeaderCode
372#include <qbrush.h>
373%End
374
375public:
376    QLinearGradient();
377    QLinearGradient(const QPointF &start, const QPointF &finalStop);
378    QLinearGradient(qreal xStart, qreal yStart, qreal xFinalStop, qreal yFinalStop);
379%If (Qt_5_14_0 -)
380    ~QLinearGradient();
381%End
382    QPointF start() const;
383    QPointF finalStop() const;
384    void setStart(const QPointF &start);
385    void setStart(qreal x, qreal y);
386    void setFinalStop(const QPointF &stop);
387    void setFinalStop(qreal x, qreal y);
388};
389
390class QRadialGradient : QGradient
391{
392%TypeHeaderCode
393#include <qbrush.h>
394%End
395
396public:
397    QRadialGradient();
398    QRadialGradient(const QPointF &center, qreal radius, const QPointF &focalPoint);
399    QRadialGradient(const QPointF &center, qreal centerRadius, const QPointF &focalPoint, qreal focalRadius);
400    QRadialGradient(const QPointF &center, qreal radius);
401    QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qreal fy);
402    QRadialGradient(qreal cx, qreal cy, qreal centerRadius, qreal fx, qreal fy, qreal focalRadius);
403    QRadialGradient(qreal cx, qreal cy, qreal radius);
404%If (Qt_5_14_0 -)
405    ~QRadialGradient();
406%End
407    QPointF center() const;
408    QPointF focalPoint() const;
409    qreal radius() const;
410    void setCenter(const QPointF &center);
411    void setCenter(qreal x, qreal y);
412    void setFocalPoint(const QPointF &focalPoint);
413    void setFocalPoint(qreal x, qreal y);
414    void setRadius(qreal radius);
415    qreal centerRadius() const;
416    void setCenterRadius(qreal radius);
417    qreal focalRadius() const;
418    void setFocalRadius(qreal radius);
419};
420
421class QConicalGradient : QGradient
422{
423%TypeHeaderCode
424#include <qbrush.h>
425%End
426
427public:
428    QConicalGradient();
429    QConicalGradient(const QPointF &center, qreal startAngle);
430    QConicalGradient(qreal cx, qreal cy, qreal startAngle);
431%If (Qt_5_14_0 -)
432    ~QConicalGradient();
433%End
434    QPointF center() const;
435    qreal angle() const;
436    void setCenter(const QPointF &center);
437    void setCenter(qreal x, qreal y);
438    void setAngle(qreal angle);
439};
440