Qt 4.8
qpaintengine_pic.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "private/qpaintengine_p.h"
43 #include "private/qpainter_p.h"
44 #include "private/qpicture_p.h"
45 #include "private/qfont_p.h"
46 
47 #ifndef QT_NO_PICTURE
48 
49 #include "qbuffer.h"
50 #include "qbytearray.h"
51 #include "qdatastream.h"
52 #include "qmath.h"
53 #include "qpaintengine_pic_p.h"
54 #include "qpicture.h"
55 #include "qpolygon.h"
56 #include "qrect.h"
57 #include <private/qtextengine_p.h>
58 
59 //#define QT_PICTURE_DEBUG
60 #include <qdebug.h>
61 
62 
64 
66 {
68 public:
72 };
73 
75  : QPaintEngine(*(new QPicturePaintEnginePrivate), AllFeatures)
76 {
78  d->pt = 0;
79 }
80 
82  : QPaintEngine(dptr, AllFeatures)
83 {
85  d->pt = 0;
86 }
87 
89 {
90 }
91 
93 {
95 #ifdef QT_PICTURE_DEBUG
96  qDebug() << "QPicturePaintEngine::begin()";
97 #endif
98  Q_ASSERT(pd);
99  QPicture *pic = static_cast<QPicture *>(pd);
100 
101  d->pdev = pd;
102  d->pic_d = pic->d_func();
103  Q_ASSERT(d->pic_d);
104 
105  d->s.setDevice(&d->pic_d->pictb);
106  d->s.setVersion(d->pic_d->formatMajor);
107 
108  d->pic_d->pictb.open(QIODevice::WriteOnly | QIODevice::Truncate);
109  d->s.writeRawData(qt_mfhdr_tag, 4);
110  d->s << (quint16) 0 << (quint16) d->pic_d->formatMajor << (quint16) d->pic_d->formatMinor;
111  d->s << (quint8) QPicturePrivate::PdcBegin << (quint8) sizeof(qint32);
112  d->pic_d->brect = QRect();
113  if (d->pic_d->formatMajor >= 4) {
114  QRect r = pic->boundingRect();
115  d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width()
116  << (qint32) r.height();
117  }
118  d->pic_d->trecs = 0;
119  d->s << (quint32)d->pic_d->trecs; // total number of records
120  d->pic_d->formatOk = false;
121  setActive(true);
122  return true;
123 }
124 
126 {
128 #ifdef QT_PICTURE_DEBUG
129  qDebug() << "QPicturePaintEngine::end()";
130 #endif
131  d->pic_d->trecs++;
132  d->s << (quint8) QPicturePrivate::PdcEnd << (quint8) 0;
133  int cs_start = sizeof(quint32); // pos of checksum word
134  int data_start = cs_start + sizeof(quint16);
135  int brect_start = data_start + 2*sizeof(qint16) + 2*sizeof(quint8);
136  int pos = d->pic_d->pictb.pos();
137  d->pic_d->pictb.seek(brect_start);
138  if (d->pic_d->formatMajor >= 4) { // bounding rectangle
139  QRect r = static_cast<QPicture *>(d->pdev)->boundingRect();
140  d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width()
141  << (qint32) r.height();
142  }
143  d->s << (quint32) d->pic_d->trecs; // write number of records
144  d->pic_d->pictb.seek(cs_start);
145  QByteArray buf = d->pic_d->pictb.buffer();
146  quint16 cs = (quint16) qChecksum(buf.constData() + data_start, pos - data_start);
147  d->s << cs; // write checksum
148  d->pic_d->pictb.close();
149  setActive(false);
150  return true;
151 }
152 
153 #define SERIALIZE_CMD(c) \
154  d->pic_d->trecs++; \
155  d->s << (quint8) c; \
156  d->s << (quint8) 0; \
157  pos = d->pic_d->pictb.pos()
158 
160 {
162 #ifdef QT_PICTURE_DEBUG
163  qDebug() << " -> updatePen(): width:" << pen.width() << "style:"
164  << pen.style() << "color:" << pen.color();
165 #endif
166  int pos;
168  if (d->pic_d->in_memory_only) {
169  int index = d->pic_d->pen_list.size();
170  d->pic_d->pen_list.append(pen);
171  d->s << index;
172  } else {
173  d->s << pen;
174  }
175  writeCmdLength(pos, QRect(), false);
176 }
177 
179 {
181 #ifdef QT_PICTURE_DEBUG
182  qDebug() << " -> updateCompositionMode():" << cmode;
183 #endif
184  int pos;
186  d->s << (qint32)cmode;
187  writeCmdLength(pos, QRectF(), false);
188 }
189 
191 {
193 #ifdef QT_PICTURE_DEBUG
194  qDebug() << " -> updateClipEnabled():" << enabled;
195 #endif
196  int pos;
198  d->s << enabled;
199  writeCmdLength(pos, QRectF(), false);
200 }
201 
203 {
205 #ifdef QT_PICTURE_DEBUG
206  qDebug() << " -> updateOpacity():" << opacity;
207 #endif
208  int pos;
210  d->s << double(opacity);
211  writeCmdLength(pos, QRectF(), false);
212 }
213 
215 {
217 #ifdef QT_PICTURE_DEBUG
218  qDebug() << " -> updateBrush(): style:" << brush.style();
219 #endif
220  int pos;
222  if (d->pic_d->in_memory_only) {
223  int index = d->pic_d->brush_list.size();
224  d->pic_d->brush_list.append(brush);
225  d->s << index;
226  } else {
227  d->s << brush;
228  }
229  writeCmdLength(pos, QRect(), false);
230 }
231 
233 {
235 #ifdef QT_PICTURE_DEBUG
236  qDebug() << " -> updateBrushOrigin(): " << p;
237 #endif
238  int pos;
240  d->s << p;
241  writeCmdLength(pos, QRect(), false);
242 }
243 
245 {
247 #ifdef QT_PICTURE_DEBUG
248  qDebug() << " -> updateFont(): pt sz:" << font.pointSize();
249 #endif
250  int pos;
252  QFont fnt = font;
253  d->s << fnt;
254  writeCmdLength(pos, QRectF(), false);
255 }
256 
258 {
260 #ifdef QT_PICTURE_DEBUG
261  qDebug() << " -> updateBackground(): mode:" << bgMode << "style:" << bgBrush.style();
262 #endif
263  int pos;
265  d->s << bgBrush.color();
266  writeCmdLength(pos, QRect(), false);
267 
269  d->s << (qint8) bgMode;
270  writeCmdLength(pos, QRectF(), false);
271 }
272 
274 {
276 #ifdef QT_PICTURE_DEBUG
277  qDebug() << " -> updateMatrix():" << matrix;
278 #endif
279  int pos;
281  d->s << matrix << (qint8) false;
282  writeCmdLength(pos, QRectF(), false);
283 }
284 
286 {
288 #ifdef QT_PICTURE_DEBUG
289  qDebug() << " -> updateClipRegion(): op:" << op
290  << "bounding rect:" << region.boundingRect();
291 #endif
292  int pos;
294  d->s << region << qint8(op);
295  writeCmdLength(pos, QRectF(), false);
296 }
297 
299 {
301 #ifdef QT_PICTURE_DEBUG
302  qDebug() << " -> updateClipPath(): op:" << op
303  << "bounding rect:" << path.boundingRect();
304 #endif
305  int pos;
306 
308  d->s << path << qint8(op);
309  writeCmdLength(pos, QRectF(), false);
310 }
311 
312 void QPicturePaintEngine::updateRenderHints(QPainter::RenderHints hints)
313 {
315 #ifdef QT_PICTURE_DEBUG
316  qDebug() << " -> updateRenderHints(): " << hints;
317 #endif
318  int pos;
320  d->s << (quint32) hints;
321  writeCmdLength(pos, QRect(), false);
322 }
323 
324 void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr)
325 {
327  int newpos = d->pic_d->pictb.pos(); // new position
328  int length = newpos - pos;
329  QRectF br(r);
330 
331  if (length < 255) { // write 8-bit length
332  d->pic_d->pictb.seek(pos - 1); // position to right index
333  d->s << (quint8)length;
334  } else { // write 32-bit length
335  d->s << (quint32)0; // extend the buffer
336  d->pic_d->pictb.seek(pos - 1); // position to right index
337  d->s << (quint8)255; // indicate 32-bit length
338  char *p = d->pic_d->pictb.buffer().data();
339  memmove(p+pos+4, p+pos, length); // make room for 4 byte
340  d->s << (quint32)length;
341  newpos += 4;
342  }
343  d->pic_d->pictb.seek(newpos); // set to new position
344 
345  if (br.width() > 0.0 || br.height() > 0.0) {
346  if (corr) { // widen bounding rect
347  int w2 = painter()->pen().width() / 2;
348  br.setCoords(br.left() - w2, br.top() - w2,
349  br.right() + w2, br.bottom() + w2);
350  }
351  br = painter()->transform().mapRect(br);
352  if (painter()->hasClipping()) {
353  QRect cr = painter()->clipRegion().boundingRect();
354  br &= cr;
355  }
356 
357  if (br.width() > 0.0 || br.height() > 0.0) {
358  int minx = qFloor(br.left());
359  int miny = qFloor(br.top());
360  int maxx = qCeil(br.right());
361  int maxy = qCeil(br.bottom());
362 
363  if (d->pic_d->brect.width() > 0 || d->pic_d->brect.height() > 0) {
364  minx = qMin(minx, d->pic_d->brect.left());
365  miny = qMin(miny, d->pic_d->brect.top());
366  maxx = qMax(maxx, d->pic_d->brect.x() + d->pic_d->brect.width());
367  maxy = qMax(maxy, d->pic_d->brect.y() + d->pic_d->brect.height());
368  d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny);
369  } else {
370  d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny);
371  }
372  }
373  }
374 }
375 
377 {
379 #ifdef QT_PICTURE_DEBUG
380  qDebug() << " -> drawEllipse():" << rect;
381 #endif
382  int pos;
384  d->s << rect;
385  writeCmdLength(pos, rect, true);
386 }
387 
389 {
391 #ifdef QT_PICTURE_DEBUG
392  qDebug() << " -> drawPath():" << path.boundingRect();
393 #endif
394  int pos;
396  d->s << path;
397  writeCmdLength(pos, path.boundingRect(), true);
398 }
399 
400 void QPicturePaintEngine::drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode)
401 {
403 #ifdef QT_PICTURE_DEBUG
404  qDebug() << " -> drawPolygon(): size=" << numPoints;
405 #endif
406  int pos;
407 
408  QPolygonF polygon;
409  for (int i=0; i<numPoints; ++i)
410  polygon << points[i];
411 
412  if (mode == PolylineMode) {
414  d->s << polygon;
415  } else {
417  d->s << polygon;
418  d->s << (qint8)(mode == OddEvenMode ? 0 : 1);
419  }
420 
421  writeCmdLength(pos, polygon.boundingRect(), true);
422 }
423 
424 void QPicturePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
425 {
427 #ifdef QT_PICTURE_DEBUG
428  qDebug() << " -> drawPixmap():" << r;
429 #endif
430  int pos;
432 
433  if (d->pic_d->in_memory_only) {
434  int index = d->pic_d->pixmap_list.size();
435  d->pic_d->pixmap_list.append(pm);
436  d->s << r << index << sr;
437  } else {
438  d->s << r << pm << sr;
439  }
440  writeCmdLength(pos, r, false);
441 }
442 
443 void QPicturePaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
444 {
446 #ifdef QT_PICTURE_DEBUG
447  qDebug() << " -> drawTiledPixmap():" << r << s;
448 #endif
449  int pos;
451  if (d->pic_d->in_memory_only) {
452  int index = d->pic_d->pixmap_list.size();
453  d->pic_d->pixmap_list.append(pixmap);
454  d->s << r << index << s;
455  } else {
456  d->s << r << pixmap << s;
457  }
458  writeCmdLength(pos, r, false);
459 }
460 
461 void QPicturePaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr,
462  Qt::ImageConversionFlags flags)
463 {
465 #ifdef QT_PICTURE_DEBUG
466  qDebug() << " -> drawImage():" << r << sr;
467 #endif
468  int pos;
470  if (d->pic_d->in_memory_only) {
471  int index = d->pic_d->image_list.size();
472  d->pic_d->image_list.append(image);
473  d->s << r << index << sr << (quint32) flags;
474  } else {
475  d->s << r << image << sr << (quint32) flags;
476  }
477  writeCmdLength(pos, r, false);
478 }
479 
481 {
483 #ifdef QT_PICTURE_DEBUG
484  qDebug() << " -> drawTextItem():" << p << ti.text();
485 #endif
486 
487  const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
488  if (si.chars == 0)
489  QPaintEngine::drawTextItem(p, ti); // Draw as path
490 
491  if (d->pic_d->formatMajor >= 9) {
492  int pos;
494  QFont fnt = ti.font();
495  fnt.setUnderline(false);
496  fnt.setStrikeOut(false);
497  fnt.setOverline(false);
498 
499  qreal justificationWidth = 0;
500  if (si.justified)
501  justificationWidth = si.width.toReal();
502 
503  d->s << p << ti.text() << fnt << ti.renderFlags() << double(fnt.d->dpi)/qt_defaultDpi() << justificationWidth;
504  writeCmdLength(pos, /*brect=*/QRectF(), /*corr=*/false);
505  } else if (d->pic_d->formatMajor >= 8) {
506  // old old (buggy) format
507  int pos;
509  d->s << QPointF(p.x(), p.y() - ti.ascent()) << ti.text() << ti.font() << ti.renderFlags();
510  writeCmdLength(pos, /*brect=*/QRectF(), /*corr=*/false);
511  } else {
512  // old (buggy) format
513  int pos;
515  d->s << p << ti.text();
516  writeCmdLength(pos, QRectF(p, QSizeF(1,1)), true);
517  }
518 }
519 
521 {
522  QPaintEngine::DirtyFlags flags = state.state();
523  if (flags & DirtyPen) updatePen(state.pen());
524  if (flags & DirtyBrush) updateBrush(state.brush());
525  if (flags & DirtyBrushOrigin) updateBrushOrigin(state.brushOrigin());
526  if (flags & DirtyFont) updateFont(state.font());
527  if (flags & DirtyBackground) updateBackground(state.backgroundMode(), state.backgroundBrush());
528  if (flags & DirtyTransform) updateMatrix(state.transform());
529  if (flags & DirtyClipEnabled) updateClipEnabled(state.isClipEnabled());
530  if (flags & DirtyClipRegion) updateClipRegion(state.clipRegion(), state.clipOperation());
531  if (flags & DirtyClipPath) updateClipPath(state.clipPath(), state.clipOperation());
532  if (flags & DirtyHints) updateRenderHints(state.renderHints());
534  if (flags & DirtyOpacity) updateOpacity(state.opacity());
535 }
536 
538 
539 #endif // QT_NO_PICTURE
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
double d
Definition: qnumeric_p.h:62
Qt::BGMode backgroundMode() const
Returns the background mode in the current paint engine state.
Definition: qpainter.cpp:9316
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
void updateOpacity(qreal opacity)
double qreal
Definition: qglobal.h:1193
qreal opacity() const
Returns the opacity in the current paint engine state.
Definition: qpainter.cpp:9529
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
const QTransform & transform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9558
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
int qint32
Definition: qglobal.h:937
CompositionMode
Defines the modes supported for digital image compositing.
Definition: qpainter.h:138
int qCeil(qreal v)
Definition: qmath.h:63
const QChar * chars
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
QPaintEngineState * state
Definition: qpaintengine.h:239
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
Definition: qfont.cpp:1331
Qt::PenStyle style() const
Returns the pen style.
Definition: qpen.cpp:428
int qFloor(qreal v)
Definition: qmath.h:73
void updateBackground(Qt::BGMode bgmode, const QBrush &bgBrush)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QTransform transform() const
Returns the matrix in the current paint engine state.
Definition: qpainter.cpp:9377
void drawImage(const QRectF &r, const QImage &image, 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...
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
void updateBrush(const QBrush &brush)
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
QColor color() const
Returns the color of this pen&#39;s brush.
Definition: qpen.cpp:771
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
#define SERIALIZE_CMD(c)
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
unsigned char quint8
Definition: qglobal.h:934
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
bool isClipEnabled() const
Returns whether clipping is enabled or not in the current paint engine state.
Definition: qpainter.cpp:9473
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QRectF boundingRect() const
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty...
Definition: qpolygon.cpp:742
QString text() const
Returns the text that should be drawn.
#define Q_D(Class)
Definition: qglobal.h:2482
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QRectF boundingRect() const
Returns the bounding rectangle of this painter path as a rectangle with floating point precision...
static const QRectF boundingRect(const QPointF *points, int pointCount)
void updatePen(const QPen &pen)
Q_CORE_EXPORT void qDebug(const char *,...)
signed char qint8
Definition: qglobal.h:933
Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len)
QRegion clipRegion() const
Returns the currently set clip region.
Definition: qpainter.cpp:2562
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
QPainter * painter() const
Returns the paint engine&#39;s painter.
void updateFont(const QFont &font)
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QBrush brush() const
Returns the brush in the current paint engine state.
Definition: qpainter.cpp:9273
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
Qt::ClipOperation clipOperation() const
Returns the clip operation in the current paint engine state.
Definition: qpainter.cpp:9396
QPointF brushOrigin() const
Returns the brush origin in the current paint engine state.
Definition: qpainter.cpp:9287
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
Definition: qfont.cpp:1378
void setActive(bool newState)
Sets the active state of the paint engine to state.
Definition: qpaintengine.h:155
QRect boundingRect() const
Returns the picture&#39;s bounding rectangle or an invalid rectangle if the picture contains no data...
Definition: qpicture.cpp:385
QFont font() const
Returns the font in the current paint engine state.
Definition: qpainter.cpp:9331
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
short qint16
Definition: qglobal.h:935
The QPolygonF class provides a vector of points using floating point precision.
Definition: qpolygon.h:134
unsigned short quint16
Definition: qglobal.h:936
void updateClipEnabled(bool enabled)
Internal QTextItem.
void drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
qreal ascent() const
Corresponds to the ascent of the piece of text that is drawn.
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QPainter::CompositionMode compositionMode() const
Returns the composition mode in the current paint engine state.
Definition: qpainter.cpp:9503
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
RenderFlags renderFlags() const
Returns the render flags used.
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QPainterPath clipPath() const
Returns the clip path in the current paint engine state.
Definition: qpainter.cpp:9457
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
void drawTextItem(const QPointF &p, const QTextItem &ti)
This function draws the text item textItem at position p.
void updateMatrix(const QTransform &matrix)
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
Reimplement this function to draw the pixmap in the given rect, starting at the given p...
int width() const
Returns the pen width with integer precision.
Definition: qpen.cpp:630
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
void updateCompositionMode(QPainter::CompositionMode cmode)
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
QPainter::RenderHints renderHints() const
Returns the render hints in the current paint engine state.
Definition: qpainter.cpp:9488
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
Q_GUI_EXPORT int qt_defaultDpi()
Definition: qfont.cpp:240
void setOverline(bool)
If enable is true, sets overline on; otherwise sets overline off.
Definition: qfont.cpp:1354
void setCoords(qreal x1, qreal y1, qreal x2, qreal y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:770
QExplicitlySharedDataPointer< QFontPrivate > d
Definition: qfont.h:343
unsigned int quint32
Definition: qglobal.h:938
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void updateClipRegion(const QRegion &region, Qt::ClipOperation op)
qreal toReal() const
Definition: qfixed_p.h:77
const char * qt_mfhdr_tag
Definition: qpicture.cpp:112
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
quint16 index
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QRegion clipRegion() const
Returns the clip region in the current paint engine state.
Definition: qpainter.cpp:9443
void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
The QPaintEngineState class provides information about the active paint engine&#39;s current state...
Definition: qpaintengine.h:289
int pointSize() const
Returns the point size of the font.
Definition: qfont.cpp:981
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
QPen pen() const
Returns the pen in the current paint engine state.
Definition: qpainter.cpp:9259
void updateClipPath(const QPainterPath &path, Qt::ClipOperation op)
void updateBrushOrigin(const QPointF &origin)
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
The QTextItem class provides all the information required to draw text in a custom paint engine...
Definition: qpaintengine.h:68
The QPicture class is a paint device that records and replays QPainter commands.
Definition: qpicture.h:58
void drawEllipse(const QRectF &rect)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
QFont font() const
Returns the font that should be used to draw the text.
BGMode
Definition: qnamespace.h:588
#define enabled
bool end()
Reimplement this function to finish painting on the current paint device.
void updateRenderHints(QPainter::RenderHints hints)
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
ClipOperation
Definition: qnamespace.h:1495
void writeCmdLength(int pos, const QRectF &r, bool corr)
QBrush backgroundBrush() const
Returns the background brush in the current paint engine state.
Definition: qpainter.cpp:9301
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.