Qt 4.8
qpaintengine_alpha.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 <qglobal.h>
43 
44 #ifndef QT_NO_PRINTER
45 #include <qdebug.h>
46 #include "private/qpaintengine_alpha_p.h"
47 
48 #include "private/qpicture_p.h"
49 #include "private/qfont_p.h"
50 #include "QtGui/qpicture.h"
51 
53 
55  : QPaintEngine(data, devcaps)
56 {
57 
58 }
59 
61 {
62 
63 }
64 
66 {
68 
69  d->m_continueCall = true;
70  if (d->m_pass != 0) {
71  return true;
72  }
73 
74  d->m_savedcaps = gccaps;
75  d->m_pdev = pdev;
76 
77  d->m_alphaPen = false;
78  d->m_alphaBrush = false;
79  d->m_alphaOpacity = false;
80  d->m_hasalpha = false;
81  d->m_advancedPen = false;
82  d->m_advancedBrush = false;
83  d->m_complexTransform = false;
84  d->m_emulateProjectiveTransforms = false;
85 
86  // clear alpha region
87  d->m_alphargn = QRegion();
88  d->m_cliprgn = QRegion();
89  d->m_pen = QPen();
90  d->m_transform = QTransform();
91 
92  flushAndInit();
93 
94  return true;
95 }
96 
98 {
100 
101  d->m_continueCall = true;
102  if (d->m_pass != 0) {
103  return true;
104  }
105 
106  flushAndInit(false);
107  return true;
108 }
109 
111 {
113 
114  DirtyFlags flags = state.state();
115  if (flags & QPaintEngine::DirtyTransform) {
116  d->m_transform = state.transform();
117  d->m_complexTransform = (d->m_transform.type() > QTransform::TxScale);
118  d->m_emulateProjectiveTransforms = !(d->m_savedcaps & QPaintEngine::PerspectiveTransform)
119  && !(d->m_savedcaps & QPaintEngine::AlphaBlend)
120  && (d->m_transform.type() >= QTransform::TxProject);
121  }
122  if (flags & QPaintEngine::DirtyPen) {
123  d->m_pen = state.pen();
124  if (d->m_pen.style() == Qt::NoPen) {
125  d->m_advancedPen = false;
126  d->m_alphaPen = false;
127  } else {
128  d->m_advancedPen = (d->m_pen.brush().style() != Qt::SolidPattern);
129  d->m_alphaPen = !d->m_pen.brush().isOpaque();
130  }
131  }
132 
133  if (d->m_pass != 0) {
134  d->m_continueCall = true;
135  return;
136  }
137  d->m_continueCall = false;
138 
139  if (flags & QPaintEngine::DirtyOpacity) {
140  d->m_alphaOpacity = (state.opacity() != 1.0f);
141  }
142 
143  if (flags & QPaintEngine::DirtyBrush) {
144  if (state.brush().style() == Qt::NoBrush) {
145  d->m_advancedBrush = false;
146  d->m_alphaBrush = false;
147  } else {
148  d->m_advancedBrush = (state.brush().style() != Qt::SolidPattern);
149  d->m_alphaBrush = !state.brush().isOpaque();
150  }
151  }
152 
153 
154  d->m_hasalpha = d->m_alphaOpacity || d->m_alphaBrush || d->m_alphaPen;
155 
156  if (d->m_picengine)
157  d->m_picengine->updateState(state);
158 }
159 
161 {
163 
164  QRectF tr = d->addPenWidth(path);
165 
166  if (d->m_pass == 0) {
167  d->m_continueCall = false;
168  if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush
169  || d->m_emulateProjectiveTransforms)
170  {
171  d->addAlphaRect(tr);
172  }
173  if (d->m_picengine)
174  d->m_picengine->drawPath(path);
175  } else {
176  d->m_continueCall = !d->fullyContained(tr);
177  }
178 }
179 
180 void QAlphaPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
181 {
183 
184  QPolygonF poly;
185  for (int i=0; i<pointCount; ++i)
186  poly.append(points[i]);
187 
188  QPainterPath path;
189  path.addPolygon(poly);
190  QRectF tr = d->addPenWidth(path);
191 
192  if (d->m_pass == 0) {
193  d->m_continueCall = false;
194  if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush
195  || d->m_emulateProjectiveTransforms)
196  {
197  d->addAlphaRect(tr);
198  }
199 
200  if (d->m_picengine)
201  d->m_picengine->drawPolygon(points, pointCount, mode);
202  } else {
203  d->m_continueCall = !d->fullyContained(tr);
204  }
205 }
206 
207 void QAlphaPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
208 {
210 
211  QRectF tr = d->m_transform.mapRect(r);
212  if (d->m_pass == 0) {
213  d->m_continueCall = false;
214  if (pm.hasAlpha() || d->m_alphaOpacity || d->m_complexTransform || pm.isQBitmap()) {
215  d->addAlphaRect(tr);
216  }
217 
218  if (d->m_picengine)
219  d->m_picengine->drawPixmap(r, pm, sr);
220 
221  } else {
222  d->m_continueCall = !d->fullyContained(tr);
223  }
224 }
225 
226 void QAlphaPaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr)
227 {
229 
230  QRectF tr = d->m_transform.mapRect(r);
231  if (d->m_pass == 0) {
232  d->m_continueCall = false;
233  if (image.hasAlphaChannel() || d->m_alphaOpacity || d->m_complexTransform) {
234  d->addAlphaRect(tr);
235  }
236 
237  if (d->m_picengine)
238  d->m_picengine->drawImage(r, image, sr);
239 
240  } else {
241  d->m_continueCall = !d->fullyContained(tr);
242  }
243 }
244 
245 void QAlphaPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
246 {
248 
249  QRectF tr(p.x(), p.y() - textItem.ascent(), textItem.width() + 5, textItem.ascent() + textItem.descent() + 5);
250  tr = d->m_transform.mapRect(tr);
251 
252  if (d->m_pass == 0) {
253  d->m_continueCall = false;
254  if (d->m_alphaPen || d->m_alphaOpacity || d->m_advancedPen) {
255  d->addAlphaRect(tr);
256  }
257  if (d->m_picengine) {
258  d->m_picengine->drawTextItem(p, textItem);
259  }
260  } else {
261  d->m_continueCall = !d->fullyContained(tr);
262  }
263 }
264 
265 void QAlphaPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
266 {
268 
269  QRectF brect = d->m_transform.mapRect(r);
270 
271  if (d->m_pass == 0) {
272  d->m_continueCall = false;
273  if (pixmap.hasAlpha() || d->m_alphaOpacity || d->m_complexTransform || pixmap.isQBitmap()) {
274  d->addAlphaRect(brect);
275  }
276  if (d->m_picengine)
277  d->m_picengine->drawTiledPixmap(r, pixmap, s);
278  } else {
279  d->m_continueCall = !d->fullyContained(brect);
280  }
281 }
282 
284 {
285  Q_D(const QAlphaPaintEngine);
286  return d->m_cliprgn;
287 }
288 
290 {
291  Q_D(const QAlphaPaintEngine);
292  return d->m_continueCall;
293 }
294 
296 {
298  Q_ASSERT(d->m_pass == 0);
299 
300  if (d->m_pic) {
301  d->m_picpainter->end();
302 
303  // set clip region
304  d->m_alphargn = d->m_alphargn.intersected(QRect(0, 0, d->m_pdev->width(), d->m_pdev->height()));
305 
306  // just use the bounding rect if it's a complex region..
307  QVector<QRect> rects = d->m_alphargn.rects();
308  if (rects.size() > 10) {
309  QRect br = d->m_alphargn.boundingRect();
310  d->m_alphargn = QRegion(br);
311  rects.clear();
312  rects.append(br);
313  }
314 
315  d->m_cliprgn = d->m_alphargn;
316 
317  // now replay the QPicture
318  ++d->m_pass; // we are now doing pass #2
319 
320  // reset states
321  gccaps = d->m_savedcaps;
322 
323  painter()->save();
324  d->resetState(painter());
325 
326  // make sure the output from QPicture is unscaled
327  QTransform mtx;
328  mtx.scale(1.0f / (qreal(d->m_pdev->logicalDpiX()) / qreal(qt_defaultDpiX())),
329  1.0f / (qreal(d->m_pdev->logicalDpiY()) / qreal(qt_defaultDpiY())));
330  painter()->setTransform(mtx);
331  painter()->drawPicture(0, 0, *d->m_pic);
332 
333  d->m_cliprgn = QRegion();
334  d->resetState(painter());
335 
336  // fill in the alpha images
337  for (int i=0; i<rects.size(); ++i)
338  d->drawAlphaImage(rects.at(i));
339 
340  d->m_alphargn = QRegion();
341 
342  painter()->restore();
343 
344  --d->m_pass; // pass #2 finished
345 
346  cleanUp();
347  }
348 
349  if (init) {
351 
352  d->m_pic = new QPicture();
353  d->m_pic->d_ptr->in_memory_only = true;
354  d->m_picpainter = new QPainter(d->m_pic);
355  d->m_picengine = d->m_picpainter->paintEngine();
356 
357  // When newPage() is called and the m_picpainter is recreated
358  // we have to copy the current state of the original printer
359  // painter back to the m_picpainter
360  d->m_picpainter->setPen(painter()->pen());
361  d->m_picpainter->setBrush(painter()->brush());
362  d->m_picpainter->setBrushOrigin(painter()->brushOrigin());
363  d->m_picpainter->setFont(painter()->font());
364  d->m_picpainter->setOpacity(painter()->opacity());
365  d->m_picpainter->setTransform(painter()->combinedTransform());
366  d->m_picengine->syncState();
367  }
368 }
369 
371 {
373 
374  delete d->m_picpainter;
375  delete d->m_pic;
376 
377  d->m_picpainter = 0;
378  d->m_pic = 0;
379  d->m_picengine = 0;
380 }
381 
383  : m_pass(0),
384  m_pic(0),
385  m_picengine(0),
386  m_picpainter(0),
387  m_hasalpha(false),
388  m_alphaPen(false),
389  m_alphaBrush(false),
390  m_alphaOpacity(false),
391  m_advancedPen(false),
392  m_advancedBrush(false),
393  m_complexTransform(false)
394 {
395 
396 }
397 
399 {
400  delete m_picpainter;
401  delete m_pic;
402 }
403 
405 {
406  QPainterPath tmp = path;
407 
408  if (m_pen.style() == Qt::NoPen)
409  return (path.controlPointRect() * m_transform).boundingRect();
410  if (m_pen.isCosmetic())
411  tmp = path * m_transform;
412 
413  QPainterPathStroker stroker;
414  if (m_pen.widthF() == 0.0f)
415  stroker.setWidth(1.0);
416  else
417  stroker.setWidth(m_pen.widthF());
418  stroker.setJoinStyle(m_pen.joinStyle());
419  stroker.setCapStyle(m_pen.capStyle());
420  tmp = stroker.createStroke(tmp);
421  if (m_pen.isCosmetic())
422  return tmp.controlPointRect();
423 
424  return (tmp.controlPointRect() * m_transform).boundingRect();
425 }
426 
428 {
429  QRect r;
430  r.setLeft(int(rect.left()));
431  r.setTop(int(rect.top()));
432  r.setRight(int(rect.right() + 1));
433  r.setBottom(int(rect.bottom() + 1));
434  return r;
435 }
436 
438 {
439  m_alphargn |= toRect(rect);
440 }
441 
443 {
445 
446  qreal dpiX = qMax(m_pdev->logicalDpiX(), 300);
447  qreal dpiY = qMax(m_pdev->logicalDpiY(), 300);
448  qreal xscale = (dpiX / m_pdev->logicalDpiX());
449  qreal yscale = (dpiY / m_pdev->logicalDpiY());
450 
451  QTransform picscale;
452  picscale.scale(xscale, yscale);
453 
454  const int tileSize = 2048;
455  QSize size((int(rect.width() * xscale)), int(rect.height() * yscale));
456  int divw = (size.width() / tileSize);
457  int divh = (size.height() / tileSize);
458  divw += 1;
459  divh += 1;
460 
461  int incx = int(rect.width() / divw);
462  int incy = int(rect.height() / divh);
463 
464  for (int y=0; y<divh; ++y) {
465  int ypos = int((incy * y) + rect.y());
466  int height = int((y == (divh - 1)) ? (rect.height() - (incy * y)) : incy) + 1;
467 
468  for (int x=0; x<divw; ++x) {
469  int xpos = int((incx * x) + rect.x());
470  int width = int((x == (divw - 1)) ? (rect.width() - (incx * x)) : incx) + 1;
471 
472  QSize imgsize((int)(width * xscale), (int)(height * yscale));
473  QImage img(imgsize, QImage::Format_RGB32);
474  img.fill(0xffffffff);
475 
476  QPainter imgpainter(&img);
477  imgpainter.setTransform(picscale);
478  QPointF picpos(qreal(-xpos), qreal(-ypos));
479  imgpainter.drawPicture(picpos, *m_pic);
480  imgpainter.end();
481 
482  q->painter()->setTransform(QTransform());
483  QRect r(xpos, ypos, width, height);
484  q->painter()->drawImage(r, img);
485  }
486  }
487 }
488 
490 {
491  QRegion r(toRect(rect));
492  return (m_cliprgn.intersected(r) == r);
493 }
494 
496 {
497  p->setPen(QPen());
498  p->setBrush(QBrush());
499  p->setBrushOrigin(0,0);
500  p->setBackground(QBrush());
501  p->setFont(QFont());
502  p->setTransform(QTransform());
503  // The view transform is already recorded and included in the
504  // picture we're about to replay. If we don't turn if off,
505  // the view matrix will be applied twice.
506  p->setViewTransformEnabled(false);
509  p->setClipping(false);
510  p->setOpacity(1.0f);
511 }
512 
513 
515 
516 #endif // QT_NO_PRINTER
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
Definition: qpainter.cpp:9547
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
double d
Definition: qnumeric_p.h:62
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 y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
QRegion intersected(const QRegion &r) const
Returns a region which is the intersection of this region and r.
Definition: qregion.h:112
double qreal
Definition: qglobal.h:1193
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Definition: qrect.h:267
virtual 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...
qreal opacity() const
Returns the opacity in the current paint engine state.
Definition: qpainter.cpp:9529
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QRectF addPenWidth(const QPainterPath &path)
QRect toRect(const QRectF &rect) const
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
int logicalDpiY() const
Definition: qpaintdevice.h:96
PaintEngineFeatures gccaps
Definition: qpaintengine.h:240
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
QPaintEngineState * state
Definition: qpaintengine.h:239
Q_GUI_EXPORT int qt_defaultDpiY()
Definition: qfont.cpp:201
void drawAlphaImage(const QRectF &rect)
Qt::PenStyle style() const
Returns the pen style.
Definition: qpen.cpp:428
QAlphaPaintEngine(QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
void fill(uint pixel)
Fills the entire image with the given pixelValue.
Definition: qimage.cpp:2032
QTransform transform() const
Returns the matrix in the current paint engine state.
Definition: qpainter.cpp:9377
void setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
Q_GUI_EXPORT int qt_defaultDpiX()
Definition: qfont.cpp:162
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 restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
Definition: qimage.cpp:6495
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
virtual bool end()
Reimplement this function to finish painting on the current paint device.
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#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
void setBrushOrigin(int x, int y)
Sets the brush&#39;s origin to point (x, y).
Definition: qpainter.h:825
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
virtual void drawImage(const QRectF &r, const QImage &image, const QRectF &sr)
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
#define Q_Q(Class)
Definition: qglobal.h:2483
static const QRectF boundingRect(const QPointF *points, int pointCount)
int logicalDpiX() const
Definition: qpaintdevice.h:95
bool fullyContained(const QRectF &rect) const
int width() const
Returns the width.
Definition: qsize.h:126
QPainter * painter() const
Returns the paint engine&#39;s painter.
#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
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path...
void drawPicture(const QPointF &p, const QPicture &picture)
Replays the given picture at the given point.
Definition: qpainter.cpp:7282
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Definition: qvector.h:347
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Definition: qpen.cpp:840
Qt::PenJoinStyle joinStyle() const
Returns the pen&#39;s join style.
Definition: qpen.cpp:736
static bool init
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:261
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
Definition: qrect.h:264
The QPolygonF class provides a vector of points using floating point precision.
Definition: qpolygon.h:134
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
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
static const char * data(const QByteArray &arr)
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QPainterPathStroker class is used to generate fillable outlines for a given painter path...
Definition: qpainterpath.h:264
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QPrinter::PrinterMode mode
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
qreal descent() const
Corresponds to the descent of the piece of text that is drawn.
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
qreal width() const
Specifies the total width of the text to be drawn.
friend class QPainter
Definition: qpaintengine.h:277
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
void setViewTransformEnabled(bool enable)
Enables view transformations if enable is true, or disables view transformations if enable is false...
Definition: qpainter.cpp:7906
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
Definition: qpainter.cpp:2917
void addAlphaRect(const QRectF &rect)
QRectF controlPointRect() const
Returns the rectangle containing all the points and control points in this path.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:258
void setClipping(bool enable)
Enables clipping if enable is true, or disables clipping if enable is false.
Definition: qpainter.cpp:2517
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
bool hasAlpha() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false...
Definition: qpixmap.cpp:1938
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style of the generated outlines to style.
void setBrush(const QBrush &brush)
Sets the painter&#39;s brush to the given brush.
Definition: qpainter.cpp:4171
virtual bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
int height() const
Returns the height.
Definition: qsize.h:129
qreal widthF() const
Returns the pen width with floating point precision.
Definition: qpen.cpp:645
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
QPaintDevice * pdev
The QPaintEngineState class provides information about the active paint engine&#39;s current state...
Definition: qpaintengine.h:289
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setFont(const QFont &f)
Sets the painter&#39;s font to the given font.
Definition: qpainter.cpp:4288
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
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...
Definition: qpainter.cpp:3365
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
QPen pen() const
Returns the pen in the current paint engine state.
Definition: qpainter.cpp:9259
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
Definition: qpainter.cpp:2139
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
void flushAndInit(bool init=true)
virtual void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
The QTextItem class provides all the information required to draw text in a custom paint engine...
Definition: qpaintengine.h:68
Qt::PenCapStyle capStyle() const
Returns the pen&#39;s cap style.
Definition: qpen.cpp:706
QRegion alphaClipping() const
The QPicture class is a paint device that records and replays QPainter commands.
Definition: qpicture.h:58
static const int tileSize
Definition: qmemrotate.cpp:47
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
void setBackground(const QBrush &bg)
Sets the background brush of the painter to the given brush.
Definition: qpainter.cpp:4258
bool end()
Ends painting.
Definition: qpainter.cpp:1929
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
void setWidth(qreal width)
Sets the width of the generated outline painter path to width.
virtual 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...