67 #include <private/qfontengine_p.h> 68 #include <private/qpaintengine_p.h> 69 #include <private/qemulationpaintengine_p.h> 70 #include <private/qpainterpath_p.h> 71 #include <private/qtextengine_p.h> 72 #include <private/qwidget_p.h> 73 #include <private/qpaintengine_raster_p.h> 74 #include <private/qmath_p.h> 75 #include <private/qstatictext_p.h> 76 #include <private/qglyphrun_p.h> 77 #include <private/qstylehelper_p.h> 78 #include <private/qrawfont_p.h> 82 #define QGradient_StretchToDevice 0x10000000 83 #define QPaintEngine_OpaqueBackground 0x40000000 87 bool qt_show_painter_debug_output =
true;
94 int tabstops,
int* tabarray,
int tabarraylen,
98 QTextItem::RenderFlags flags,
qreal width,
108 switch (brush.
style()) {
173 qWarning(
"QPainter: It is not safe to use %s outside the GUI thread", what);
188 bool doEmulation =
false;
254 if (!widget->d_func()->redirectDev)
257 QPainter *sp = widget->d_func()->sharedPainter();
269 qWarning(
"QPainter::begin: Widget painting can only begin as a result of a paintEvent");
298 widget->d_func()->redirected(&offset);
338 }
else if (!original) {
358 if (qt_show_painter_debug_output) {
359 printf(
"QPainter::drawHelper\n");
366 QPaintEngine::PaintEngineFeatures gradientStretch =
370 const bool mustEmulateObjectBoundingModeGradients =
extended 375 && !mustEmulateObjectBoundingModeGradients) {
385 qreal strokeOffsetX = 0, strokeOffsetY = 0;
416 absPathRect = pathBounds.
adjusted(-strokeOffsetX, -strokeOffsetY, strokeOffsetX, strokeOffsetY)
420 if (q->hasClipping()) {
421 bool hasPerspectiveTransform =
false;
425 hasPerspectiveTransform =
true;
430 if (!hasPerspectiveTransform) {
437 bool old_txinv =
txinv;
455 if (absPathRect.width() <= 0 || absPathRect.height() <= 0)
466 p.
translate(-absPathRect.x(), -absPathRect.y());
481 static bool do_fallback_overlay =
qgetenv(
"QT_PAINT_FALLBACK_OVERLAY").
size() > 0;
482 if (do_fallback_overlay) {
507 QRectF(0, 0, absPathRect.width(), absPathRect.height()),
537 boundingRect.
x(), boundingRect.
y());
554 bool changedPen =
false;
555 bool changedBrush =
false;
556 bool needsFill =
false;
574 const qreal isw = 1.0 / sw;
575 const qreal ish = 1.0 / sh;
603 q->setBrush(pen.
brush());
615 const qreal isw = 1.0 / sw;
616 const qreal ish = 1.0 / sh;
637 }
else if (changedPen) {
645 }
else if (needsFill) {
692 bool linearGradient =
false;
693 bool radialGradient =
false;
694 bool extendedRadialGradient =
false;
695 bool conicalGradient =
false;
696 bool patternBrush =
false;
698 bool complexXform =
false;
718 && !penBrush.isOpaque())
720 && (brushStyle < Qt::LinearGradientPattern && s->brush.
color().
alpha() != 255)
736 bool penTextureAlpha =
false;
739 ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha()
740 : penBrush.textureImage().hasAlphaChannel();
741 bool brushTextureAlpha =
false;
765 qDebug(
"QPainterPrivate::updateEmulationSpecifier, state=%p\n" 767 " - linearGradient: %d\n" 768 " - radialGradient: %d\n" 769 " - conicalGradient: %d\n" 770 " - patternBrush: %d\n" 795 const bool patternXform = patternBrush && (xform || brushXform || penXform);
851 bool gradientStretch =
false;
852 bool objectBoundingMode =
false;
853 if (linearGradient || conicalGradient || radialGradient) {
908 newState->
dirtyFlags |= QPaintEngine::DirtyFlags(static_cast<QPainterState *>(
engine->
state)->changeFlags);
935 if (setNonCosmeticPen) {
947 newState->
pen = oldPen;
1533 if (
isActive() &&
d->engine->d_func()->currentClipWidget)
1534 return d->engine->d_func()->currentClipWidget;
1535 return d->original_device;
1560 Q_ASSERT_X(widget,
"QPainter::initFrom(const QWidget *widget)",
"Widget cannot be 0");
1563 qWarning(
"QPainter::initFrom: Painter not active, aborted");
1571 d->state->font =
d->state->deviceFont;
1573 d->extended->penChanged();
1574 }
else if (
d->engine) {
1592 #ifdef QT_DEBUG_DRAW 1593 if (qt_show_painter_debug_output)
1594 printf(
"QPainter::save()\n");
1598 qWarning(
"QPainter::save: Painter not active");
1603 d->state =
d->extended->createState(
d->states.back());
1604 d->extended->setState(
d->state);
1606 d->updateState(
d->state);
1608 d->engine->state =
d->state;
1610 d->states.push_back(
d->state);
1622 #ifdef QT_DEBUG_DRAW 1623 if (qt_show_painter_debug_output)
1624 printf(
"QPainter::restore()\n");
1627 if (
d->states.size()<=1) {
1628 qWarning(
"QPainter::restore: Unbalanced save/restore");
1630 }
else if (!
d->engine) {
1631 qWarning(
"QPainter::restore: Painter not active");
1636 d->states.pop_back();
1637 d->state =
d->states.back();
1641 d->checkEmulation();
1642 d->extended->setState(
d->state);
1649 if (!
d->state->clipInfo.isEmpty()
1655 d->engine->updateState(*tmp);
1657 for (
int i=0; i<
d->state->clipInfo.size(); ++i) {
1660 tmp->
matrix *=
d->state->redirectionMatrix;
1672 d->engine->updateState(*tmp);
1682 d->updateState(
d->state);
1728 qWarning(
"QPainter::begin: A paint device can only be painted by one painter at a time.");
1733 qWarning(
"QPainter::begin: Painter already active");
1742 d->helper_device = pd;
1743 d->original_device = pd;
1746 QPoint redirectionOffset;
1755 rpd = static_cast<QWidget *>(pd)->d_func()->redirected(&redirectionOffset);
1763 #ifdef QT_DEBUG_DRAW 1764 if (qt_show_painter_debug_output)
1765 printf(
"QPainter::begin(), device=%p, type=%d\n", pd, pd->
devType());
1769 static_cast<QPixmap *>(pd)->detach();
1771 static_cast<QImage *>(pd)->detach();
1776 qWarning(
"QPainter::begin: Paint device returned engine == 0, type: %d", pd->
devType());
1782 d->extended =
d->engine->isExtended() ?
static_cast<QPaintEngineEx *
>(
d->engine) : 0;
1783 if (
d->emulationEngine)
1784 d->emulationEngine->real_engine =
d->extended;
1789 d->state->painter =
this;
1790 d->states.push_back(
d->state);
1792 d->state->redirectionMatrix.translate(-redirectionOffset.
x(), -redirectionOffset.
y());
1797 d->extended->setState(
d->state);
1799 d->engine->state =
d->state;
1810 && !paintOutsidePaintEvent && !inPaintEvent) {
1811 qWarning(
"QPainter::begin: Widget painting can only begin as a " 1812 "result of a paintEvent");
1818 if (!inPaintEvent && paintOutsidePaintEvent && !widget->
internalWinId()
1821 d->state->redirectionMatrix.translate(offset.
x(), offset.
y());
1830 qWarning(
"QPainter::begin: Cannot paint on a null pixmap");
1835 if (pm->
depth() == 1) {
1846 qWarning(
"QPainter::begin: Cannot paint on a null image");
1851 qWarning(
"QPainter::begin: Cannot paint on an image with the QImage::Format_Indexed8 format");
1855 if (img->
depth() == 1) {
1864 if (
d->state->ww == 0)
1865 d->state->ww =
d->state->wh =
d->state->vw =
d->state->vh = 1024;
1867 d->engine->setPaintDevice(pd);
1869 bool begun =
d->engine->begin(pd);
1871 qWarning(
"QPainter::begin(): Returned false");
1872 if (
d->engine->isActive()) {
1879 d->engine->setActive(begun);
1890 d->state->deviceFont =
d->state->font =
QFont(
d->state->deviceFont,
device());
1893 QRect systemRect =
d->engine->systemRect();
1895 d->state->ww =
d->state->vw = systemRect.
width();
1896 d->state->wh =
d->state->vh = systemRect.
height();
1902 const QPoint coordinateOffset =
d->engine->coordinateOffset();
1903 d->state->redirectionMatrix.translate(-coordinateOffset.
x(), -coordinateOffset.
y());
1907 if (!
d->state->redirectionMatrix.isIdentity())
1912 ++
d->device->painters;
1914 d->state->emulationSpecifier = 0;
1931 #ifdef QT_DEBUG_DRAW 1932 if (qt_show_painter_debug_output)
1933 printf(
"QPainter::end()\n");
1938 qWarning(
"QPainter::end: Painter not active, aborted");
1943 if (
d->refcount > 1) {
1944 d->detachPainterPrivate(
this);
1950 if (
d->engine->isActive()) {
1951 ended =
d->engine->end();
1954 --
d->device->painters;
1955 if (
d->device->painters == 0) {
1956 d->engine->setPaintDevice(0);
1957 d->engine->setActive(
false);
1961 if (
d->states.size() > 1) {
1962 qWarning(
"QPainter::end: Painter ended with %d saved states",
1966 if (
d->engine->autoDestruct()) {
1970 if (
d->emulationEngine) {
1971 delete d->emulationEngine;
1972 d->emulationEngine = 0;
2036 qWarning(
"QPainter::beginNativePainting: Painter not active");
2041 d->extended->beginNativePainting();
2060 qWarning(
"QPainter::beginNativePainting: Painter not active");
2065 d->extended->endNativePainting();
2067 d->engine->syncState();
2081 qWarning(
"QPainter::fontMetrics: Painter not active");
2099 qWarning(
"QPainter::fontInfo: Painter not active");
2119 qWarning(
"QPainter::opacity: Painter not active");
2122 return d->state->opacity;
2144 qWarning(
"QPainter::setOpacity: Painter not active");
2150 if (opacity ==
d->state->opacity)
2156 d->extended->opacityChanged();
2172 qWarning(
"QPainter::brushOrigin: Painter not active");
2201 #ifdef QT_DEBUG_DRAW 2202 if (qt_show_painter_debug_output)
2203 printf(
"QPainter::setBrushOrigin(), (%.2f,%.2f)\n", p.
x(), p.
y());
2207 qWarning(
"QPainter::setBrushOrigin: Painter not active");
2211 d->state->brushOrigin = p;
2214 d->extended->brushOriginChanged();
2426 qWarning(
"QPainter::setCompositionMode: Painter not active");
2429 if (
d->state->composition_mode == mode)
2432 d->state->composition_mode = mode;
2433 d->extended->compositionModeChanged();
2439 qWarning(
"QPainter::setCompositionMode: " 2440 "Raster operation modes not supported on device");
2445 qWarning(
"QPainter::setCompositionMode: " 2446 "Blend modes not supported on device");
2451 qWarning(
"QPainter::setCompositionMode: " 2452 "PorterDuff modes not supported on device");
2457 d->state->composition_mode = mode;
2470 qWarning(
"QPainter::compositionMode: Painter not active");
2473 return d->state->composition_mode;
2486 qWarning(
"QPainter::background: Painter not active");
2487 return d->fakeState()->brush;
2489 return d->state->bgBrush;
2503 qWarning(
"QPainter::hasClipping: Painter not active");
2506 return d->state->clipEnabled &&
d->state->clipOperation !=
Qt::NoClip;
2520 #ifdef QT_DEBUG_DRAW 2521 if (qt_show_painter_debug_output)
2522 printf(
"QPainter::setClipping(), enable=%s, was=%s\n",
2523 enable ?
"on" :
"off",
2527 qWarning(
"QPainter::setClipping: Painter not active, state will be reset by begin");
2536 && (
d->state->clipInfo.isEmpty() ||
d->state->clipInfo.last().operation ==
Qt::NoClip))
2538 d->state->clipEnabled = enable;
2541 d->extended->clipEnabledChanged();
2546 d->updateState(
d->state);
2566 qWarning(
"QPainter::clipRegion: Painter not active");
2571 bool lastWasNothing =
true;
2577 for (
int i=0; i<
d->state->clipInfo.size(); ++i) {
2583 if (lastWasNothing) {
2585 lastWasNothing =
false;
2593 lastWasNothing =
true;
2602 if (lastWasNothing) {
2603 region =
QRegion((info.
path * matrix).toFillPolygon().toPolygon(),
2605 lastWasNothing =
false;
2609 region &=
QRegion((info.
path * matrix).toFillPolygon().toPolygon(),
2612 region |=
QRegion((info.
path * matrix).toFillPolygon().toPolygon(),
2615 lastWasNothing =
true;
2618 region =
QRegion((info.
path * matrix).toFillPolygon().toPolygon(),
2626 if (lastWasNothing) {
2628 lastWasNothing =
false;
2640 lastWasNothing =
true;
2650 if (lastWasNothing) {
2652 lastWasNothing =
false;
2664 lastWasNothing =
true;
2697 qWarning(
"QPainter::clipPath: Painter not active");
2702 if (
d->state->clipInfo.size() == 0) {
2711 if (
d->state->clipInfo.size() == 1
2714 return d->state->clipInfo.at(0).path *
matrix;
2716 }
else if (
d->state->clipInfo.size() == 1
2720 path.
addRect(
d->state->clipInfo.at(0).rect);
2746 qWarning(
"QPainter::clipBoundingRect: Painter not active");
2754 for (
int i=0; i<
d->state->clipInfo.size(); ++i) {
2783 return d->invMatrix.mapRect(bounds);
2810 qWarning(
"QPainter::setClipRect: Painter not active");
2815 qreal pts[] = { rect.
x(), rect.
y(),
2820 d->state->clipEnabled =
true;
2821 d->extended->clip(vp, op);
2823 d->state->clipInfo.clear();
2825 d->state->clipOperation = op;
2863 qWarning(
"QPainter::setClipRect: Painter not active");
2871 d->state->clipEnabled =
true;
2872 d->extended->clip(rect, op);
2874 d->state->clipInfo.clear();
2876 d->state->clipOperation = op;
2883 d->state->clipRegion = rect;
2884 d->state->clipOperation = op;
2886 d->state->clipInfo.clear();
2888 d->state->clipEnabled =
true;
2890 d->updateState(
d->state);
2920 #ifdef QT_DEBUG_DRAW 2922 if (qt_show_painter_debug_output)
2923 printf(
"QPainter::setClipRegion(), size=%d, [%d,%d,%d,%d]\n",
2927 qWarning(
"QPainter::setClipRegion: Painter not active");
2935 d->state->clipEnabled =
true;
2936 d->extended->clip(r, op);
2938 d->state->clipInfo.clear();
2940 d->state->clipOperation = op;
2947 d->state->clipRegion = r;
2948 d->state->clipOperation = op;
2950 d->state->clipInfo.clear();
2952 d->state->clipEnabled =
true;
2954 d->updateState(
d->state);
3028 qWarning(
"QPainter::worldMatrix: Painter not active");
3029 return d->fakeState()->transform.toAffine();
3031 return d->state->worldMatrix.toAffine();
3114 qWarning(
"QPainter::deviceMatrix: Painter not active");
3115 return d->fakeState()->transform.toAffine();
3117 return d->state->matrix.toAffine();
3160 #ifdef QT_DEBUG_DRAW 3161 if (qt_show_painter_debug_output)
3162 printf(
"QPainter::setMatrixEnabled(), enable=%d\n", enable);
3166 qWarning(
"QPainter::setMatrixEnabled: Painter not active");
3169 if (enable ==
d->state->WxF)
3172 d->state->WxF = enable;
3192 qWarning(
"QPainter::worldMatrixEnabled: Painter not active");
3195 return d->state->WxF;
3236 #ifdef QT_DEBUG_DRAW 3237 if (qt_show_painter_debug_output)
3238 printf(
"QPainter::scale(), sx=%f, sy=%f\n", sx, sy);
3242 qWarning(
"QPainter::scale: Painter not active");
3246 d->state->worldMatrix.scale(sx,sy);
3247 d->state->WxF =
true;
3260 #ifdef QT_DEBUG_DRAW 3261 if (qt_show_painter_debug_output)
3262 printf(
"QPainter::shear(), sh=%f, sv=%f\n", sh, sv);
3266 qWarning(
"QPainter::shear: Painter not active");
3270 d->state->worldMatrix.shear(sh, sv);
3271 d->state->WxF =
true;
3289 #ifdef QT_DEBUG_DRAW 3290 if (qt_show_painter_debug_output)
3291 printf(
"QPainter::rotate(), angle=%f\n", a);
3295 qWarning(
"QPainter::rotate: Painter not active");
3299 d->state->worldMatrix.rotate(a);
3300 d->state->WxF =
true;
3315 #ifdef QT_DEBUG_DRAW 3316 if (qt_show_painter_debug_output)
3317 printf(
"QPainter::translate(), dx=%f, dy=%f\n", dx, dy);
3321 qWarning(
"QPainter::translate: Painter not active");
3325 d->state->worldMatrix.translate(dx, dy);
3326 d->state->WxF =
true;
3367 #ifdef QT_DEBUG_DRAW 3368 if (qt_show_painter_debug_output) {
3370 printf(
"QPainter::setClipPath(), size=%d, op=%d, bounds=[%.2f,%.2f,%.2f,%.2f]\n",
3377 qWarning(
"QPainter::setClipPath: Painter not active");
3385 d->state->clipEnabled =
true;
3386 d->extended->clip(path, op);
3388 d->state->clipInfo.clear();
3390 d->state->clipOperation = op;
3397 d->state->clipPath = path;
3398 d->state->clipOperation = op;
3400 d->state->clipInfo.clear();
3402 d->state->clipEnabled =
true;
3404 d->updateState(
d->state);
3418 qWarning(
"QPainter::strokePath: Painter not active");
3433 QBrush oldBrush =
d->state->brush;
3434 QPen oldPen =
d->state->pen;
3461 qWarning(
"QPainter::fillPath: Painter not active");
3476 QBrush oldBrush =
d->state->brush;
3477 QPen oldPen =
d->state->pen;
3504 #ifdef QT_DEBUG_DRAW 3506 if (qt_show_painter_debug_output)
3507 printf(
"QPainter::drawPath(), size=%d, [%.2f,%.2f,%.2f,%.2f]\n",
3509 pathBounds.
x(), pathBounds.
y(), pathBounds.
width(), pathBounds.
height());
3515 qWarning(
"QPainter::drawPath: Painter not active");
3520 d->extended->drawPath(path);
3523 d->updateState(
d->state);
3526 d->engine->drawPath(path);
3528 d->draw_helper(path);
3643 #ifdef QT_DEBUG_DRAW 3644 if (qt_show_painter_debug_output)
3645 printf(
"QPainter::drawRects(), count=%d\n", rectCount);
3650 qWarning(
"QPainter::drawRects: Painter not active");
3658 d->extended->drawRects(rects, rectCount);
3662 d->updateState(
d->state);
3664 if (!
d->state->emulationSpecifier) {
3665 d->engine->drawRects(rects, rectCount);
3671 for (
int i=0; i<rectCount; ++i) {
3672 QRectF r(rects[i].x() +
d->state->matrix.dx(),
3673 rects[i].
y() +
d->state->matrix.dy(),
3676 d->engine->drawRects(&r, 1);
3679 if (
d->state->brushNeedsResolving() ||
d->state->penNeedsResolving()) {
3680 for (
int i=0; i<rectCount; ++i) {
3687 for (
int i=0; i<rectCount; ++i)
3703 #ifdef QT_DEBUG_DRAW 3704 if (qt_show_painter_debug_output)
3705 printf(
"QPainter::drawRects(), count=%d\n", rectCount);
3710 qWarning(
"QPainter::drawRects: Painter not active");
3718 d->extended->drawRects(rects, rectCount);
3722 d->updateState(
d->state);
3724 if (!
d->state->emulationSpecifier) {
3725 d->engine->drawRects(rects, rectCount);
3731 for (
int i=0; i<rectCount; ++i) {
3732 QRectF r(rects[i].x() +
d->state->matrix.dx(),
3733 rects[i].
y() +
d->state->matrix.dy(),
3737 d->engine->drawRects(&r, 1);
3740 if (
d->state->brushNeedsResolving() ||
d->state->penNeedsResolving()) {
3741 for (
int i=0; i<rectCount; ++i) {
3748 for (
int i=0; i<rectCount; ++i)
3818 #ifdef QT_DEBUG_DRAW 3819 if (qt_show_painter_debug_output)
3820 printf(
"QPainter::drawPoints(), count=%d\n", pointCount);
3825 qWarning(
"QPainter::drawPoints: Painter not active");
3829 if (pointCount <= 0)
3833 d->extended->drawPoints(points, pointCount);
3837 d->updateState(
d->state);
3839 if (!
d->state->emulationSpecifier) {
3840 d->engine->drawPoints(points, pointCount);
3847 for (
int i=0; i<pointCount; ++i) {
3848 QPointF pt(points[i].x() +
d->state->matrix.dx(),
3849 points[i].
y() +
d->state->matrix.dy());
3850 d->engine->drawPoints(&pt, 1);
3861 for (
int i=0; i<pointCount; ++i) {
3862 path.
moveTo(points[i].x(), points[i].y());
3863 path.
lineTo(points[i].x() + 0.0001, points[i].y());
3883 #ifdef QT_DEBUG_DRAW 3884 if (qt_show_painter_debug_output)
3885 printf(
"QPainter::drawPoints(), count=%d\n", pointCount);
3890 qWarning(
"QPainter::drawPoints: Painter not active");
3894 if (pointCount <= 0)
3898 d->extended->drawPoints(points, pointCount);
3902 d->updateState(
d->state);
3904 if (!
d->state->emulationSpecifier) {
3905 d->engine->drawPoints(points, pointCount);
3912 for (
int i=0; i<pointCount; ++i) {
3913 QPointF pt(points[i].x() +
d->state->matrix.dx(),
3914 points[i].
y() +
d->state->matrix.dy());
3915 d->engine->drawPoints(&pt, 1);
3926 for (
int i=0; i<pointCount; ++i) {
3927 path.
moveTo(points[i].x(), points[i].y());
3928 path.
lineTo(points[i].x() + 0.0001, points[i].y());
4000 #ifdef QT_DEBUG_DRAW 4001 if (qt_show_painter_debug_output)
4002 printf(
"QPainter::setBackgroundMode(), mode=%d\n", mode);
4007 qWarning(
"QPainter::setBackgroundMode: Painter not active");
4010 if (
d->state->bgMode == mode)
4013 d->state->bgMode = mode;
4015 d->checkEmulation();
4030 qWarning(
"QPainter::backgroundMode: Painter not active");
4033 return d->state->bgMode;
4049 #ifdef QT_DEBUG_DRAW 4050 if (qt_show_painter_debug_output)
4051 printf(
"QPainter::setPen(), color=%04x\n", color.
rgb());
4055 qWarning(
"QPainter::setPen: Painter not active");
4060 &&
d->state->pen.widthF() == 0
4061 &&
d->state->pen.isSolid()
4062 &&
d->state->pen.color() == color)
4067 d->state->pen =
pen;
4069 d->extended->penChanged();
4086 #ifdef QT_DEBUG_DRAW 4087 if (qt_show_painter_debug_output)
4088 printf(
"QPainter::setPen(), color=%04x, (brushStyle=%d) style=%d, cap=%d, join=%d\n",
4093 qWarning(
"QPainter::setPen: Painter not active");
4097 if (
d->state->pen == pen)
4100 d->state->pen =
pen;
4103 d->checkEmulation();
4104 d->extended->penChanged();
4125 qWarning(
"QPainter::setPen: Painter not active");
4129 if (
d->state->pen.style() == style
4130 && (style ==
Qt::NoPen || (
d->state->pen.widthF() == 0
4131 &&
d->state->pen.isSolid()
4140 d->extended->penChanged();
4156 qWarning(
"QPainter::pen: Painter not active");
4157 return d->fakeState()->pen;
4159 return d->state->pen;
4173 #ifdef QT_DEBUG_DRAW 4174 if (qt_show_painter_debug_output)
4175 printf(
"QPainter::setBrush(), color=%04x, style=%d\n", brush.
color().
rgb(), brush.
style());
4179 qWarning(
"QPainter::setBrush: Painter not active");
4183 if (
d->state->brush.d == brush.
d)
4188 d->checkEmulation();
4189 d->extended->brushChanged();
4212 qWarning(
"QPainter::setBrush: Painter not active");
4215 if (
d->state->brush.style() == style &&
4221 d->extended->brushChanged();
4236 qWarning(
"QPainter::brush: Painter not active");
4237 return d->fakeState()->brush;
4239 return d->state->brush;
4260 #ifdef QT_DEBUG_DRAW 4261 if (qt_show_painter_debug_output)
4262 printf(
"QPainter::setBackground(), color=%04x, style=%d\n", bg.
color().
rgb(), bg.
style());
4267 qWarning(
"QPainter::setBackground: Painter not active");
4270 d->state->bgBrush = bg;
4292 #ifdef QT_DEBUG_DRAW 4293 if (qt_show_painter_debug_output)
4298 qWarning(
"QPainter::setFont: Painter not active");
4316 qWarning(
"QPainter::font: Painter not active");
4317 return d->fakeState()->font;
4319 return d->state->font;
4350 #ifdef QT_DEBUG_DRAW 4351 if (qt_show_painter_debug_output)
4352 printf(
"QPainter::drawRoundedRect(), [%.2f,%.2f,%.2f,%.2f]\n", rect.
x(), rect.
y(), rect.
width(), rect.
height());
4359 if (xRadius <= 0 || yRadius <= 0) {
4365 d->extended->drawRoundedRect(rect, xRadius, yRadius, mode);
4466 #ifdef QT_DEBUG_DRAW 4467 if (qt_show_painter_debug_output)
4468 printf(
"QPainter::drawEllipse(), [%.2f,%.2f,%.2f,%.2f]\n", r.
x(), r.
y(), r.
width(), r.
height());
4478 d->extended->drawEllipse(rect);
4482 d->updateState(
d->state);
4483 if (
d->state->emulationSpecifier) {
4486 rect.translate(
QPointF(
d->state->matrix.dx(),
d->state->matrix.dy()));
4495 d->engine->drawEllipse(rect);
4510 #ifdef QT_DEBUG_DRAW 4511 if (qt_show_painter_debug_output)
4512 printf(
"QPainter::drawEllipse(), [%d,%d,%d,%d]\n", r.
x(), r.
y(), r.
width(), r.
height());
4522 d->extended->drawEllipse(rect);
4526 d->updateState(
d->state);
4528 if (
d->state->emulationSpecifier) {
4540 d->engine->drawEllipse(rect);
4604 #ifdef QT_DEBUG_DRAW 4605 if (qt_show_painter_debug_output)
4606 printf(
"QPainter::drawArc(), [%.2f,%.2f,%.2f,%.2f], angle=%d, sweep=%d\n",
4672 #ifdef QT_DEBUG_DRAW 4673 if (qt_show_painter_debug_output)
4674 printf(
"QPainter::drawPie(), [%.2f,%.2f,%.2f,%.2f], angle=%d, sweep=%d\n",
4686 if (a < 0) a += (360*16);
4746 #ifdef QT_DEBUG_DRAW 4747 if (qt_show_painter_debug_output)
4748 printf(
"QPainter::drawChord(), [%.2f,%.2f,%.2f,%.2f], angle=%d, sweep=%d\n",
4813 void QPainter::drawLineSegments(
const QPolygon &
a,
int index,
int nlines)
4815 #ifdef QT_DEBUG_DRAW 4816 if (qt_show_painter_debug_output)
4817 printf(
"QPainter::drawLineSegments(), count=%d\n", a.
size()/2);
4828 if (nlines < 1 ||
index < 0)
4836 d->extended->drawLines(lines.
data(), lines.
size());
4840 d->updateState(
d->state);
4843 if (
d->state->emulationSpecifier) {
4846 QPointF offset(
d->state->matrix.dx(),
d->state->matrix.dy());
4848 lines <<
QLineF(a.
at(i) + offset, a.
at(i+1) + offset);
4851 for (
int i=
index; i<
index + nlines*2; i+=2) {
4863 d->engine->drawLines(lines.
data(), lines.
size());
4865 #endif // QT3_SUPPORT 4875 #ifdef QT_DEBUG_DRAW 4876 if (qt_show_painter_debug_output)
4877 printf(
"QPainter::drawLines(), line count=%d\n", lineCount);
4882 if (!
d->engine || lineCount < 1)
4886 d->extended->drawLines(lines, lineCount);
4890 d->updateState(
d->state);
4894 if (lineEmulation) {
4897 for (
int i = 0; i < lineCount; ++i) {
4899 line.
translate(
d->state->matrix.dx(),
d->state->matrix.dy());
4900 d->engine->drawLines(&line, 1);
4904 for (
int i = 0; i < lineCount; ++i) {
4905 linePath.
moveTo(lines[i].p1());
4906 linePath.
lineTo(lines[i].p2());
4912 d->engine->drawLines(lines, lineCount);
4924 #ifdef QT_DEBUG_DRAW 4925 if (qt_show_painter_debug_output)
4926 printf(
"QPainter::drawLine(), line count=%d\n", lineCount);
4931 if (!
d->engine || lineCount < 1)
4935 d->extended->drawLines(lines, lineCount);
4939 d->updateState(
d->state);
4943 if (lineEmulation) {
4946 for (
int i = 0; i < lineCount; ++i) {
4948 line.
translate(
d->state->matrix.dx(),
d->state->matrix.dy());
4949 d->engine->drawLines(&line, 1);
4953 for (
int i = 0; i < lineCount; ++i) {
4954 linePath.
moveTo(lines[i].p1());
4955 linePath.
lineTo(lines[i].p2());
4961 d->engine->drawLines(lines, lineCount);
5057 #ifdef QT_DEBUG_DRAW 5058 if (qt_show_painter_debug_output)
5059 printf(
"QPainter::drawPolyline(), count=%d\n", pointCount);
5063 if (!
d->engine || pointCount < 2)
5071 d->updateState(
d->state);
5075 if (lineEmulation) {
5081 for (
int i=1; i<pointCount; ++i)
5082 polylinePath.
lineTo(points[i]);
5101 #ifdef QT_DEBUG_DRAW 5102 if (qt_show_painter_debug_output)
5103 printf(
"QPainter::drawPolyline(), count=%d\n", pointCount);
5107 if (!
d->engine || pointCount < 2)
5115 d->updateState(
d->state);
5119 if (lineEmulation) {
5125 for (
int i=1; i<pointCount; ++i)
5126 polylinePath.
lineTo(points[i]);
5207 #ifdef QT_DEBUG_DRAW 5208 if (qt_show_painter_debug_output)
5209 printf(
"QPainter::drawPolygon(), count=%d\n", pointCount);
5214 if (!
d->engine || pointCount < 2)
5222 d->updateState(
d->state);
5224 uint emulationSpecifier =
d->state->emulationSpecifier;
5226 if (emulationSpecifier) {
5228 for (
int i=1; i<pointCount; ++i)
5229 polygonPath.
lineTo(points[i]);
5232 d->draw_helper(polygonPath);
5249 #ifdef QT_DEBUG_DRAW 5250 if (qt_show_painter_debug_output)
5251 printf(
"QPainter::drawPolygon(), count=%d\n", pointCount);
5256 if (!
d->engine || pointCount < 2)
5264 d->updateState(
d->state);
5266 uint emulationSpecifier =
d->state->emulationSpecifier;
5268 if (emulationSpecifier) {
5270 for (
int i=1; i<pointCount; ++i)
5271 polygonPath.
lineTo(points[i]);
5274 d->draw_helper(polygonPath);
5452 #ifdef QT_DEBUG_DRAW 5453 if (qt_show_painter_debug_output)
5454 printf(
"QPainter::drawConvexPolygon(), count=%d\n", pointCount);
5459 if (!
d->engine || pointCount < 2)
5467 d->updateState(
d->state);
5469 uint emulationSpecifier =
d->state->emulationSpecifier;
5471 if (emulationSpecifier) {
5473 for (
int i=1; i<pointCount; ++i)
5474 polygonPath.
lineTo(points[i]);
5477 d->draw_helper(polygonPath);
5486 #ifdef QT_DEBUG_DRAW 5487 if (qt_show_painter_debug_output)
5488 printf(
"QPainter::drawConvexPolygon(), count=%d\n", pointCount);
5493 if (!
d->engine || pointCount < 2)
5501 d->updateState(
d->state);
5503 uint emulationSpecifier =
d->state->emulationSpecifier;
5505 if (emulationSpecifier) {
5507 for (
int i=1; i<pointCount; ++i)
5508 polygonPath.
lineTo(points[i]);
5511 d->draw_helper(polygonPath);
5550 #if defined QT_DEBUG_DRAW 5551 if (qt_show_painter_debug_output)
5552 printf(
"QPainter::drawPixmap(), p=[%.2f,%.2f], pix=[%d,%d]\n",
5559 if (!
d->engine || pm.
isNull())
5567 d->extended->drawPixmap(p, pm);
5585 d->updateState(
d->state);
5612 x +=
d->state->matrix.dx();
5613 y +=
d->state->matrix.dy();
5615 d->engine->drawPixmap(
QRectF(x, y, w, h), pm,
QRectF(0, 0, w, h));
5621 #if defined QT_DEBUG_DRAW 5622 if (qt_show_painter_debug_output)
5623 printf(
"QPainter::drawPixmap(), target=[%.2f,%.2f,%.2f,%.2f], pix=[%d,%d], source=[%.2f,%.2f,%.2f,%.2f]\n",
5630 if (!
d->engine || pm.
isNull())
5647 sw = pm.
width() - sx;
5658 qreal w_ratio = sx * w/sw;
5666 qreal h_ratio = sy * h/sh;
5673 if (sw + sx > pm.
width()) {
5675 qreal w_ratio = delta * w/sw;
5680 if (sh + sy > pm.
height()) {
5682 qreal h_ratio = delta * h/sh;
5687 if (w == 0 || h == 0 || sw <= 0 || sh <= 0)
5691 d->extended->drawPixmap(
QRectF(x, y, w, h), pm,
QRectF(sx, sy, sw, sh));
5699 d->updateState(
d->state);
5724 scale(w / sw, h / sh);
5730 brush =
QBrush(
d->state->pen.color(), pm);
5732 brush =
QBrush(
d->state->pen.color(), pm.
copy(sx, sy, sw, sh));
5741 x +=
d->state->matrix.dx();
5742 y +=
d->state->matrix.dy();
5744 d->engine->drawPixmap(
QRectF(x, y, w, h), pm,
QRectF(sx, sy, sw, sh));
5885 if (!
d->engine || image.
isNull())
5889 d->extended->drawImage(p, image);
5896 int w = image.
width();
5899 d->updateState(
d->state);
5929 x +=
d->state->matrix.dx();
5930 y +=
d->state->matrix.dy();
5937 Qt::ImageConversionFlags flags)
5941 if (!
d->engine || image.
isNull())
5944 qreal x = targetRect.
x();
5945 qreal y = targetRect.
y();
5948 qreal sx = sourceRect.
x();
5949 qreal sy = sourceRect.
y();
5955 sw = image.
width() - sx;
5958 sh = image.
height() - sy;
5966 qreal w_ratio = sx * w/sw;
5974 qreal h_ratio = sy * h/sh;
5981 if (sw + sx > image.
width()) {
5983 qreal w_ratio = delta * w/sw;
5988 if (sh + sy > image.
height()) {
5990 qreal h_ratio = delta * h/sh;
5995 if (w == 0 || h == 0 || sw <= 0 || sh <= 0)
5999 d->extended->drawImage(
QRectF(x, y, w, h), image,
QRectF(sx, sy, sw, sh), flags);
6003 d->updateState(
d->state);
6026 scale(w / sw, h / sh);
6041 x +=
d->state->matrix.dx();
6042 y +=
d->state->matrix.dy();
6045 d->engine->drawImage(
QRectF(x, y, w, h), image,
QRectF(sx, sy, sw, sh), flags);
6048 #if !defined(QT_NO_RAWFONT) 6081 bool supportsTransformations;
6082 if (
d->extended != 0) {
6087 ||
d->state->matrix.isAffine();
6090 for (
int i=0; i<count; ++i) {
6091 QPointF processedPosition = position + glyphPositions[i];
6092 if (!supportsTransformations)
6093 processedPosition =
d->state->transform().map(processedPosition);
6097 d->drawGlyphs(glyphIndexes, fixedPointPositions.
data(), count,
font, glyphRun.
overline(),
6116 for (
int i=0; i<glyphCount; ++i) {
6118 if (i == 0 || leftMost > positions[i].x)
6119 leftMost = positions[i].
x;
6124 if (i == 0 || baseLine < positions[i].y)
6125 baseLine = positions[i].
y;
6128 if (i == 0 || rightMost < positions[i].x + gm.
xoff)
6129 rightMost = positions[i].
x + gm.
xoff;
6132 QFixed width = rightMost - leftMost;
6134 if (extended != 0 && state->matrix.isAffine()) {
6136 staticTextItem.
color = state->pen.color();
6137 staticTextItem.
font = state->font;
6143 extended->drawStaticTextItem(&staticTextItem);
6151 qMemSet(glyphAttributes.
data(), 0, glyphAttributes.
size() *
sizeof(HB_GlyphAttributes));
6163 engine->drawTextItem(
QPointF(0, 0), textItem);
6166 QTextItemInt::RenderFlags flags;
6181 #endif // QT_NO_RAWFONT 6269 if (
font() != staticText_d->
font) {
6276 if (
d->extended == 0 || !
d->state->matrix.isAffine()) {
6277 staticText_d->
paintText(topLeftPosition,
this);
6281 bool supportsTransformations =
d->extended->supportsTransformations(staticText_d->
font.
pixelSize(),
6293 QPointF transformedPosition = topLeftPosition;
6295 transformedPosition = transformedPosition *
d->state->matrix;
6301 qreal m11 =
d->state->matrix.m11();
6302 qreal m12 =
d->state->matrix.m12();
6303 qreal m13 =
d->state->matrix.m13();
6304 qreal m21 =
d->state->matrix.m21();
6305 qreal m22 =
d->state->matrix.m22();
6306 qreal m23 =
d->state->matrix.m23();
6307 qreal m33 =
d->state->matrix.m33();
6309 oldMatrix =
d->state->matrix;
6310 d->state->matrix.setMatrix(m11, m12, m13,
6319 staticText_d->
matrix =
d->state->matrix;
6320 staticTextNeedsReinit =
true;
6324 if (staticTextNeedsReinit)
6325 staticText_d->
init();
6327 if (transformedPosition != staticText_d->
position) {
6332 for (
int item=0; item<staticText_d->
itemCount;++item) {
6334 for (
int i=0; i<textItem->
numGlyphs; ++i) {
6341 staticText_d->
position = transformedPosition;
6344 QPen oldPen =
d->state->pen;
6346 for (
int i=0; i<staticText_d->
itemCount; ++i) {
6350 currentColor = item->
color;
6352 d->extended->drawStaticTextItem(item);
6358 if (currentColor != oldPen.
color())
6362 d->state->matrix = oldMatrix;
6370 #ifdef QT_DEBUG_DRAW 6371 if (qt_show_painter_debug_output)
6372 printf(
"QPainter::drawText(), pos=[%.2f,%.2f], str='%s'\n", p.
x(), p.
y(), str.
toLatin1().
constData());
6383 int numGlyphs = len;
6387 glyphs.resize(numGlyphs);
6411 for (
int i = 0; i < nItems; ++i)
6415 if (justificationPadding > 0) {
6419 line.
width = justificationPadding;
6424 for (
int i = 0; i < nItems; ++i) {
6425 int item = visualOrder[i];
6452 #ifdef QT_DEBUG_DRAW 6453 if (qt_show_painter_debug_output)
6454 printf(
"QPainter::drawText(), r=[%d,%d,%d,%d], flags=%d, str='%s'\n",
6464 d->updateState(
d->state);
6467 qt_format_text(
d->state->font, r, flags, 0, str, br ? &bounds : 0, 0, 0, 0,
this);
6469 *br = bounds.toAlignedRect();
6530 #ifdef QT_DEBUG_DRAW 6531 if (qt_show_painter_debug_output)
6532 printf(
"QPainter::drawText(), r=[%.2f,%.2f,%.2f,%.2f], flags=%d, str='%s'\n",
6542 d->updateState(
d->state);
6629 #ifdef QT_DEBUG_DRAW 6630 if (qt_show_painter_debug_output)
6631 printf(
"QPainter::drawText(), r=[%.2f,%.2f,%.2f,%.2f], str='%s'\n",
6641 d->updateState(
d->state);
6700 const int width =
qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod);
6701 const int radius =
qFloor(radiusBase);
6708 while (xs < width) {
6711 path.
quadTo(xs - halfPeriod / 2, ys, xs, 0);
6714 pixmap =
QPixmap(width, radius * 2);
6722 const qreal maxPenWidth = .8 * radius;
6723 if (wavePen.
widthF() > maxPenWidth)
6727 imgPainter.
setPen(wavePen);
6740 QTextItem::RenderFlags flags,
qreal width,
6747 const QPen oldPen = painter->
pen();
6766 const qreal underlinePos = y +
qCeil(underlineOffset);
6788 QLineF underLine(line.x1(), underlinePos, line.x2(), underlinePos);
6803 QLineF strikeOutLine = line;
6831 for (
int i=0; i<glyphCount; ++i) {
6833 if (i == 0 || leftMost > positions[i].x)
6834 leftMost = positions[i].
x;
6839 if (i == 0 || baseLine < positions[i].y)
6840 baseLine = positions[i].
y;
6843 if (i == 0 || rightMost < positions[i].x + gm.
xoff)
6844 rightMost = positions[i].
x + gm.
xoff;
6847 QFixed width = rightMost - leftMost;
6848 QTextItem::RenderFlags flags = 0;
6861 width.
toReal(), charFormat);
6866 #ifdef QT_DEBUG_DRAW 6867 if (qt_show_painter_debug_output)
6868 printf(
"QPainter::drawTextItem(), pos=[%.f,%.f], str='%s'\n",
6886 QRectF rect(p.
x(), p.
y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).
toReal());
6893 const RenderHints oldRenderHints =
d->state->renderHints;
6901 bool isPlain90DegreeRotation =
6920 aa = !isPlain90DegreeRotation;
6927 d->updateState(
d->state);
6929 if (!ti.glyphs.numGlyphs) {
6935 int which = glyphs.
glyphs[0] >> 24;
6942 x += ti.width.toReal();
6946 for (end = 0; end < ti.glyphs.numGlyphs; ++
end) {
6955 for (i = start; i <
end; ++i) {
6957 ti2.
width += ti.glyphs.effectiveAdvance(i);
6963 d->engine->drawTextItem(
QPointF(x, y), ti2);
6969 const int hi = which << 24;
6970 for (i = start; i <
end; ++i) {
6982 for (i = start; i <
end; ++i) {
6984 ti2.
width += ti.glyphs.effectiveAdvance(i);
6991 d->extended->drawTextItem(
QPointF(x, y), ti2);
6993 d->engine->drawTextItem(
QPointF(x,y), ti2);
6996 const int hi = which << 24;
6997 for (i = start; i <
end; ++i)
7002 d->extended->drawTextItem(p, ti);
7004 d->engine->drawTextItem(p, ti);
7009 if (
d->state->renderHints != oldRenderHints) {
7010 d->state->renderHints = oldRenderHints;
7012 d->extended->renderHintsChanged();
7085 return QRect(rect.
x(),rect.
y(), 0,0);
7096 return QRectF(rect.
x(),rect.
y(), 0,0);
7122 if (!
d->engine || text.
length() == 0)
7148 #ifdef QT_DEBUG_DRAW 7149 if (qt_show_painter_debug_output)
7150 printf(
"QPainter::drawTiledPixmap(), target=[%.2f,%.2f,%.2f,%.2f], pix=[%d,%d], offset=[%.2f,%.2f]\n",
7179 d->extended->drawTiledPixmap(r, pixmap,
QPointF(sx, sy));
7186 d->updateState(
d->state);
7221 x +=
d->state->matrix.dx();
7222 y +=
d->state->matrix.dy();
7256 #ifndef QT_NO_PICTURE 7290 d->updateState(
d->state);
7294 const_cast<QPicture *
>(&picture)->play(
this);
7318 #endif // QT_NO_PICTURE 7430 d->extended->fillRect(r, brush);
7440 d->colorBrush.setColor(brush.
color());
7471 d->extended->fillRect(r, brush);
7481 d->colorBrush.setColor(brush.
color());
7513 d->extended->fillRect(r, color);
7540 d->extended->fillRect(r, color);
7622 #ifdef QT_DEBUG_DRAW 7623 if (qt_show_painter_debug_output)
7624 printf(
"QPainter::setRenderHint: hint=%x, %s\n", hint, on ?
"on" :
"off");
7628 static const bool antialiasingDisabled =
qgetenv(
"QT_NO_ANTIALIASING").
toInt();
7654 qWarning(
"QPainter::setRenderHint: Painter must be active to set rendering hints");
7659 d->state->renderHints |= hints;
7661 d->state->renderHints &= ~hints;
7664 d->extended->renderHintsChanged();
7682 return d->state->renderHints;
7708 qWarning(
"QPainter::viewTransformEnabled: Painter not active");
7711 return d->state->VxF;
7747 #ifdef QT_DEBUG_DRAW 7748 if (qt_show_painter_debug_output)
7749 printf(
"QPainter::setWindow(), [%d,%d,%d,%d]\n", r.
x(), r.
y(), r.
width(), r.
height());
7755 qWarning(
"QPainter::setWindow: Painter not active");
7759 d->state->wx = r.
x();
7760 d->state->wy = r.
y();
7761 d->state->ww = r.
width();
7764 d->state->VxF =
true;
7778 qWarning(
"QPainter::window: Painter not active");
7781 return QRect(
d->state->wx,
d->state->wy,
d->state->ww,
d->state->wh);
7817 #ifdef QT_DEBUG_DRAW 7818 if (qt_show_painter_debug_output)
7819 printf(
"QPainter::setViewport(), [%d,%d,%d,%d]\n", r.
x(), r.
y(), r.
width(), r.
height());
7825 qWarning(
"QPainter::setViewport: Painter not active");
7829 d->state->vx = r.
x();
7830 d->state->vy = r.
y();
7831 d->state->vw = r.
width();
7834 d->state->VxF =
true;
7848 qWarning(
"QPainter::viewport: Painter not active");
7851 return QRect(
d->state->vx,
d->state->vy,
d->state->vw,
d->state->vh);
7908 #ifdef QT_DEBUG_DRAW 7909 if (qt_show_painter_debug_output)
7910 printf(
"QPainter::setViewTransformEnabled(), enable=%d\n", enable);
7916 qWarning(
"QPainter::setViewTransformEnabled: Painter not active");
7920 if (enable ==
d->state->VxF)
7923 d->state->VxF = enable;
7945 qreal QPainter::translationX()
const 7949 qWarning(
"QPainter::translationX: Painter not active");
7952 return d->state->worldMatrix.dx();
7971 qreal QPainter::translationY()
const 7975 qWarning(
"QPainter::translationY: Painter not active");
7978 return d->state->worldMatrix.dy();
8010 qWarning(
"QPainter::xForm: Painter not active");
8034 qWarning(
"QPainter::xForm: Painter not active");
8056 qWarning(
"QPainter::xForm: Painter not active");
8081 int lastPoint = npoints < 0 ? av.
size() :
index+npoints;
8107 qWarning(
"QPainter::xFormDev: Painter not active");
8132 QRect QPainter::xFormDev(
const QRect &r)
const 8136 qWarning(
"QPainter::xFormDev: Painter not active");
8165 qWarning(
"QPainter::xFormDev: Painter not active");
8192 int lastPoint = npoints < 0 ? ad.
size() :
index+npoints;
8227 void QPainter::drawCubicBezier(
const QPolygon &a,
int index)
8234 if ((
int)a.
size() - index < 4) {
8235 qWarning(
"QPainter::drawCubicBezier: Cubic Bezier needs 4 control " 8251 const QPoint& offset,
int internalWidgetRedirectionIndex)
8252 : device(device), replacement(replacement), offset(offset),
8253 internalWidgetRedirectionIndex(internalWidgetRedirectionIndex) { }
8299 bool hadInternalWidgetRedirection =
false;
8309 hadInternalWidgetRedirection =
true;
8320 hadInternalWidgetRedirection ? redirections->
size() - 1 : -1);
8321 globalRedirectionAtomic()->ref();
8350 for (
int i = redirections->
size()-1; i >= 0; --i) {
8351 if (redirections->
at(i) ==
device) {
8352 globalRedirectionAtomic()->deref();
8353 const int internalWidgetRedirectionIndex = redirections->
at(i).internalWidgetRedirectionIndex;
8359 if (internalWidgetRedirectionIndex >= 0) {
8360 Q_ASSERT(internalWidgetRedirectionIndex < redirections->size());
8363 widget->d_func()->setRedirected(redirectionDevice.
replacement, redirectionDevice.
offset);
8364 redirections->
removeAt(internalWidgetRedirectionIndex);
8401 if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0)
8407 for (
int i = redirections->
size()-1; i >= 0; --i)
8408 if (redirections->
at(i) ==
device) {
8410 *offset = redirections->
at(i).offset;
8411 return redirections->
at(i).replacement;
8421 if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0)
8426 mutex = globalRedirectionsMutex();
8434 redirections = globalRedirections();
8439 for (
int i = 0; i < redirections->
size(); ) {
8440 if(redirections->
at(i) == dev || redirections->
at(i).replacement == dev)
8450 int tabstops,
int *ta,
int tabarraylen,
8455 tabstops, ta, tabarraylen,
8460 int tabstops,
int *ta,
int tabarraylen,
8509 uint maxUnderlines = 0;
8510 int numUnderlines = 0;
8516 start_lengthVariant:
8517 bool hasMoreLengthVariants =
false;
8520 int old_offset = offset;
8521 for (; offset < text.
length(); offset++) {
8532 }
else if (!tabarraylen && !tabstops) {
8537 hasMoreLengthVariants =
true;
8542 int length = offset - old_offset;
8543 if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) {
8544 underlinePositions.
resize(maxUnderlines + 1);
8557 underlinePositions[numUnderlines++] = cout - text.
data() - old_offset;
8570 underlinePositions[numUnderlines] = -1;
8574 QString finalText = text.
mid(old_offset, length);
8585 for (
int i = 0; i < tabarraylen; i++)
8596 if (!option && (tf & Qt::TextWrapAnywhere))
8610 qreal lineWidth = 0x01000000;
8611 if (wordwrap || (tf & Qt::TextJustificationForced))
8612 lineWidth = qMax<qreal>(0, r.
width());
8631 if (!dontclip && !brect && height >= r.
height())
8640 yoff = r.
height() - height;
8642 yoff = (r.
height() - height)/2;
8655 xoff = r.
width() - width;
8657 xoff = (r.
width() - width)/2;
8669 QRectF bounds =
QRectF(r.
x() + xoff, r.
y() + yoff, width, height);
8673 goto start_lengthVariant;
8678 if (!(tf & Qt::TextDontPrint)) {
8680 if (!dontclip && !r.
contains(bounds)) {
8686 for (
int i = 0; i < textLayout.
lineCount(); i++) {
8691 if (tf & Qt::AlignRight) {
8693 xoff = r.
width() - advance -
8696 else if (tf & Qt::AlignHCenter)
8697 xoff = (r.
width() - advance) / 2;
8737 pen(s->
pen), brush(s->brush), bgBrush(s->bgBrush),
8739 clipOperation(s->clipOperation),
8742 wx(s->wx), wy(s->wy), ww(s->ww), wh(s->wh),
8743 vx(s->vx), vy(s->vy), vw(s->vw), vh(s->vh),
8745 clipEnabled(s->clipEnabled), bgMode(s->bgMode), painter(s->painter),
8747 composition_mode(s->composition_mode),
8748 emulationSpecifier(s->emulationSpecifier), changeFlags(0)
8811 qWarning(
"QPainter: bitBlt only works when source is of type pixmap");
8816 const QPaintDevice *src,
int sx,
int sy,
int sw,
int sh,
8819 bitBlt_helper(dst,
QPoint(dx, dy), src,
QRect(sx, sy, sw, sh), ignoreMask);
8824 bitBlt_helper(dst, dp, src, sr, ignoreMask);
8828 const QImage *src,
int sx,
int sy,
int sw,
int sh,
int fl)
8830 Qt::ImageConversionFlags flags(fl);
8832 bitBlt_helper(dst,
QPoint(dx, dy), &srcPixmap,
QRect(sx, sy, sw, sh),
false);
8835 #endif // QT3_SUPPORT 9560 return worldTransform();
9583 qWarning(
"QPainter::deviceTransform: Painter not active");
9584 return d->fakeState()->transform;
9586 return d->state->matrix;
9601 #ifdef QT_DEBUG_DRAW 9602 if (qt_show_painter_debug_output)
9603 printf(
"QPainter::resetMatrix()\n");
9606 qWarning(
"QPainter::resetMatrix: Painter not active");
9610 d->state->wx =
d->state->wy =
d->state->vx =
d->state->vy = 0;
9614 setMatrixEnabled(
false);
9615 setViewTransformEnabled(
false);
9617 d->extended->transformChanged();
9635 qWarning(
"QPainter::setWorldTransform: Painter not active");
9640 d->state->worldMatrix = matrix *
d->state->worldMatrix;
9642 d->state->worldMatrix =
matrix;
9644 d->state->WxF =
true;
9656 qWarning(
"QPainter::worldTransform: Painter not active");
9657 return d->fakeState()->transform;
9659 return d->state->worldMatrix;
9673 qWarning(
"QPainter::combinedTransform: Painter not active");
9676 return d->state->worldMatrix *
d->viewTransform();
9698 const QPixmap &pixmap, PixmapFragmentHints hints)
9702 if (!
d->engine || pixmap.
isNull())
9706 for (
int i = 0; i < fragmentCount; ++i) {
9707 QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
9708 fragments[i].width, fragments[i].height);
9709 if (!(
QRectF(pixmap.
rect()).contains(sourceRect)))
9710 qWarning(
"QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle");
9714 if (
d->engine->isExtended()) {
9715 d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
9720 for (
int i = 0; i < fragmentCount; ++i) {
9724 if (fragments[i].rotation == 0) {
9725 xOffset = fragments[i].
x;
9726 yOffset = fragments[i].
y;
9728 transform.
translate(fragments[i].x, fragments[i].y);
9729 transform.
rotate(fragments[i].rotation);
9731 setOpacity(oldOpacity * fragments[i].
opacity);
9732 setTransform(transform);
9736 QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
9737 fragments[i].width, fragments[i].height);
9738 drawPixmap(
QRectF(
qreal(-0.5) * w + xOffset,
qreal(-0.5) * h + yOffset, w, h), pixmap, sourceRect);
9741 setOpacity(oldOpacity);
9742 setTransform(oldTransform);
9764 const QPixmap &pixmap, PixmapFragmentHints hints)
9768 if (!
d->engine || pixmap.
isNull())
9773 for (
int i = 0; i < fragmentCount; ++i) {
9774 QRectF sourceRect = sourceRects[i];
9775 if (!(
QRectF(pixmap.
rect()).contains(sourceRect)))
9776 qWarning(
"QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle");
9781 if (
d->engine->isExtended()) {
9782 d->extended->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, hints);
9785 for (
int i = 0; i < fragmentCount; ++i)
9786 drawPixmap(targetRects[i], pixmap, sourceRects[i]);
9789 for (
int i = 0; i < fragmentCount; ++i)
9790 drawPixmap(targetRects[i], pixmap, sourceRect);
9834 sourceRect.
height(), scaleX, scaleY, rotation, opacity};
QRectF boundingRect(const QRectF &rect, int flags, const QString &text)
Returns the bounding rectangle of the text as it will appear when drawn inside the given rectangle wi...
QPainterPath clipPath() const
Returns the currently clip as a path.
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
void setBackgroundMode(Qt::BGMode mode)
Sets the background mode of the painter to the given mode.
void drawChord(const QRectF &rect, int a, int alen)
Draws the chord defined by the given rectangle, startAngle and spanAngle.
The QPainter class performs low-level painting on widgets and other paint devices.
virtual QFixed lineThickness() const
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
The QColor class provides colors based on RGB, HSV or CMYK values.
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Qt::BGMode backgroundMode() const
Returns the background mode in the current paint engine state.
static Qt::LayoutDirection layoutDirection()
QTextEngine * engine() const
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
The QApplication class manages the GUI application's control flow and main settings.
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
qreal scaleY
the vertical scale of the target rectangle.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
Qt::LayoutDirection layoutDirection
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
QGlyphJustification * justifications
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
bool overline() const
Returns true if this QGlyphRun should be painted with an overline decoration.
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
QList< QPaintDeviceRedirection > QPaintDeviceRedirectionList
QFont font(const QScriptItem &si) const
static void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, const QTransform *effectTransform)
void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, PixmapFragmentHints hints=0)
This function is used to draw pixmap, or a sub-rectangle of pixmap, at multiple positions with differ...
void drawPie(const QRectF &rect, int a, int alen)
Draws a pie defined by the given rectangle, startAngle and and spanAngle.
#define Q_DUMMY_COMPARISON_OPERATOR(C)
qreal width
the width of the source rectangle and is used to calculate the width of the target rectangle...
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
void draw_helper(const QPainterPath &path, DrawOperation operation=StrokeAndFillDraw)
void drawArc(const QRectF &rect, int a, int alen)
Draws the arc defined by the given rectangle, startAngle and spanAngle.
The QStaticText class enables optimized drawing of text when the text and its layout is updated rarel...
static mach_timebase_info_data_t info
qreal opacity() const
Returns the opacity in the current paint engine state.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
const QTransform & transform() const
Returns the world transformation matrix.
QPaintEngineEx * extended
qreal opacity() const
Returns the opacity of the painter.
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
qreal horizontalAdvance() const
Returns the horizontal advance of the text.
The QMutex class provides access serialization between threads.
void setPosition(const QPointF &pos)
Moves the line to position pos.
void drawRoundRect(const QRectF &r, int xround=25, int yround=25)
Draws a rectangle r with rounded corners.
QFontEngine * fontEngine() const
int width() const
Returns the width of the pixmap.
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns 0...
QPointer< QWidget > widget
Qt::ClipOperation operation
void setBrush(const QBrush &brush)
Sets the brush used to fill strokes generated with this pen to the given brush.
virtual void transformChanged()=0
const QChar at(int i) const
Returns the character at the given index position in the string.
CompositionMode
Defines the modes supported for digital image compositing.
The QLine class provides a two-dimensional vector using integer precision.
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen's color.
QPainter::RenderHints renderHints
bool brushNeedsResolving() const
Returns whether the coordinate of the fill have been specified as bounded by the current rendering op...
QPaintDevice * replacement
const QPaintDevice * device
T * data() const
Returns the value of the pointer referenced by this object.
const QGradient * gradient() const
Returns the gradient describing this brush.
const QBrush & background() const
Returns the current background brush.
void setViewport(const QRect &viewport)
Sets the painter's viewport rectangle to the given rectangle, and enables view transformations.
The QMatrix class specifies 2D transformations of a coordinate system.
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
The QAtomicInt class provides platform-independent atomic operations on integers. ...
QPainter::CompositionMode composition_mode
static QGradient::CoordinateMode coordinateMode(const QBrush &brush)
The QFlag class is a helper data type for QFlags.
Qt::BrushStyle qbrush_style(const QBrush &b)
QFixedPoint * glyphPositions
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
bool underline() const
Returns true if underline has been set; otherwise returns false.
static bool is_brush_transparent(const QBrush &brush)
bool worldMatrixEnabled() const
Returns true if world transformation is enabled; otherwise returns false.
QPaintEngineState * state
QColor underlineColor() const
Returns the color used to underline the characters with this format.
void setTransform(const QTransform &)
Sets matrix as an explicit transformation matrix on the current brush.
void setSystemTransform(const QTransform &xform)
void clearDirty(DirtyFlags df)
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
Qt::PenStyle style() const
Returns the pen style.
CoordinateMode coordinateMode() const
Returns the coordinate mode of this gradient.
bool isValid() const
Returns true if the QRawFont is valid and false otherwise.
void rotate(qreal a)
Rotates the coordinate system the given angle clockwise.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
QScopedPointer< QBrushData, QBrushDataPointerDeleter > d
void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
Adds the given rectangle rect with rounded corners to the path.
int pixelSize() const
Returns the pixel size of the font if it was set with setPixelSize().
void fill(uint pixel)
Fills the entire image with the given pixelValue.
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
QTransform transform() const
Returns the matrix in the current paint engine state.
void shear(qreal sh, qreal sv)
Shears the coordinate system by ({sh}, {sv}).
unsigned char untransformedCoordinates
QRectF clipBoundingRect() const
Returns the bounding rectangle of the current clip if there is a clip; otherwise returns an empty rec...
int length() const
Returns the number of characters in this string.
virtual void updateState(const QPaintEngineState &state)=0
Reimplement this function to update the state of a paint engine.
void setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
T * take()
Returns the value of the pointer referenced by this object.
The QPointF class defines a point in the plane using floating point precision.
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
The QTextLine class represents a line of text inside a QTextLayout.
QPainterPrivate(QPainter *painter)
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
static QRawFontPrivate * get(const QRawFont &font)
void restore()
Restores the current painter state (pops a saved state off the stack).
~QPainter()
Destroys the painter.
bool matrixEnabled() const
QRect normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
void setMatrixEnabled(bool enabled)
Use setWorldMatrixEnabled() instead.
void updateState(QPainterState *state)
QRect window() const
Returns the window rectangle.
QPointF topLeft() const
Returns the position of the rectangle's top-left corner.
Flags flags() const
Returns the flags associated with the option.
QColor color() const
Returns the color of this pen's brush.
void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation)
int width() const
Returns the width of the rectangle.
void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString &str, QRectF *brect, int tabstops, int *tabarray, int tabarraylen, QPainter *painter)
void reset()
Resets the matrix to an identity matrix, i.e.
void setCosmetic(bool cosmetic)
Sets this pen to cosmetic or non-cosmetic, depending on the value of cosmetic.
virtual uint flags() const
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
const unsigned short * logClusters
CoordinateMode
This enum specifies how gradient coordinates map to the paint device on which the gradient is used...
QPaintEngine::DirtyFlags dirtyFlags
long ASN1_INTEGER_get ASN1_INTEGER * a
QRect boundingRect() const
Returns the bounding rectangle of this region.
static QStyle * style()
Returns the application's style object.
void setLineWidth(qreal width)
Lays out the line with the given width.
The QPolygon class provides a vector of points using integer precision.
const QVectorPath & qtVectorPathForPath(const QPainterPath &path)
void drawLine(const QLineF &line)
Draws a line defined by line.
int depth() const
Returns the depth of the pixmap.
int height() const
Returns the height of the rectangle.
QRectF intersected(const QRectF &other) const
Returns the intersection of this rectangle and the given rectangle.
unsigned short * logClusters(const QScriptItem *si) const
bool isClipEnabled() const
Returns whether clipping is enabled or not in the current paint engine state.
The QString class provides a Unicode character string.
QRect rect() const
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
QFontInfo fontInfo() const
Returns the font info for the painter if the painter is active.
QList< qreal > tabArray() const
Returns a list of tab positions defined for the text layout.
const QMatrix & deviceMatrix() const
Returns the matrix that transforms from logical coordinates to device coordinates of the platform dep...
QMatrix matrix() const
Returns the matrix in the current paint engine state.
static QFixed fromReal(qreal r)
QPaintDeviceRedirection()
void setWorldMatrixEnabled(bool enabled)
Enables transformations if enable is true, or disables transformations if enable is false...
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QVector class is a template class that provides a dynamic array.
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const =0
QString text() const
Returns the text that should be drawn.
bool penNeedsResolving() const
Returns whether the coordinate of the stroke have been specified as bounded by the current rendering ...
static QFixedPoint fromPointF(const QPointF &p)
void qt_painter_removePaintDevice(QPaintDevice *dev)
QTransform transform() const
Returns the current transformation matrix for the brush.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setBrushOrigin(int x, int y)
Sets the brush's origin to point (x, y).
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
virtual int devType() const
QPainterDummyState * dummyState
void arcMoveTo(const QRectF &rect, qreal angle)
Creates a move to that lies on the arc that occupies the given rectangle at angle.
void setMiterLimit(qreal length)
Sets the miter limit of the generated outlines to limit.
void drawOpaqueBackground(const QPainterPath &path, DrawOperation operation)
The QChar class provides a 16-bit Unicode character.
QChar * data()
Returns a pointer to the data stored in the QString.
const quint32 * glyphIndexData
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void setFontEngine(QFontEngine *fe)
qreal tabStop() const
Returns the distance in device units between tab stops.
Format format() const
Returns the format of the image.
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
static QBrush stretchGradientToUserSpace(const QBrush &brush, const QRectF &boundingRect)
static QPixmap * find(const QString &key)
qreal x() const
Returns the x-coordinate of this point.
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false...
QRectF boundingRect() const
Returns the bounding rectangle of this painter path as a rectangle with floating point precision...
Qt::ClipOperation clipOperation
The QLineF class provides a two-dimensional vector using floating point precision.
void setDashPattern(Qt::PenStyle)
Sets the dash pattern for the generated outlines to style.
static const QRectF boundingRect(const QPointF *points, int pointCount)
static QPointF roundInDeviceCoordinates(const QPointF &p, const QTransform &m)
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
static QStaticTextPrivate * get(const QStaticText *q)
void setColor(const QColor &color)
Sets the color of this pen's brush to the given color.
QVector< QPainterState * > states
Q_CORE_EXPORT void qDebug(const char *,...)
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
static void qt_cleanup_painter_state(QPainterPrivate *d)
bool contains(const QPointF &p) const
Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false...
static uint line_emulation(uint emulation)
void resetMatrix()
Resets any transformations that were made using translate(), scale(), shear(), rotate(), setWorldMatrix(), setViewport() and setWindow().
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
void shapeLine(const QScriptLine &line)
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
void setAlignment(Qt::Alignment alignment)
Sets the option's text alignment to the specified alignment.
QRegion clipRegion() const
Returns the currently set clip region.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
void append(const T &t)
Inserts value at the end of the list.
void translate(const QPointF &p)
Translates this line by the given offset.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
QPaintDeviceRedirection(const QPaintDevice *device, QPaintDevice *replacement, const QPoint &offset, int internalWidgetRedirectionIndex)
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount of the given rectangles using the current pen and brush.
QFuture< void > map(Sequence &sequence, MapFunction function)
const QPen & pen() const
Returns the painter's current pen.
void drawStretchedGradient(const QPainterPath &path, DrawOperation operation)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QBrush brush() const
Returns the brush in the current paint engine state.
void resetTransform()
Resets any transformations that were made using translate(), scale(), shear(), rotate(), setWorldTransform(), setViewport() and setWindow().
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
static QGlyphRunPrivate * get(const QGlyphRun &glyphRun)
QFontMetrics fontMetrics() const
Returns the font metrics for the painter if the painter is active.
const QMatrix & matrix() const
Use worldTransform() instead.
The QRectF class defines a rectangle in the plane using floating point precision. ...
UnderlineStyle
This enum describes the different ways drawing underlined text.
Q_AUTOTEST_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion)
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path...
static void restoreRedirected(const QPaintDevice *device)
Using QWidget::render() obsoletes the use of this function.
QPoint brushOrigin() const
Returns the currently set brush origin.
void updateStateImpl(QPainterState *state)
qreal y
the y coordinate of the center point in the target rectangle.
bool qHasPixmapTexture(const QBrush &)
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
Qt::ClipOperation clipOperation() const
Returns the clip operation in the current paint engine state.
void fillPath(const QPainterPath &path, const QBrush &brush)
Fills the given path using the given brush.
QPointF brushOrigin() const
Returns the brush origin in the current paint engine state.
void drawPicture(const QPointF &p, const QPicture &picture)
Replays the given picture at the given point.
bool overline() const
Returns true if overline has been set; otherwise returns false.
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
QBrush qpen_brush(const QPen &p)
bool hasClipping() const
Returns true if clipping has been set; otherwise returns false.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
void drawConvexPolygon(const QPointF *points, int pointCount)
Draws the convex polygon defined by the first pointCount points in the array points using the current...
static Qt::LayoutDirection layout_direction
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
bool operator==(const QPaintDevice *pdev) const
void beginNativePainting()
Flushes the painting pipeline and prepares for the user issuing commands directly to the underlying g...
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
QFont font() const
Returns the font in the current paint engine state.
const QFont & font() const
Returns the currently set font used for drawing text.
qreal height() const
Returns the height of the rectangle.
qreal x
the x coordinate of center point in the target rectangle.
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false...
QGlyphLayout shapedGlyphs(const QScriptItem *si) const
static bool attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
const T & at(int i) const
Returns the item at index position i in the list.
int lineNumber() const
Returns the position of the line in the text engine.
virtual QFixed ascent() const =0
virtual Type type() const =0
Reimplement this function to return the paint engine Type.
virtual QFixed descent() const =0
static void bidiReorder(int numRuns, const quint8 *levels, int *visualOrder)
CompositionMode compositionMode() const
Returns the current composition mode.
const char * styleHint(const QFontDef &request)
qreal height() const
Returns the height of the font.
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
QPainter::CompositionMode compositionMode() const
Returns the composition mode in the current paint engine state.
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
static bool supportsThreadedFontRendering()
Returns true if font rendering is supported outside the GUI thread, false otherwise.
const QTransform & deviceTransform() const
Returns the matrix that transforms from logical coordinates to device coordinates of the platform dep...
RenderHint
Renderhints are used to specify flags to QPainter that may or may not be respected by any given engin...
void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun)
Draws the specified glyphs at the given position.
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
qreal width() const
Returns the width of the rectangle.
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws the polygon defined by the first pointCount points in the array points using the current pen an...
static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX=1, qreal scaleY=1, qreal rotation=0, qreal opacity=1)
This is a convenience function that returns a QPainter::PixmapFragment that is initialized with the p...
void setWorldMatrix(const QMatrix &matrix, bool combine=false)
Sets the transformation matrix to matrix and enables transformations.
QList< QPainterClipInfo > clipInfo
QTransform combinedTransform() const
Returns the transformation matrix combining the current window/viewport and world transformation...
The QRegion class specifies a clip region for a painter.
void setDirty(DirtyFlags df)
void setTextDirection(Qt::LayoutDirection aDirection)
Sets the direction of the text layout defined by the option to the given direction.
virtual void setState(QPainterState *s)
The QPainterPathStroker class is used to generate fillable outlines for a given painter path...
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
QPainterPath clipPath() const
Returns the clip path in the current paint engine state.
void clear()
Removes all items from the list.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
int depth() const
Returns the depth of the image.
static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement, const QPoint &offset=QPoint())
Please use QWidget::render() instead.
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs)=0
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
Qt::BrushStyle style() const
Returns the brush style.
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
The QGlyphRun class provides direct access to the internal glyphs in a font.
QTransform viewTransform() const
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
QRect viewport() const
Returns the viewport rectangle.
QRawFont rawFont() const
Returns the font selected for this QGlyphRun object.
The QFontInfo class provides general information about fonts.
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
void strokePath(const QPainterPath &path, const QPen &pen)
Draws the outline (strokes) the path path with the pen specified by pen.
QRect toRect() const
Returns a QRect based on the values of this rectangle.
QList< Tab > tabs() const
Returns a list of tab positions defined for the text layout.
void reset(T *other=0)
Deletes the existing object it is pointing to if any, and sets its pointer to other.
virtual void systemStateChanged()
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
void setWindow(const QRect &window)
Sets the painter's window to the given rectangle, and enables view transformations.
const T & at(int i) const
Returns the item at index position i in the vector.
Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray, const QFixedPoint *positions, int glyphCount, QFontEngine *fontEngine, const QFont &font, const QTextCharFormat &charFormat)
void detachPainterPrivate(QPainter *q)
QMatrix combinedMatrix() const
Returns the transformation matrix combining the current window/viewport and world transformation...
QPainter * painter() const
Returns a pointer to the painter currently updating the paint engine.
const QPointF * glyphPositionData
const QBrush & brush() const
Returns the painter's current brush.
Qt::LayoutDirection layoutDirection() const
Returns the layout direction used by the painter when drawing text.
void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset=QPointF())
Draws a tiled pixmap, inside the given rectangle with its origin at the given position.
int width() const
Returns the pen width with integer precision.
const char * constData() const
Returns a pointer to the data stored in the byte array.
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
void setRenderHints(RenderHints hints, bool on=true)
Sets the given render hints on the painter if on is true; otherwise clears the render hints...
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QPixmap qt_pixmapForBrush(int style, bool invert)
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
bool underline() const
Returns true if this QGlyphRun should be painted with an underline decoration.
void setTabArray(QList< qreal > tabStops)
Sets the tab positions for the text layout to those specified by tabStops.
virtual QPaintEngine * paintEngine() const =0
QPainter()
Constructs a painter.
#define Q_ASSERT_X(cond, where, what)
int width() const
Returns the width of the image.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
The QTextLayout class is used to lay out and render text.
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
void updateEmulationSpecifier(QPainterState *s)
void * qMemSet(void *dest, int c, size_t n)
void setViewTransformEnabled(bool enable)
Enables view transformations if enable is true, or disables view transformations if enable is false...
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
QPainter::RenderHints renderHints() const
Returns the render hints in the current paint engine state.
const QTransform & worldTransform() const
Returns the world transformation matrix.
qreal leading() const
Returns the leading of the font.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
void justify(const QScriptLine &si)
The QRawFont class provides access to a single physical instance of a font.
ushort alpha
Returns the alpha color component of this color.
void setClipping(bool enable)
Enables clipping if enable is true, or disables clipping if enable is false.
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
Qt::BGMode backgroundMode() const
Returns the current background mode.
The QGradient class is used in combination with QBrush to specify gradient fills. ...
bool hasAlpha() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false...
void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText)
Draws the given staticText at the given topLeftPosition.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a ...
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
QPainterPrivate ** d_ptrs
static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition=false)
qreal scaleX
the horizontal scale of the target rectangle.
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
Qt::LayoutDirection textDirection() const
Returns the direction of the text layout defined by the option.
qreal naturalTextWidth() const
Returns the width of the line that is occupied by text.
QString family() const
Returns the requested font family name, i.e.
qreal miterLimit() const
Returns the miter limit of the pen.
void setCoordinateMode(CoordinateMode mode)
Sets the coordinate mode of this gradient to mode.
void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength)
Creates an arc that occupies the given rectangle, beginning at the specified startAngle and extending...
void eraseRect(const QRectF &)
Erases the area inside the given rectangle.
int x() const
Returns the x-coordinate of the rectangle's left edge.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
#define st(var, type, card)
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
The QPoint class defines a point in the plane using integer precision.
void drawTextItem(const QPointF &p, const QTextItem &ti)
Draws the text item ti at position p.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style of the generated outlines to style.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
QTextItemInt midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const
void setMatrix(const QMatrix &matrix, bool combine=false)
Use setWorldTransform() instead.
int size() const
Returns the number of items in the list.
int length(int item) const
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
int glyphPositionDataSize
qreal widthF() const
Returns the pen width with floating point precision.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
QTransform redirectionMatrix
#define Q_AUTOTEST_EXPORT
WrapMode wrapMode() const
Returns the text wrap mode defined by the option.
static bool check_gradient(const QBrush &brush)
The QTextOption class provides a description of general rich text properties.
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
int height() const
Returns the height of the image.
QSizeF size() const
Returns the size of the rectangle.
int size() const
Returns the number of bytes in this byte array.
int internalWidgetRedirectionIndex
#define QPaintEngine_OpaqueBackground
virtual int metric(PaintDeviceMetric metric) const
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
void quadTo(const QPointF &ctrlPt, const QPointF &endPt)
Adds a quadratic Bezier curve between the current position and the given endPoint with the control po...
QRect rect() const
Returns the pixmap's enclosing rectangle.
int y() const
Returns the y coordinate of this point.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
qreal y() const
Returns the y-coordinate of this point.
void drawGlyphs(const quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount, const QRawFont &font, bool overline=false, bool underline=false, bool strikeOut=false)
void initFrom(const QWidget *widget)
Initializes the painters pen, background and font to the same as the given widget.
void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt)
Adds a cubic Bezier curve between the current position and the given endPoint using the control point...
The QPixmap class is an off-screen image representation that can be used as a paint device...
QPaintEngineEx * real_engine
QRegion clipRegion() const
Returns the clip region in the current paint engine state.
QFixed effectiveAdvance(int item) const
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
void scale(qreal sx, qreal sy)
Scales the coordinate system by ({sx}, {sy}).
QPaintDevice * helper_device
Qt::Alignment alignment() const
Returns the text alignment defined by the option.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
int height() const
Returns the height of the pixmap.
HB_GlyphAttributes * attributes
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
#define QGradient_StretchToDevice
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
The QFontMetricsF class provides font metrics information.
int pointSize() const
Returns the point size of the font.
T * data()
Returns a pointer to the data stored in the vector.
void setFont(const QFont &f)
Sets the painter's font to the given font.
qreal width(const QString &string) const
Returns the width in pixels of the characters in the given text.
static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
unsigned char needsRelayout
int elementCount() const
Returns the number of path elements in the painter path.
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
void setCacheEnabled(bool enable)
Enables caching of the complete layout information if enable is true; otherwise disables layout cachi...
void setClipPath(const QPainterPath &path, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip path for the painter to the given path, with the clip operation...
int x() const
Returns the x coordinate of this point.
QPen pen() const
Returns the pen in the current paint engine state.
void setLayoutDirection(Qt::LayoutDirection direction)
Sets the layout direction used by the painter when drawing text, to the specified direction...
Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush)
void endLayout()
Ends the layout process.
bool isValid() const
Returns true if the color is valid; otherwise returns false.
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QString text() const
Returns the text of the QStaticText.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
The QTextItem class provides all the information required to draw text in a custom paint engine...
void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
Draws the given rectangle rect with rounded corners.
QPixmap copy(int x, int y, int width, int height) const
Returns a deep copy of the subset of the pixmap that is specified by the rectangle QRect( x...
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
bool strikeOut() const
Returns true if strikeout has been set; otherwise returns false.
bool viewTransformEnabled() const
Returns true if view transformation is enabled; otherwise returns false.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Qt::PenStyle qpen_style(const QPen &p)
QImage textureImage() const
Returns the custom brush pattern, or a null image if no custom brush pattern has been set...
const QMatrix & worldMatrix() const
Returns the world transformation matrix.
The QPicture class is a paint device that records and replays QPainter commands.
virtual QPoint coordinateOffset() const
Returns the offset from the painters origo to the engines origo.
void drawPolyline(const QPointF *points, int pointCount)
Draws the polyline defined by the first pointCount points in points using the current pen...
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
#define qPrintable(string)
qreal height
the height of the source rectangle and is used to calculate the height of the target rectangle...
QPointF center() const
Returns the center point of the rectangle.
static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, QTextCharFormat::UnderlineStyle underlineStyle, QTextItem::RenderFlags flags, qreal width, const QTextCharFormat &charFormat)
void endNativePainting()
Restores the painter after manually issuing native painting commands.
int size() const
Returns the number of items in the vector.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection=0) const
Draws a line on the given painter at the specified position.
QString name() const
Returns the name of the color in the format "#RRGGBB"; i.e.
bool strikeOut() const
Returns true if this QGlyphRun should be painted with a strike out decoration.
qreal height() const
Returns the line's height.
QRgb rgb() const
Returns the RGB value of the color.
static QPaintDevice * redirected(const QPaintDevice *device, QPoint *offset=0)
Using QWidget::render() obsoletes the use of this function.
static bool is_pen_transparent(const QPen &pen)
Q_DECL_CONSTEXPR int qRound(qreal d)
virtual QFixed underlinePosition() const
void setBackground(const QBrush &bg)
Sets the background brush of the painter to the given brush.
void setTabStop(qreal tabStop)
Sets the default distance in device units between tab stops to the value specified by tabStop...
void beginLayout()
Begins the layout process.
QWidget * currentClipWidget
QFixed leadingSpaceWidth(const QScriptLine &line)
void paintText(const QPointF &pos, QPainter *p)
QFontEngine * engine(int at) const
QEmulationPaintEngine * emulationEngine
QMatrix inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
int lineCount() const
Returns the number of lines in this text layout.
static qreal toReal(Register *reg, int type, bool *ok=0)
void setStyle(Qt::PenStyle)
Sets the pen style to the given style.
bool hasFeature(PaintEngineFeatures feature) const
Returns true if the paint engine supports the specified feature; otherwise returns false...
The QList class is a template class that provides lists.
static bool needsResolving(const QBrush &brush)
void setWidth(qreal width)
Sets the width of the generated outline painter path to width.
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
QScopedPointer< QPainterPrivate > d_ptr
bool isSolid() const
Returns true if the pen has a solid fill, otherwise false.
Qt::LayoutDirection direction
QBrush backgroundBrush() const
Returns the background brush in the current paint engine state.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
The QPalette class contains color groups for each widget state.
void removeAt(int i)
Removes the item at index position i.