Qt 4.8
Public Functions | Protected Functions | List of all members
QAlphaPaintEngine Class Reference

#include <qpaintengine_alpha_p.h>

Inheritance diagram for QAlphaPaintEngine:
QPaintEngine QPdfBaseEngine QWin32PrintEngine QPdfEngine QPSPrintEngine

Public Functions

virtual bool begin (QPaintDevice *pdev)
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. More...
 
virtual void drawImage (const QRectF &r, const QImage &image, const QRectF &sr)
 
virtual void drawPath (const QPainterPath &path)
 The default implementation ignores the path and does nothing. More...
 
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. More...
 
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 points, using mode mode. More...
 
virtual void drawTextItem (const QPointF &p, const QTextItem &textItem)
 This function draws the text item textItem at position p. More...
 
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. More...
 
virtual bool end ()
 Reimplement this function to finish painting on the current paint device. More...
 
virtual void updateState (const QPaintEngineState &state)
 Reimplement this function to update the state of a paint engine. More...
 
 ~QAlphaPaintEngine ()
 
- Public Functions inherited from QPaintEngine
void clearDirty (DirtyFlags df)
 
virtual QPoint coordinateOffset () const
 Returns the offset from the painters origo to the engines origo. More...
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect. More...
 
virtual void drawEllipse (const QRect &r)
 The default implementation of this function calls the floating point version of this function. More...
 
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 rectangle using the given conversion flags flags, to convert it to a pixmap. More...
 
virtual void drawLines (const QLine *lines, int lineCount)
 The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function. More...
 
virtual void drawLines (const QLineF *lines, int lineCount)
 The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine. More...
 
