Debian Codegraph @

tests/auto/gui/painting/qpathclipper/paths.cpp

raw
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 #include "paths.h"
29
30 QPainterPath Paths::rect()
31 {
32 QPainterPath path;
33
34 path.moveTo(45.885571, 62.857143);
35 path.lineTo(154.11442, 62.857143);
36 path.cubicTo(162.1236, 62.857143,
37 168.57142, 70.260744,
38 168.57142, 79.457144);
39 path.lineTo(168.57142, 123.4);
40 path.cubicTo(168.57142, 132.5964,
41 162.1236, 140,
42 154.11442, 140);
43 path.lineTo(45.885571, 140);
44 path.cubicTo(37.876394, 140,
45 31.428572, 132.5964,
46 31.428572, 123.4);
47 path.lineTo(31.428572, 79.457144);
48 path.cubicTo(31.428572,70.260744,
49 37.876394,62.857143,
50 45.885571,62.857143);
51 path.closeSubpath();
52 return path;
53 }
54
55 QPainterPath Paths::rect6()
56 {
57 QPainterPath path;
58
59 path.moveTo(45.885571, 62.857143);
60 path.lineTo(154.11442, 62.857143);
61 path.cubicTo(162.1236, 62.857143,
62 168.57142, 70.260744,
63 168.57142, 79.457144);
64 path.lineTo(168.57142, 123.4);
65 path.cubicTo(168.57142, 132.5964,
66 162.1236, 140,
67 154.11442, 140);
68 path.lineTo(45.885571, 140);
69 path.closeSubpath();
70 return path;
71 }
72
73
74 QPainterPath Paths::heart()
75 {
76 QPainterPath path;
77 path.moveTo(263.41570, 235.14588);
78 path.cubicTo(197.17570,235.14588,
79 143.41575,288.90587,
80 143.41575,355.14588);
81 path.cubicTo(143.41575, 489.90139,
82 279.34890, 525.23318,
83 371.97820, 658.45392);
84 path.cubicTo(459.55244,526.05056,
85 600.54070,485.59932,
86 600.54070,355.14588);
87 path.cubicTo(600.54070,288.90588, 546.78080,235.14587, 480.54070,235.14588);
88 path.cubicTo(432.49280,235.14588, 391.13910,263.51631, 371.97820,304.33338);
89 path.cubicTo(352.81740,263.51630, 311.46370,235.14587, 263.41570,235.14588);
90 path.closeSubpath();
91 return path;
92 }
93
94
95 QPainterPath Paths::body()
96 {
97 QPainterPath path;
98 path.moveTo(62.500000,15.531250);
99 path.cubicTo(48.633197,15.531250, 37.374999,26.789445, 37.375000,40.656250);
100 path.cubicTo(37.375000,54.523053, 48.633195,65.781252, 62.500000,65.781250);
101 path.cubicTo(76.366803,65.781250, 87.624998,54.523052, 87.625000,40.656250);
102 path.cubicTo(87.625000,26.789447, 76.366802,15.531250, 62.500000,15.531250);
103 path.closeSubpath();
104 path.moveTo(54.437500,65.812500);
105 path.cubicTo(35.184750,65.812499, 19.687500,81.341002, 19.687500,100.59375);
106 path.lineTo(19.687500,155.68750);
107 path.cubicTo(19.687501,167.50351, 25.539122,177.88308, 34.500000,184.15625);
108 path.lineTo(34.500000,254.03125);
109 path.cubicTo(34.499999,257.03306, 46.990615,259.43748, 62.500000,259.43750);
110 path.cubicTo(78.009381,259.43751, 90.468750,257.03307, 90.468750,254.03125);
111 path.lineTo(90.468750,184.15625);
112 path.cubicTo(99.429633,177.88307, 105.28125,167.50352, 105.28125,155.68750);
113 path.lineTo(105.28125,100.59375);
114 path.cubicTo(105.28125,81.341000, 89.784000,65.812500, 70.531250,65.812500);
115 path.lineTo(54.437500,65.812500);
116 path.closeSubpath();
117
118 return path;
119 }
120
121
122 QPainterPath Paths::mailbox()
123 {
124 QPainterPath path;
125 path.moveTo(355.22951,136.82424);
126 path.lineTo(332.03629,112.56585);
127 path.lineTo(325.71086,57.501867);
128 path.cubicTo(325.71086,57.501867, 410.12308,19.428758, 427.45202,29.094560);
129 path.cubicTo(444.78096,38.760366, 443.62570,54.289660, 443.62570,54.289660);
130 path.lineTo(443.62570,100.11509);
131 path.lineTo(355.22951,136.82424);
132 path.closeSubpath();
133
134 return path;
135 }
136
137
138 QPainterPath Paths::deer()
139 {
140 QPainterPath path;
141
142 path.moveTo(39.88,31.658);
143 path.cubicTo(35.632,31.658, 31.398,31.004, 27.871,32.82);
144 path.cubicTo(25.015,34.29, 19.608,34.158, 16.297,34.158);
145 path.cubicTo(14.722,34.158, 17.755,37.718, 17.709,38.922);
146 path.cubicTo(17.578,42.396, 24.612,43.15, 26.755,44.058);
147 path.cubicTo(30.062,45.46, 28.682,47.701, 28.963,50.574);
148 path.cubicTo(29.715,58.243, 26.887,63.745, 24.182,70.589);
149 path.cubicTo(23.365,72.657, 21.772,75.56, 21.972,77.866);
150 path.cubicTo(22.333,82.029, 15.803,77.207, 13.894,76.535);
151 path.cubicTo(10.977,75.508, 5.507,74.071, 2.424,75.331);
152 path.cubicTo(-1.532,76.947, 0.076,80.491, 2.169,82.806);
153 path.cubicTo(6.17,87.234, 2.703,90.713, 3.895,95.363);
154 path.cubicTo(4.321,97.026, 11.682,104.683, 12.858,103.668);
155 path.cubicTo(16.706,100.347, 11.464,98.692, 10.105,96.164);
156 path.cubicTo(9.487,95.015, 8.616,83.742, 8.866,83.759);
157 path.cubicTo(10.018,83.837, 12.591,85.867, 13.671,86.392);
158 path.cubicTo(16.889,87.954, 20.066,89.63, 22.963,91.741);
159 path.cubicTo(29.156,94.47, 35.543,96.965, 42.102,98.676);
160 path.cubicTo(51.085,101.02, 59.407,102.003, 68.009,106.005);
161 path.cubicTo(72.92,108.289, 72.05,113.282, 75.744,117.004);
162 path.cubicTo(79.422,120.709, 84.733,123.053, 88.978,126.053);
163 path.cubicTo(92.402,128.473, 95.422,132.308, 97.334,135.998);
164 path.cubicTo(99.551,140.279, 99.071,146.004, 99.838,150.674);
165 path.cubicTo(100.369,153.91, 104.378,156.321, 106.302,158.859);
166 path.cubicTo(110.471,164.355, 109.86,155.112, 108.163,154.412);
167 path.cubicTo(104.97,153.094, 103.991,146.625, 103.812,143.439);
168 path.cubicTo(103.525,138.336, 105.568,134.331, 101.918,130.346);
169 path.cubicTo(95.104,122.907, 89.488,114.182, 94.711,103.742);
170 path.cubicTo(96.889,99.388, 91.191,95.497, 96.94,94.368);
171 path.cubicTo(99.551,93.856, 102.49,94.367, 104.326,92.034);
172 path.cubicTo(106.639,89.095, 105.063,85.343, 102.943,82.798);
173 path.cubicTo(102.686,82.417, 102.359,82.121, 101.962,81.909);
174 path.cubicTo(102.331,81.909, 101.923,86.98, 100.981,87.628);
175 path.cubicTo(98.868,89.082, 95.569,91.586, 92.88,91.672);
176 path.cubicTo(90.569,91.745, 86.738,89.184, 85.212,87.658);
177 path.cubicTo(84.092,86.538, 80.176,86.157, 78.598,85.83);
178 path.cubicTo(74.737,85.031, 71.741,84.326, 68.012,82.806);
179 path.cubicTo(63.318,80.893, 58.687,78.672, 54.555,75.71);
180 path.cubicTo(44.573,68.555, 42.755,56.146, 44.022,44.495);
181 path.cubicTo(44.295,41.987, 43.169,38.057, 44.617,35.915);
182 path.cubicTo(44.961,35.406, 46.52,35.553, 47.119,35.024);
183 path.cubicTo(47.882,34.35, 49.574,31.822, 49.878,30.792);
184 path.cubicTo(51.126,26.569, 44.36,32.002, 45.336,31.938);
185 path.cubicTo(43.861,32.036, 47.011,22.934, 47.191,22.574);
186 path.cubicTo(47.555,21.846, 52.489,13.123, 49.511,13.222);
187 path.cubicTo(47.643,13.284, 48.563,18.667, 46.354,18.227);
188 path.cubicTo(43.964,17.751, 40.522,11.396, 41.566,9.011);
189 path.cubicTo(43.4,4.819, 39.743,3.905, 39.214,7.564);
190 path.cubicTo(39.112,8.269, 40.893,13.438, 38.159,12.665);
191 path.cubicTo(35.335,11.866, 35.748,-0.125, 34.38,-8.0352391e-15);
192 path.cubicTo(31.991,0.219, 34.074,10.836, 33.361,12.176);
193 path.cubicTo(33.144,12.584, 29.68,8.66, 29.459,7.718);
194 path.cubicTo(28.48,3.558, 28.031,5.106, 26.87,7.752);
195 path.cubicTo(25.333,11.254, 37.159,17.423, 39.292,18.663);
196 path.cubicTo(40.993,19.651, 42.39,20.504, 42.973,22.48);
197 path.cubicTo(43.482,24.205, 44.098,26.568, 42.926,28.191);
198 path.cubicTo(42.092,29.346, 39.88,29.982, 39.88,31.658);
199 return path;
200 }
201
202
203 QPainterPath Paths::fire()
204 {
205 QPainterPath path;
206
207 path.moveTo(362.83759,116.70426);
208 path.cubicTo(342.56574,131.59686, 300.71403,161.23127, 311.38454,218.12635);
209 path.cubicTo(322.05506,275.02144, 358.53432,301.66527, 328.90674,328.73285);
210 path.cubicTo(299.27916,355.80044, 251.48877,339.59410, 255.46042,288.61972);
211 path.cubicTo(258.22374,253.15368, 278.34141,205.10942, 278.34141,205.10942);
212 path.cubicTo(278.34141,205.10942, 234.02455,233.13427, 219.68939,254.01270);
213 path.cubicTo(205.35424,274.89113, 189.71452,330.07842, 208.58356,373.33974);
214 path.cubicTo(227.45261,416.60109, 316.46286,456.33444, 351.12048,514.32780);
215 path.cubicTo(374.10258,552.78425, 355.05815,613.59741, 310.80422,636.59310);
216 path.cubicTo(256.63287,664.74219, 299.16588,580.49238, 285.22551,523.86186);
217 path.cubicTo(273.46790,476.09839, 265.70022,445.12001, 188.03132,432.51681);
218 path.cubicTo(233.72591,465.34901, 242.16068,495.04075, 241.45928,524.11772);
219 path.cubicTo(240.78648,552.00862, 214.39595,634.57293, 177.39967,596.79021);
220 path.cubicTo(140.72642,559.33737, 214.27071,512.68654, 170.92945,471.62081);
221 path.cubicTo(174.73284,501.40284, 145.30515,514.98828, 131.55318,544.54392);
222 path.cubicTo(118.22673,573.18509, 123.55251,610.30651, 139.07596,645.41379);
223 path.cubicTo(181.14122,740.38745, 266.95518,726.23964, 208.75321,797.88229);
224 path.cubicTo(164.01134,852.95649, 162.90150,907.45084, 205.60384,970.81121);
225 path.cubicTo(240.06795,1021.9479, 371.11663,1060.7652, 432.20697,960.93460);
226 path.cubicTo(501.87852,820.00694, 357.14883,780.33174, 386.29974,732.84721);
227 path.cubicTo(405.70205,701.24238, 472.56601,668.86516, 501.09199,644.21233);
228 path.cubicTo(564.18184,587.55421, 561.84437,497.32621, 522.74229,471.25817);
229 path.cubicTo(530.19030,501.05022, 514.99952,542.79339, 483.67099,551.29691);
230 path.cubicTo(423.41173,567.65308, 458.18351,411.79373, 564.02075,393.61925);
231 path.cubicTo(530.91135,366.44998, 501.31413,367.33484, 454.91711,379.11707);
232 path.cubicTo(397.61736,393.57908, 407.64322,315.40944, 494.34643,262.67861);
233 path.cubicTo(549.19500,229.32101, 499.11573,147.63302, 491.66772,136.46100);
234 path.cubicTo(485.38713,213.93294, 435.43515,233.35601, 409.98053,235.72292);
235 path.cubicTo(375.27049,238.95043, 377.84554,214.33812, 396.75003,178.92950);
236 path.cubicTo(416.21172,142.47722, 448.15395,89.429942, 376.51366,44.060977);
237 path.cubicTo(388.13560,71.270572, 395.93673,94.012962, 362.83759,116.70426);
238 path.closeSubpath();
239 return path;
240 }
241
242
243 QPainterPath Paths::lips()
244 {
245 QPainterPath path;
246
247 path.moveTo(177.02257,176.65905);
248 path.cubicTo(154.11895,176.65905, 136.56711,174.32266, 110.41800,155.61729);
249 path.cubicTo(83.894106,136.64382, 70.456540,123.78263, 44.264608,101.00195);
250 path.cubicTo(36.985036,94.670475, 11.607987,76.421189, 0.62503194,72.562763);
251 path.cubicTo(22.778258,60.937514, 46.738237,46.430325, 55.325084,40.325054);
252 path.cubicTo(79.128700,23.400628, 99.203004,0.53294656, 116.15033,0.61582047);
253 path.cubicTo(129.59137,0.68308215, 144.54744,18.524567, 177.02257,18.524567);
254 path.cubicTo(210.04060,18.524567, 224.45379,0.68308215, 237.89483,0.61582047);
255 path.cubicTo(254.84216,0.53294656, 274.91646,23.400628, 298.72008,40.325054);
256 path.cubicTo(307.30692,46.430325, 331.26690,60.937514, 353.42013,72.562763);
257 path.cubicTo(342.43717,76.421189, 317.06013,94.670475, 309.78055,101.00195);
258 path.cubicTo(283.58862,123.78263, 270.15105,136.64382, 243.62716,155.61729);
259 path.cubicTo(217.47805,174.32266, 199.38332,176.65905, 177.02257,176.65905);
260 path.closeSubpath();
261
262 return path;
263 }
264
265 QPainterPath Paths::bezier1()
266 {
267 QPainterPath path;
268 path.moveTo(50, 50);
269 path.cubicTo(100, 100,
270 520, 90,
271 400,400);
272 return path;
273 }
274
275 QPainterPath Paths::bezier2()
276 {
277 QPainterPath path;
278 path.moveTo(200,200);
279 path.cubicTo(200,125, 500,100, 500,500);
280
281 return path;
282 }
283
284 QPainterPath Paths::random1()
285 {
286 QPainterPath path;
287
288 path.moveTo(65.714286,91.428571);
289 path.lineTo(217.14286, 102.85714);
290 path.cubicTo(219.04762, 106.66666,
291 220.95238, 110.47619,
292 222.85714,114.28571);
293 path.cubicTo(231.2679, 131.10723,
294 214.72525, 138.24185,
295 211.42857,151.42857);
296 path.cubicTo(207.25902, 168.10676,
297 213.24674, 175.8441,
298 217.14286,191.42857);
299 path.cubicTo(221.088, 207.20915,
300 201.21538,205.71429,
301 188.57143,205.71429);
302 path.cubicTo(170.18303, 205.71429,
303 161.42918, 197.50045,
304 145.71429,185.71429);
305 path.cubicTo(113.93441, 161.87938,
306 132.73699, 182.37652,
307 137.14286, 200);
308 path.cubicTo(140.37884, 212.94392,
309 128.50252, 217.16009,
310 117.14286, 220);
311 path.cubicTo(98.323209, 224.70491,
312 91.206108, 205.41767,
313 82.857143, 194.28571);
314 path.cubicTo(77.307286, 186.8859,
315 84.541768, 158.97578,
316 85.714286, 154.28571);
317 path.cubicTo(87.843677, 145.76815,
318 67.066253, 132.78054,
319 60 , 125.71429);
320 path.cubicTo(54.074503, 119.78879,
321 64.646395, 95.700137,
322 65.714286, 91.428571);
323 path.closeSubpath();
324
325 return path;
326 }
327
328 QPainterPath Paths::random2()
329 {
330 QPainterPath path;
331
332 path.moveTo(314.28571,160);
333 path.cubicTo(434.28571,125.71429,
334 505.71429,200,
335 505.71429,200);
336 path.lineTo(454.28571, 305.71429);
337 path.lineTo(337.14286, 302.85714);
338 path.cubicTo(337.14286, 302.85714,
339 308.57143, 340,
340 337.14286, 302.85714);
341 path.cubicTo(365.71429, 265.71429,
342 200, 420,
343 300, 291.42857);
344 path.cubicTo(400, 162.85714,
345 254.28571, 240,
346 254.28571, 240);
347 path.cubicTo(254.28571,240,
348 240,71.428571,
349 288.57143,134.28571);
350 path.cubicTo(337.14286,197.14286,
351 314.28571,162.85714,
352 314.28571,160);
353 path.closeSubpath();
354
355 return path;
356 }
357
358 QPainterPath Paths::bezier3()
359 {
360 QPainterPath path;
361 path.moveTo(295, 217);
362 path.cubicTo(364, 57,
363 377, 34,
364 456, 222);
365 return path;
366 }
367
368 QPainterPath Paths::bezier4()
369 {
370 QPainterPath path;
371 path.moveTo(200, 125);
372 path.cubicTo(200, 125,
373 623, 126,
374 623, 126);
375 return path;
376 }
377
378 QPainterPath Paths::heart2()
379 {
380 QPainterPath path;
381 path.moveTo(263.41570, 235.14588);
382 path.cubicTo(197.17570,235.14588,
383 143.41575,288.90587,
384 143.41575,355.14588);
385 path.cubicTo(143.41575, 489.90139,
386 279.34890, 525.23318,
387 371.97820, 658.45392);
388 return path;
389 }
390
391 QPainterPath Paths::rect2()
392 {
393 QPainterPath path;
394
395 path.addRect(80, 80, 100, 100);
396
397 return path;
398 }
399
400
401 QPainterPath Paths::rect3()
402 {
403 QPainterPath path;
404
405 path.addRect(100, 40, 100, 100);
406
407 return path;
408 }
409
410
411 QPainterPath Paths::rect4()
412 {
413 QPainterPath path;
414
415 path.addRect(100, 0, 200, 200);
416
417 path.addRect(120, 20, 80, 80);
418
419 return path;
420 }
421
422 QPainterPath Paths::simpleCurve()
423 {
424 QPainterPath path;
425 path.moveTo(74, 160);
426 path.cubicTo( 74, 160,
427 274, 406,
428 425, 166);
429 path.cubicTo(577, -73,
430 77, 160,
431 74, 160);
432 path.closeSubpath();
433
434 return path;
435 }
436
437 QPainterPath Paths::simpleCurve2()
438 {
439 QPainterPath path;
440 path.moveTo(54, 140);
441 path.cubicTo( 54, 140,
442 254, 386,
443 405, 146);
444 path.cubicTo(557, -93,
445 57, 140,
446 54, 140);
447 path.closeSubpath();
448
449 return path;
450 }
451
452 QPainterPath Paths::frame1()
453 {
454 QPainterPath path;
455 path.moveTo(190.71429, 40.933613);
456 path.lineTo(683.57141, 40.933613);
457 path.cubicTo(697.42141, 40.933613,
458 708.57141, 52.083613,
459 708.57141, 65.933613);
460 path.lineTo(708.57141, 375.93361);
461 path.cubicTo(708.57141, 389.78361,
462 697.42141, 400.93361,
463 683.57141, 400.93361);
464 path.lineTo(190.71429, 400.93361);
465 path.cubicTo(176.86429, 400.93361,
466 165.71429, 389.78361,
467 165.71429,375.93361);
468 path.lineTo(165.71429, 65.933613);
469 path.cubicTo(165.71429,52.083613,
470 176.86429,40.933613,
471 190.71429,40.933613);
472 path.closeSubpath();
473
474 return path;
475 }
476
477 QPainterPath Paths::frame2()
478 {
479 QPainterPath path;
480 path.moveTo(55.114286, 103.79076);
481 path.lineTo(187.74288, 103.79076);
482 path.cubicTo(192.95048, 103.79076,
483 197.14288, 107.88102,
484 197.14288, 112.96176);
485 path.lineTo(197.14288, 131.76261);
486 path.cubicTo(197.14288, 136.84335,
487 192.95048, 140.93361,
488 187.74288, 140.93361);
489 path.lineTo(55.114286, 140.93361);
490 path.cubicTo(49.906687, 140.93361,
491 45.714287, 136.84335,
492 45.714287, 131.76261);
493 path.lineTo(45.714287, 112.96176);
494 path.cubicTo(45.714287, 107.88102,
495 49.906687, 103.79076,
496 55.114286, 103.79076);
497 path.closeSubpath();
498
499 return path;
500 }
501
502 QPainterPath Paths::frame3()
503 {
504 QPainterPath path;
505 path.moveTo(200,80.933609);
506 path.lineTo(682.85715,80.933609);
507 path.lineTo(682.85715,446.6479);
508 path.lineTo(200,446.6479);
509 path.lineTo(200,80.933609);
510 path.closeSubpath();
511 return path;
512 }
513
514 QPainterPath Paths::frame4()
515 {
516 QPainterPath path;
517
518 path.moveTo(88.571434,206.64789);
519 path.lineTo(231.42858,206.64789);
520 path.lineTo(231.42858,246.64789);
521 path.lineTo(88.571434,246.64789);
522 path.lineTo(88.571434,206.64789);
523 path.closeSubpath();
524
525 return path;
526 }
527
528 QPainterPath Paths::simpleCurve3()
529 {
530 QPainterPath path;
531
532 path.moveTo(0, 0);
533 path.cubicTo(400,0,
534 0,400,
535 0,0);
536 path.closeSubpath();
537
538 return path;
539 }
540
541 QPainterPath Paths::rect5()
542 {
543 QPainterPath path;
544
545 path.addRect(0, 0, 200, 200);
546
547 return path;
548 }
549
550 QPainterPath Paths::triangle1()
551 {
552 QPainterPath path;
553
554 path.moveTo(0, 0);
555 path.lineTo(60, 0);
556 path.lineTo(60, 60);
557 path.closeSubpath();
558
559 return path;
560 }
561
562 QPainterPath Paths::triangle2()
563 {
564 QPainterPath path;
565
566 path.moveTo(0, 120);
567 path.lineTo(60, 120);
568 path.lineTo(60, 60);
569 path.closeSubpath();
570
571 return path;
572 }
573
574 QPainterPath Paths::node()
575 {
576 QRectF m_rect;
577 m_rect.setWidth(150);
578 m_rect.setHeight(100);
579
580 QPainterPath shape;
581 shape.addRoundedRect(m_rect, 25, Qt::RelativeSize);
582
583 const int conWidth = 10;
584 const int xOffset = 7;
585
586 QRectF rect(xOffset,
587 conWidth + 20,
588 conWidth, conWidth);
589 shape.addEllipse(rect);
590 //shape.addRect(rect);
591
592 rect = QRectF(m_rect.right() - conWidth - xOffset,
593 conWidth + 20,
594 conWidth, conWidth);
595 shape.addEllipse(rect);
596 //shape.addRect(rect);
597 return shape;
598 }
599
600 QPainterPath Paths::interRect()
601 {
602 QPainterPath path;
603 path.addRect(132, 42, 1, 1);
604 return path;
605 }
606
607 QPainterPath Paths::bezierFlower()
608 {
609 QPainterPath path;
610 path.moveTo(0, 0);
611 path.cubicTo(0, 50, -25, 75, -50, 100);
612 path.closeSubpath();
613 path.moveTo(0, 0);
614 path.cubicTo(0, 50, 25, 75, 50, 100);
615 path.closeSubpath();
616
617 path.moveTo(0, 0);
618 path.cubicTo(0, -50, -25, -75, -50, -100);
619 path.closeSubpath();
620 path.moveTo(0, 0);
621 path.cubicTo(0, -50, 25, -75, 50, -100);
622 path.closeSubpath();
623
624 path.moveTo(0, 0);
625 path.cubicTo(-50, 0, -75, -25, -100, -50);
626 path.closeSubpath();
627 path.moveTo(0, 0);
628 path.cubicTo(-50, 0, -75, 25, -100, 50);
629 path.closeSubpath();
630
631 path.moveTo(0, 0);
632 path.cubicTo(50, 0, 75, -25, 100, -50);
633 path.closeSubpath();
634 path.moveTo(0, 0);
635 path.cubicTo(50, 0, 75, 25, 100, 50);
636 path.closeSubpath();
637
638 return path;
639 }
640
641 QPainterPath Paths::clover()
642 {
643 QPainterPath path;
644 path.moveTo(50, 50);
645 path.lineTo(100, 25);
646 path.lineTo(100, 75);
647 path.lineTo(0, 25);
648 path.lineTo(0, 75);
649 path.lineTo(50, 50);
650 path.lineTo(75, 0);
651 path.lineTo(25, 0);
652 path.lineTo(75, 100);
653 path.lineTo(25, 100);
654 path.lineTo(50, 50);
655 return path;
656 }
657
658 QPainterPath Paths::ellipses()
659 {
660 QPainterPath path;
661 path.addEllipse(0, 0, 100, 100);
662 path.addEllipse(0, 20, 100, 60);
663 path.addEllipse(0, 40, 100, 20);
664 return path;
665 }
666
667 QPainterPath Paths::windingFill()
668 {
669 QPainterPath path;
670 path.addRect(0, 0, 100, 100);
671 path.addRect(50, 25, 100, 50);
672 path.setFillRule(Qt::WindingFill);
673 return path;
674 }
675
676 QPainterPath Paths::oddEvenFill()
677 {
678 QPainterPath path;
679 path.addRect(0, 0, 100, 100);
680 path.moveTo(50, 25);
681 path.lineTo(50, 75);
682 path.lineTo(150, 75);
683 path.lineTo(150, 25);
684 path.lineTo(50, 25);
685 path.setFillRule(Qt::OddEvenFill);
686 return path;
687 }
688
689 QPainterPath Paths::squareWithHole()
690 {
691 QPainterPath path;
692 path.addRect(0, 0, 100, 100);
693 path.addRect(30, 30, 40, 40);
694 return path;
695 }
696
697 QPainterPath Paths::circleWithHole()
698 {
699 QPainterPath path;
700 path.addEllipse(0, 0, 100, 100);
701 path.addEllipse(30, 30, 40, 40);
702 return path;
703 }
704
705 QPainterPath Paths::bezierQuadrant()
706 {
707 QPainterPath path;
708 int d = 1;
709 for (int i = 25; i <= 85; i += 10) {
710 path.moveTo(50, 100);
711 path.cubicTo(50, i, 50 + i* d / 2, 0, 50 + 50 * d, 0);
712 path.lineTo(50 + 50 * d, 100);
713 path.closeSubpath();
714 }
715
716 return path;
717 }