12#include <private/qpaintengineex_p.h>
13#include <qvarlengtharray.h>
15#include <private/qhexstring_p.h>
20
21
22
23
24
25
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
61 const QPalette &pal,
bool sunken,
62 int lineWidth,
int midLineWidth)
64 if (Q_UNLIKELY(!p || lineWidth < 0 || midLineWidth < 0)) {
65 qWarning(
"qDrawShadeLine: Invalid parameters");
68 QPainterStateGuard painterGuard(p);
69 const qreal devicePixelRatio = QStyleHelper::getDpr(p);
70 if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
71 const qreal inverseScale = qreal(1) / devicePixelRatio;
72 p->scale(inverseScale, inverseScale);
73 x1 = qRound(devicePixelRatio * x1);
74 y1 = qRound(devicePixelRatio * y1);
75 x2 = qRound(devicePixelRatio * x2);
76 y2 = qRound(devicePixelRatio * y2);
77 lineWidth = qRound(devicePixelRatio * lineWidth);
78 midLineWidth = qRound(devicePixelRatio * midLineWidth);
79 p->translate(0.5, 0.5);
81 int tlw = lineWidth*2 + midLineWidth;
83 p->setPen(pal.color(QPalette::Dark));
85 p->setPen(pal.light().color());
96 for (i=0; i<lineWidth; i++) {
97 a.setPoints(3, x1+i, y+tlw-1-i,
102 if (midLineWidth > 0) {
103 p->setPen(pal.mid().color());
104 for (i=0; i<midLineWidth; i++)
105 p->drawLine(x1+lineWidth, y+lineWidth+i,
106 x2-lineWidth, y+lineWidth+i);
109 p->setPen(pal.light().color());
111 p->setPen(pal.dark().color());
112 for (i=0; i<lineWidth; i++) {
113 a.setPoints(3, x1+i, y+tlw-i-1,
127 for (i=0; i<lineWidth; i++) {
128 a.setPoints(3, x+i, y2,
133 if (midLineWidth > 0) {
134 p->setPen(pal.mid().color());
135 for (i=0; i<midLineWidth; i++)
136 p->drawLine(x+lineWidth+i, y1+lineWidth, x+lineWidth+i, y2);
139 p->setPen(pal.light().color());
141 p->setPen(pal.dark().color());
142 for (i=0; i<lineWidth; i++) {
143 a.setPoints(3, x+lineWidth, y2-i,
145 x+tlw-i-1, y1+lineWidth);
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
185 const QPalette &pal,
bool sunken,
186 int lineWidth,
int midLineWidth,
189 if (w == 0 || h == 0)
191 if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0 || midLineWidth < 0)) {
192 qWarning(
"qDrawShadeRect: Invalid parameters");
196 QPainterStateGuard painterGuard(p);
197 const qreal devicePixelRatio = QStyleHelper::getDpr(p);
198 if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
199 const qreal inverseScale = qreal(1) / devicePixelRatio;
200 p->scale(inverseScale, inverseScale);
201 x = qRound(devicePixelRatio * x);
202 y = qRound(devicePixelRatio * y);
203 w = devicePixelRatio * w;
204 h = devicePixelRatio * h;
205 lineWidth = qRound(devicePixelRatio * lineWidth);
206 midLineWidth = qRound(devicePixelRatio * midLineWidth);
207 p->translate(0.5, 0.5);
210 p->setPen(pal.dark().color());
212 p->setPen(pal.light().color());
213 int x1=x, y1=y, x2=x+w-1, y2=y+h-1;
215 if (lineWidth == 1 && midLineWidth == 0) {
216 p->drawRect(x1, y1, w-2, h-2);
218 p->setPen(pal.light().color());
220 p->setPen(pal.dark().color());
221 QLineF lines[4] = { QLineF(x1+1, y1+1, x2-2, y1+1),
222 QLineF(x1+1, y1+2, x1+1, y2-2),
223 QLineF(x1, y2, x2, y2),
224 QLineF(x2,y1, x2,y2-1) };
225 p->drawLines(lines, 4);
227 int m = lineWidth+midLineWidth;
229 for (i=0; i<lineWidth; i++) {
230 QLineF lines[4] = { QLineF(x1+i, y2-i, x1+i, y1+i),
231 QLineF(x1+i, y1+i, x2-i, y1+i),
232 QLineF(x1+k, y2-k, x2-k, y2-k),
233 QLineF(x2-k, y2-k, x2-k, y1+k) };
234 p->drawLines(lines, 4);
237 p->setPen(pal.mid().color());
239 for (i=0; i<midLineWidth; i++) {
240 p->drawRect(x1+lineWidth+i, y1+lineWidth+i, w-j-1, h-j-1);
244 p->setPen(pal.light().color());
246 p->setPen(pal.dark().color());
248 for (i=0; i<lineWidth; i++) {
249 QLineF lines[4] = { QLineF(x1+1+i, y2-i, x2-i, y2-i),
250 QLineF(x2-i, y2-i, x2-i, y1+i+1),
251 QLineF(x1+k, y2-k, x1+k, y1+k),
252 QLineF(x1+k, y1+k, x2-k, y1+k) };
253 p->drawLines(lines, 4);
258 int tlw = lineWidth + midLineWidth;
259 p->setPen(Qt::NoPen);
261 p->drawRect(x+tlw, y+tlw, w-2*tlw, h-2*tlw);
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
295 const QPalette &pal,
bool sunken,
296 int lineWidth,
const QBrush *fill)
298 if (w == 0 || h == 0)
300 if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
301 qWarning(
"qDrawShadePanel: Invalid parameters");
304 QPainterStateGuard painterGuard(p);
305 const qreal devicePixelRatio = QStyleHelper::getDpr(p);
306 bool isTranslated =
false;
307 if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
308 const qreal inverseScale = qreal(1) / devicePixelRatio;
309 p->scale(inverseScale, inverseScale);
310 x = qRound(devicePixelRatio * x);
311 y = qRound(devicePixelRatio * y);
312 w = devicePixelRatio * w;
313 h = devicePixelRatio * h;
314 lineWidth = qRound(devicePixelRatio * lineWidth);
315 p->translate(0.5, 0.5);
319 QColor shade = pal.dark().color();
320 QColor light = pal.light().color();
322 if (fill->color() == shade)
323 shade = pal.shadow().color();
324 if (fill->color() == light)
325 light = pal.midlight().color();
328 lines.reserve(2*lineWidth);
339 for (i=0; i<lineWidth; i++) {
340 lines << QLineF(x1, y1++, x2--, y2++);
344 for (i=0; i<lineWidth; i++) {
345 lines << QLineF(x1++, y1, x2++, y2--);
356 for (i=0; i<lineWidth; i++) {
357 lines << QLineF(x1++, y1--, x2, y2--);
361 y2 = y+h-lineWidth-1;
362 for (i=0; i<lineWidth; i++) {
363 lines << QLineF(x1--, y1++, x2--, y2);
368 p->translate(-0.5, -0.5);
369 p->fillRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2, *fill);
374
375
376
377
378
379
380
381
382
383
384
385
386
389 int x,
int y,
int w,
int h,
390 const QColor &c1,
const QColor &c2,
391 const QColor &c3,
const QColor &c4,
397 QPainterStateGuard painterGuard(p);
398 const qreal devicePixelRatio = QStyleHelper::getDpr(p);
399 bool isTranslated =
false;
400 if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
401 const qreal inverseScale = qreal(1) / devicePixelRatio;
402 p->scale(inverseScale, inverseScale);
403 x = qRound(devicePixelRatio * x);
404 y = qRound(devicePixelRatio * y);
405 w = devicePixelRatio * w;
406 h = devicePixelRatio * h;
407 p->translate(0.5, 0.5);
411 QPoint a[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) };
413 p->drawPolyline(a, 3);
414 QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) };
416 p->drawPolyline(b, 3);
417 if (w > 4 && h > 4) {
418 QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) };
420 p->drawPolyline(c, 3);
421 QPoint d[3] = { QPoint(x+1, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y+1) };
423 p->drawPolyline(d, 3);
426 p->translate(-0.5, -0.5);
427 p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
458 const QPalette &pal,
bool sunken,
462 qDrawWinShades(p, x, y, w, h,
463 pal.shadow().color(), pal.light().color(), pal.dark().color(),
464 pal.button().color(), fill);
466 qDrawWinShades(p, x, y, w, h,
467 pal.light().color(), pal.shadow().color(), pal.button().color(),
468 pal.dark().color(), fill);
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
498 const QPalette &pal,
bool sunken,
502 qDrawWinShades(p, x, y, w, h,
503 pal.dark().color(), pal.light().color(), pal.shadow().color(),
504 pal.midlight().color(), fill);
506 qDrawWinShades(p, x, y, w, h,
507 pal.light().color(), pal.shadow().color(), pal.midlight().color(),
508 pal.dark().color(), fill);
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
534 int lineWidth,
const QBrush *fill)
536 if (w == 0 || h == 0)
538 if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
539 qWarning(
"qDrawPlainRect: Invalid parameters");
543 QPainterStateGuard painterGuard(p);
544 if (lineWidth == 0 && !fill)
547 p->setPen(QPen(c, lineWidth, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin));
548 p->setBrush(fill ? *fill : Qt::NoBrush);
549 const QRectF r(x, y, w, h);
550 const auto lw2 = lineWidth / 2.;
551 const QRectF rect = r.marginsRemoved(QMarginsF(lw2, lw2, lw2, lw2));
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
584 qreal rx, qreal ry,
const QColor &c,
585 int lineWidth,
const QBrush *fill)
587 if (w == 0 || h == 0)
589 if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
590 qWarning(
"qDrawPlainRect: Invalid parameters");
594 QPainterStateGuard painterGuard(p);
595 if (lineWidth == 0 && !fill)
598 p->setPen(QPen(c, lineWidth));
599 p->setBrush(fill ? *fill : Qt::NoBrush);
600 const QRectF r(x, y, w, h);
601 const auto lw2 = lineWidth / 2.;
602 const QRectF rect = r.marginsRemoved(QMarginsF(lw2, lw2, lw2, lw2));
603 p->drawRoundedRect(rect, rx, ry);
607
608
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
643 const QPalette &pal,
bool sunken,
644 int lineWidth,
int midLineWidth)
646 qDrawShadeLine(p, p1.x(), p1.y(), p2.x(), p2.y(), pal, sunken,
647 lineWidth, midLineWidth);
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
682 const QPalette &pal,
bool sunken,
683 int lineWidth,
int midLineWidth,
686 qDrawShadeRect(p, r.x(), r.y(), r.width(), r.height(), pal, sunken,
687 lineWidth, midLineWidth, fill);
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
719 const QPalette &pal,
bool sunken,
720 int lineWidth,
const QBrush *fill)
722 qDrawShadePanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken,
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
750 const QPalette &pal,
bool sunken,
const QBrush *fill)
752 qDrawWinButton(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill);
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
781 const QPalette &pal,
bool sunken,
const QBrush *fill)
783 qDrawWinPanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill);
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
808 int lineWidth,
const QBrush *fill)
810 qDrawPlainRect(p, r.x(), r.y(), r.width(), r.height(), c,
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
842
843
844
845
846
847
848
849
850
851
852
853
856
857
858
861
862
863
866
867
868
869
870
871
872
873
874
875
876
881
882
883
884
885
886
887
888
889
890
891
892
893
894
896void qDrawBorderPixmap(
QPainter *painter,
const QRect &targetRect,
const QMargins &targetMargins,
897 const QPixmap &pixmap,
const QRect &sourceRect,
const QMargins &sourceMargins,
900 , QDrawBorderPixmap::DrawingHints hints
904 QPainter::PixmapFragment d;
912 const int sourceCenterTop = sourceRect.top() + sourceMargins.top();
913 const int sourceCenterLeft = sourceRect.left() + sourceMargins.left();
914 const int sourceCenterBottom = sourceRect.bottom() - sourceMargins.bottom() + 1;
915 const int sourceCenterRight = sourceRect.right() - sourceMargins.right() + 1;
916 const int sourceCenterWidth = sourceCenterRight - sourceCenterLeft;
917 const int sourceCenterHeight = sourceCenterBottom - sourceCenterTop;
919 const int targetCenterTop = targetRect.top() + targetMargins.top();
920 const int targetCenterLeft = targetRect.left() + targetMargins.left();
921 const int targetCenterBottom = targetRect.bottom() - targetMargins.bottom() + 1;
922 const int targetCenterRight = targetRect.right() - targetMargins.right() + 1;
923 const int targetCenterWidth = targetCenterRight - targetCenterLeft;
924 const int targetCenterHeight = targetCenterBottom - targetCenterTop;
926 QVarLengthArray<qreal, 16> xTarget;
927 QVarLengthArray<qreal, 16> yTarget;
931 if (rules.horizontal != Qt::StretchTile && sourceCenterWidth != 0)
932 columns = qMax(3, 2 + qCeil(targetCenterWidth / qreal(sourceCenterWidth)));
933 if (rules.vertical != Qt::StretchTile && sourceCenterHeight != 0)
934 rows = qMax(3, 2 + qCeil(targetCenterHeight / qreal(sourceCenterHeight)));
936 xTarget.resize(columns + 1);
937 yTarget.resize(rows + 1);
939 bool oldAA = painter->testRenderHint(QPainter::Antialiasing);
940 if (painter->paintEngine()->type() != QPaintEngine::OpenGL
941 && painter->paintEngine()->type() != QPaintEngine::OpenGL2
942 && oldAA && painter->combinedTransform().type() != QTransform::TxNone) {
943 painter->setRenderHint(QPainter::Antialiasing,
false);
946 xTarget[0] = targetRect.left();
947 xTarget[1] = targetCenterLeft;
948 xTarget[columns - 1] = targetCenterRight;
949 xTarget[columns] = targetRect.left() + targetRect.width();
951 yTarget[0] = targetRect.top();
952 yTarget[1] = targetCenterTop;
953 yTarget[rows - 1] = targetCenterBottom;
954 yTarget[rows] = targetRect.top() + targetRect.height();
956 qreal dx = targetCenterWidth;
957 qreal dy = targetCenterHeight;
959 switch (rules.horizontal) {
960 case Qt::StretchTile:
961 dx = targetCenterWidth;
964 dx = sourceCenterWidth;
967 dx = targetCenterWidth / qreal(columns - 2);
971 for (
int i = 2; i < columns - 1; ++i)
972 xTarget[i] = xTarget[i - 1] + dx;
974 switch (rules.vertical) {
975 case Qt::StretchTile:
976 dy = targetCenterHeight;
979 dy = sourceCenterHeight;
982 dy = targetCenterHeight / qreal(rows - 2);
986 for (
int i = 2; i < rows - 1; ++i)
987 yTarget[i] = yTarget[i - 1] + dy;
990 if (targetMargins.top() > 0 && targetMargins.left() > 0 && sourceMargins.top() > 0 && sourceMargins.left() > 0) {
991 d.x = (0.5 * (xTarget[1] + xTarget[0]));
992 d.y = (0.5 * (yTarget[1] + yTarget[0]));
993 d.sourceLeft = sourceRect.left();
994 d.sourceTop = sourceRect.top();
995 d.width = sourceMargins.left();
996 d.height = sourceMargins.top();
997 d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width;
998 d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height;
1000 opaqueData.append(d);
1002 translucentData.append(d);
1004 if (targetMargins.top() > 0 && targetMargins.right() > 0 && sourceMargins.top() > 0 && sourceMargins.right() > 0) {
1005 d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1]));
1006 d.y = (0.5 * (yTarget[1] + yTarget[0]));
1007 d.sourceLeft = sourceCenterRight;
1008 d.sourceTop = sourceRect.top();
1009 d.width = sourceMargins.right();
1010 d.height = sourceMargins.top();
1011 d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width;
1012 d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height;
1014 opaqueData.append(d);
1016 translucentData.append(d);
1018 if (targetMargins.bottom() > 0 && targetMargins.left() > 0 && sourceMargins.bottom() > 0 && sourceMargins.left() > 0) {
1019 d.x = (0.5 * (xTarget[1] + xTarget[0]));
1020 d.y =(0.5 * (yTarget[rows] + yTarget[rows - 1]));
1021 d.sourceLeft = sourceRect.left();
1022 d.sourceTop = sourceCenterBottom;
1023 d.width = sourceMargins.left();
1024 d.height = sourceMargins.bottom();
1025 d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width;
1026 d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height;
1028 opaqueData.append(d);
1030 translucentData.append(d);
1032 if (targetMargins.bottom() > 0 && targetMargins.right() > 0 && sourceMargins.bottom() > 0 && sourceMargins.right() > 0) {
1033 d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1]));
1034 d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1]));
1035 d.sourceLeft = sourceCenterRight;
1036 d.sourceTop = sourceCenterBottom;
1037 d.width = sourceMargins.right();
1038 d.height = sourceMargins.bottom();
1039 d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width;
1040 d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height;
1042 opaqueData.append(d);
1044 translucentData.append(d);
1048 if (targetCenterWidth > 0 && sourceCenterWidth > 0) {
1049 if (targetMargins.top() > 0 && sourceMargins.top() > 0) {
1051 d.sourceLeft = sourceCenterLeft;
1052 d.sourceTop = sourceRect.top();
1053 d.width = sourceCenterWidth;
1054 d.height = sourceMargins.top();
1055 d.y = (0.5 * (yTarget[1] + yTarget[0]));
1056 d.scaleX = dx / d.width;
1057 d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height;
1058 for (
int i = 1; i < columns - 1; ++i) {
1059 d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));
1062 if (rules.horizontal == Qt::RepeatTile)
1063 data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
1065 if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) {
1067 d.sourceLeft = sourceCenterLeft;
1068 d.sourceTop = sourceCenterBottom;
1069 d.width = sourceCenterWidth;
1070 d.height = sourceMargins.bottom();
1071 d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1]));
1072 d.scaleX = dx / d.width;
1073 d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height;
1074 for (
int i = 1; i < columns - 1; ++i) {
1075 d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));
1078 if (rules.horizontal == Qt::RepeatTile)
1079 data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
1084 if (targetCenterHeight > 0 && sourceCenterHeight > 0) {
1085 if (targetMargins.left() > 0 && sourceMargins.left() > 0) {
1087 d.sourceLeft = sourceRect.left();
1088 d.sourceTop = sourceCenterTop;
1089 d.width = sourceMargins.left();
1090 d.height = sourceCenterHeight;
1091 d.x = (0.5 * (xTarget[1] + xTarget[0]));
1092 d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width;
1093 d.scaleY = dy / d.height;
1094 for (
int i = 1; i < rows - 1; ++i) {
1095 d.y = (0.5 * (yTarget[i + 1] + yTarget[i]));
1098 if (rules.vertical == Qt::RepeatTile)
1099 data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
1101 if (targetMargins.right() > 0 && sourceMargins.right() > 0) {
1103 d.sourceLeft = sourceCenterRight;
1104 d.sourceTop = sourceCenterTop;
1105 d.width = sourceMargins.right();
1106 d.height = sourceCenterHeight;
1107 d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1]));
1108 d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width;
1109 d.scaleY = dy / d.height;
1110 for (
int i = 1; i < rows - 1; ++i) {
1111 d.y = (0.5 * (yTarget[i + 1] + yTarget[i]));
1114 if (rules.vertical == Qt::RepeatTile)
1115 data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
1120 if (targetCenterWidth > 0 && targetCenterHeight > 0 && sourceCenterWidth > 0 && sourceCenterHeight > 0) {
1122 d.sourceLeft = sourceCenterLeft;
1123 d.sourceTop = sourceCenterTop;
1124 d.width = sourceCenterWidth;
1125 d.height = sourceCenterHeight;
1126 d.scaleX = dx / d.width;
1127 d.scaleY = dy / d.height;
1129 qreal repeatWidth = (xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX;
1130 qreal repeatHeight = (yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY;
1132 for (
int j = 1; j < rows - 1; ++j) {
1133 d.y = (0.5 * (yTarget[j + 1] + yTarget[j]));
1134 for (
int i = 1; i < columns - 1; ++i) {
1135 d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));
1138 if (rules.horizontal == Qt::RepeatTile)
1139 data[data.size() - 1].width = repeatWidth;
1141 if (rules.vertical == Qt::RepeatTile) {
1142 for (
int i = 1; i < columns - 1; ++i)
1143 data[data.size() - i].height = repeatHeight;
1147 if (opaqueData.size())
1148 painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint);
1149 if (translucentData.size())
1150 painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap);
1153 painter->setRenderHint(QPainter::Antialiasing,
true);
\inmodule QtCore\reentrant
static void qDrawWinShades(QPainter *p, int x, int y, int w, int h, const QColor &c1, const QColor &c2, const QColor &c3, const QColor &c4, const QBrush *fill)
QVarLengthArray< QPainter::PixmapFragment, 16 > QPixmapFragmentsArray
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, const QPalette &pal, bool sunken=true, int lineWidth=1, int midLineWidth=0)
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken=true, int lineWidth=1, int midLineWidth=0)
Q_WIDGETS_EXPORT void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h, qreal rx, qreal ry, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
The QTileRules class provides the rules used to draw a pixmap or image split into nine segments.