virtual void drawPoints (const QPointF *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode. More...
 
virtual void drawRects (const QRect *rects, int rectCount)
 The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function. More...
 
virtual void drawRects (const QRectF *rects, int rectCount)
 Draws the first rectCount rectangles in the buffer rects. More...
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
virtual HDC getDC () const
 Empty default implementation. More...
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false. More...
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false. More...
 
bool isExtended () const
 Returns true if the paint engine is a QPaintEngineEx derivative. More...
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns 0. More...
 
QPainterpainter () const
 Returns the paint engine's painter. More...
 
 QPaintEngine (PaintEngineFeatures features=0)
 Creates a paint engine with the featureset specified by caps. More...
 
virtual void releaseDC (HDC hdc) const
 Empty default implementation. More...
 
void setActive (bool newState)
 Sets the active state of the paint engine to state. More...
 
void setDirty (DirtyFlags df)
 
void setPaintDevice (QPaintDevice *device)
 
void setSystemClip (const QRegion &baseClip)
 Sets the system clip for this engine. More...
 
void setSystemRect (const QRect &rect)
 Sets the target rect for drawing within the backing store. More...
 
void syncState ()
 Updates all dirty states in this engine. More...
 
QRegion systemClip () const
 Returns the system clip. More...
 
QRect systemRect () const
 Retrieves the rect for drawing within the backing store. More...
 
bool testDirty (DirtyFlags df)
 
virtual Type type () const =0
 Reimplement this function to return the paint engine Type. More...
 
virtual ~QPaintEngine ()
 Destroys the paint engine. More...
 

Protected Functions

QRegion alphaClipping () const
 
void cleanUp ()
 
bool continueCall () const
 
void flushAndInit (bool init=true)
 
 QAlphaPaintEngine (QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 
- Protected Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 

Additional Inherited Members

- Public Types inherited from QPaintEngine
enum  DirtyFlag {
  DirtyPen = 0x0001, DirtyBrush = 0x0002, DirtyBrushOrigin = 0x0004, DirtyFont = 0x0008,
  DirtyBackground = 0x0010, DirtyBackgroundMode = 0x0020, DirtyTransform = 0x0040, DirtyClipRegion = 0x0080,
  DirtyClipPath = 0x0100, DirtyHints = 0x0200, DirtyCompositionMode = 0x0400, DirtyClipEnabled = 0x0800,
  DirtyOpacity = 0x1000, AllDirty = 0xffff
}
 QPaintEngine::updateState(). More...
 
enum  PaintEngineFeature {
  PrimitiveTransform = 0x00000001, PatternTransform = 0x00000002, PixmapTransform = 0x00000004, PatternBrush = 0x00000008,
  LinearGradientFill = 0x00000010, RadialGradientFill = 0x00000020, ConicalGradientFill = 0x00000040, AlphaBlend = 0x00000080,
  PorterDuff = 0x00000100, PainterPaths = 0x00000200, Antialiasing = 0x00000400, BrushStroke = 0x00000800,
  ConstantOpacity = 0x00001000, MaskedBrush = 0x00002000, PerspectiveTransform = 0x00004000, BlendModes = 0x00008000,
  ObjectBoundingModeGradients = 0x00010000, RasterOpModes = 0x00020000, PaintOutsidePaintEvent = 0x20000000, AllFeatures = 0xffffffff
}
 This enum is used to describe the features or capabilities that the paint engine has. More...
 
enum  PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode }
 
enum  Type {
  X11, Windows, QuickDraw, CoreGraphics,
  MacPrinter, QWindowSystem, PostScript, OpenGL,
  Picture, SVG, Raster, Direct3D,
  Pdf, OpenVG, OpenGL2, PaintBuffer,
  Blitter, User = 50, MaxUser = 100
}
 
- Protected Variables inherited from QPaintEngine
uint active: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 
uint extended: 1
 
PaintEngineFeatures gccaps
 
uint selfDestruct: 1
 
QPaintEngineStatestate
 

Detailed Description

Definition at line 63 of file qpaintengine_alpha_p.h.

Constructors and Destructors

◆ ~QAlphaPaintEngine()

QAlphaPaintEngine::~QAlphaPaintEngine ( )

Definition at line 60 of file qpaintengine_alpha.cpp.

61 {
62 
63 }

◆ QAlphaPaintEngine()

QAlphaPaintEngine::QAlphaPaintEngine ( QAlphaPaintEnginePrivate data,
PaintEngineFeatures  devcaps = 0 
)
protected

Definition at line 54 of file qpaintengine_alpha.cpp.

55  : QPaintEngine(data, devcaps)
56 {
57 
58 }
QPaintEngine(PaintEngineFeatures features=0)
Creates a paint engine with the featureset specified by caps.

Functions

◆ alphaClipping()

QRegion QAlphaPaintEngine::alphaClipping ( ) const
protected

Definition at line 283 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::updateClipPath(), and QPdfBaseEngine::updateClipPath().

284 {
285  Q_D(const QAlphaPaintEngine);
286  return d->m_cliprgn;
287 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ begin()

bool QAlphaPaintEngine::begin ( QPaintDevice pdev)
virtual

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.

Return true if the initialization was successful; otherwise return false.

See also
end() isActive()

Implements QPaintEngine.

Reimplemented in QPdfBaseEngine, QPdfEngine, QPSPrintEngine, and QWin32PrintEngine.

Definition at line 65 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::begin(), and QPSPrintEngine::begin().

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 }
double d
Definition: qnumeric_p.h:62
PaintEngineFeatures gccaps
Definition: qpaintengine.h:240
#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 QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void flushAndInit(bool init=true)
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ cleanUp()

void QAlphaPaintEngine::cleanUp ( )
protected

Definition at line 370 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::begin(), QWin32PrintEngine::end(), and flushAndInit().

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 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ continueCall()

bool QAlphaPaintEngine::continueCall ( ) const
protected

◆ drawImage()

void QAlphaPaintEngine::drawImage ( const QRectF r,
const QImage image,
const QRectF sr 
)
virtual

Definition at line 226 of file qpaintengine_alpha.cpp.

Referenced by QPSPrintEngine::drawImage().

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 }
double d
Definition: qnumeric_p.h:62
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
Definition: qimage.cpp:6495
#define Q_D(Class)
Definition: qglobal.h:2482
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511

◆ drawPath()

void QAlphaPaintEngine::drawPath ( const QPainterPath path)
virtual

The default implementation ignores the path and does nothing.

Reimplemented from QPaintEngine.

Reimplemented in QPdfBaseEngine, and QWin32PrintEngine.

Definition at line 160 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::drawPath(), and QPdfBaseEngine::drawPath().

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 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511

◆ drawPixmap()

void QAlphaPaintEngine::drawPixmap ( const QRectF r,
const QPixmap pm,
const QRectF sr 
)
virtual

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

Implements QPaintEngine.

Reimplemented in QPdfEngine, QWin32PrintEngine, and QPSPrintEngine.

Definition at line 207 of file qpaintengine_alpha.cpp.

Referenced by QPSPrintEngine::drawPixmap(), and QWin32PrintEngine::drawPixmap().

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 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
bool hasAlpha() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false...
Definition: qpixmap.cpp:1938

◆ drawPolygon()

