Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QPaintEngine Class Reference

Inheritance diagram for QPaintEngine:


List of all members.

Detailed Description

The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a given platform.

Qt 4.0 provides several premade implementations of QPaintEngine for the different painter backends we support. We provide one paint engine for each window system and painting framework we support. This includes X11 on Unix/Linux and CoreGraphics on Mac OS X. In addition we provide QPaintEngine implementations for OpenGL (accessible through QGLWidget) and PostScript (accessible through QPSPrinter on X11). Additionally there is a raster-based paint engine that is a fallback for when an engine does not support a certain capability.

If one wants to use QPainter to draw to a different backend, one must subclass QPaintEngine and reimplement all its virtual functions. The QPaintEngine implementation is then made available by subclassing QPaintDevice and reimplementing the virtual function QPaintDevice::paintEngine().

QPaintEngine is created and owned by the QPaintDevice that created it.

The big advantage of the QPaintEngine approach opposed to Qt 3's QPainter/QPaintDevicecmd() approach is that it is now possible to adapt to multiple technologies on each platform and take advantage of each to the fullest.

See also:
QPainter, QPaintDevice::paintEngine(), {The Paint System}

Definition at line 89 of file qpaintengine.h.

Public Types

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
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,
  PaintOutsidePaintEvent = 0x20000000, AllFeatures = 0xffffffff
enum  PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode }
enum  Type {
  X11, Windows, QuickDraw, CoreGraphics,
  MacPrinter, QWindowSystem, PostScript, OpenGL,
  Picture, SVG, Raster, Direct3D,
  User = 50, MaxUser = 100

Public Member Functions

virtual bool begin (QPaintDevice *pdev)=0
void clearDirty (DirtyFlags df)
virtual QPoint coordinateOffset () const
virtual void drawEllipse (const QRect &r)
virtual void drawEllipse (const QRectF &r)
virtual void drawImage (const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
virtual void drawLines (const QLineF *lines, int lineCount)
virtual void drawLines (const QLine *lines, int lineCount)
virtual void drawPath (const QPainterPath &path)
virtual void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr)=0
virtual void drawPoints (const QPoint *points, int pointCount)
virtual void drawPoints (const QPointF *points, int pointCount)
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
virtual void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
virtual void drawRects (const QRectF *rects, int rectCount)
virtual void drawRects (const QRect *rects, int rectCount)
virtual void drawTextItem (const QPointF &p, const QTextItem &textItem)
virtual void drawTiledPixmap (const QRectF &r, const QPixmap &pixmap, const QPointF &s)
virtual bool end ()=0
void fix_neg_rect (int *x, int *y, int *w, int *h)
bool hasFeature (PaintEngineFeatures feature) const
bool isActive () const
QPaintDevicepaintDevice () const
QPainterpainter () const
 QPaintEngine (PaintEngineFeatures features=0)
void setActive (bool newState)
void setDirty (DirtyFlags df)
void setPaintDevice (QPaintDevice *device)
void setSystemClip (const QRegion &baseClip)
void setSystemRect (const QRect &rect)
void syncState ()
QRegion systemClip () const
QRect systemRect () const
bool testDirty (DirtyFlags df)
virtual Type type () const =0
virtual void updateState (const QPaintEngineState &state)=0
virtual ~QPaintEngine ()

Protected Member Functions

 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)

Protected Attributes

uint active: 1
QPaintEnginePrivate * d_ptr
PaintEngineFeatures gccaps
uint selfDestruct: 1

Private Member Functions

bool autoDestruct () const
void setAutoDestruct (bool autoDestr)


class QFontEngineBox
class QFontEngineFT
class QFontEngineMac
class QFontEngineQPF
class QFontEngineQPF1
class QFontEngineWin
class QMacCGContext
class QMacPrintEngine
class QMacPrintEnginePrivate
class QPainter
class QPainterPrivate
class QPSPrintEngine
class QWidget
class QWin32PaintEngine
class QWin32PaintEnginePrivate

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

Generated by  Doxygen 1.6.0   Back to index