qbrush.sip 11 KB

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