void QAlphaPaintEngine::drawPolygon ( const QPointF points,
int  pointCount,
PolygonDrawMode  mode 
)
virtual

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

Note
At least one of the drawPolygon() functions must be reimplemented.

Reimplemented from QPaintEngine.

Reimplemented in QPdfBaseEngine, and QWin32PrintEngine.

Definition at line 180 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::drawPolygon(), and QPdfBaseEngine::drawPolygon().

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 }
double d
Definition: qnumeric_p.h:62
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
#define Q_D(Class)
Definition: qglobal.h:2482
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
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

◆ drawTextItem()

void QAlphaPaintEngine::drawTextItem ( const QPointF p,
const QTextItem textItem 
)
virtual

This function draws the text item textItem at position p.

The default implementation of this function converts the text to a QPainterPath and paints the resulting path.

Reimplemented from QPaintEngine.

Reimplemented in QPdfBaseEngine, and QWin32PrintEngine.

Definition at line 245 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::drawTextItem(), and QPdfBaseEngine::drawTextItem().

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 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
qreal ascent() const
Corresponds to the ascent of the piece of text that is drawn.
qreal descent() const
Corresponds to the descent of the piece of text that is drawn.
qreal width() const
Specifies the total width of the text to be drawn.
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287

◆ drawTiledPixmap()

void QAlphaPaintEngine::drawTiledPixmap ( const QRectF rect,
const QPixmap pixmap,
const QPointF p 
)
virtual

Reimplement this function to draw the pixmap in the given rect, starting at the given p.

The pixmap will be drawn repeatedly until the rect is filled.

Reimplemented from QPaintEngine.

Reimplemented in QPdfEngine, QWin32PrintEngine, and QPSPrintEngine.

Definition at line 265 of file qpaintengine_alpha.cpp.

Referenced by QPSPrintEngine::drawTiledPixmap(), and QWin32PrintEngine::drawTiledPixmap().

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 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
bool hasAlpha() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false...
Definition: qpixmap.cpp:1938

◆ end()

bool QAlphaPaintEngine::end ( )
virtual

Reimplement this function to finish painting on the current paint device.

Return true if painting was finished successfully; otherwise return false.

See also
begin() isActive()

Implements QPaintEngine.

Reimplemented in QPdfBaseEngine, QPdfEngine, QPSPrintEngine, and QWin32PrintEngine.

Definition at line 97 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::end(), and QPSPrintEngine::end().

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 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
void flushAndInit(bool init=true)

◆ flushAndInit()

void QAlphaPaintEngine::flushAndInit ( bool  init = true)
protected

Definition at line 295 of file qpaintengine_alpha.cpp.

Referenced by begin(), end(), QPSPrintEngine::newPage(), and QWin32PrintEngine::newPage().

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 }
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
Definition: qpainter.cpp:9547
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
PaintEngineFeatures gccaps
Definition: qpaintengine.h:240
Q_GUI_EXPORT int qt_defaultDpiY()
Definition: qfont.cpp:201
Q_GUI_EXPORT int qt_defaultDpiX()
Definition: qfont.cpp:162
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
QPainter * painter() const
Returns the paint engine&#39;s painter.
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
static bool init
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
friend class QPainter
Definition: qpaintengine.h:277
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
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
The QPicture class is a paint device that records and replays QPainter commands.
Definition: qpicture.h:58
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ updateState()

void QAlphaPaintEngine::updateState ( const QPaintEngineState state)
virtual

Reimplement this function to update the state of a paint engine.

When implemented, this function is responsible for checking the paint engine's current state and update the properties that are changed. Use the QPaintEngineState::state() function to find out which properties that must be updated, then use the corresponding GetFunction{get function} to retrieve the current values for the given properties.

See also
QPaintEngineState

Implements QPaintEngine.

Reimplemented in QPdfBaseEngine, and QWin32PrintEngine.

Definition at line 110 of file qpaintengine_alpha.cpp.

Referenced by QWin32PrintEngine::updateState(), and QPdfBaseEngine::updateState().

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 }
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 opacity() const
Returns the opacity in the current paint engine state.
Definition: qpainter.cpp:9529
QTransform transform() const
Returns the matrix in the current paint engine state.
Definition: qpainter.cpp:9377
#define Q_D(Class)
Definition: qglobal.h:2482
QBrush brush() const
Returns the brush in the current paint engine state.
Definition: qpainter.cpp:9273
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
QPen pen() const
Returns the pen in the current paint engine state.
Definition: qpainter.cpp:9259

The documentation for this class was generated from the following files: