Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

QPaintEngine Class Reference

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

#include <QPaintEngine>

List of all members.

Public Types

Public Functions


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, GDI/GDI+ on Windows and QuickDraw/CoreGraphics on Mac OS X. In addition we provide QPaintEngine implementations for OpenGL (accessible through QGLWidget) and PostScript (accessible through QPSPrinter on X11).

If one wants to use QPainter to draw to a different backend, such as PDF, 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 the previous QPainter/QPaintDevice::cmd() approach is that it is now possible to adapt to multiple technologies on each platform and take advantage of the to the fullest.

See also QPainter and QPaintDevice::paintEngine().


Member Type Documentation

enum QPaintEngine::PaintEngineFeature
typedef QPaintEngine::PaintEngineFeatures

This enum is used to describe the features or capabilities that the paint engine has. If a feature is not supported by the engine, QPainter will do a best effort to emulate that feature through other means. The features that are currently emulated are: CoordTransform, PixmapTransform, LinearGradients, PixmapScale, SolidAlphaFill and ClipTransform.

QPaintEngine::CoordTransformThe engine can transform the points in a drawing operation.
QPaintEngine::PenWidthTransformThe engine has support for transforming pen widths.
QPaintEngine::PatternTransformThe engine has support for transforming brush patterns.
QPaintEngine::PixmapTransformThe engine can transform pixmaps, including rotation and shearing.
QPaintEngine::LinearGradientsThe engine can fill with linear gradients
QPaintEngine::DrawRectsThe engine can draw rectangles.
QPaintEngine::PixmapScaleThe engine can scale pixmaps.
QPaintEngine::SolidAlphaFillThe engine can fill and outline with alpha colors
QPaintEngine::PainterPathsThe engine has path support.
QPaintEngine::ClipTransformThe engine is capable of transforming clip regions.
QPaintEngine::PaintOutsidePaintEventThe engine is capable of painting outside of paint events.

The PaintEngineFeatures typedef can store a combination of PaintEngineFeature values.

enum QPaintEngine::Type

QPaintEngine::X11 
QPaintEngine::Windows 
QPaintEngine::Gdiplus(same as Windows)
QPaintEngine::QuickDraw(same as CoreGraphics)
QPaintEngine::MacPrinter 
QPaintEngine::CoreGraphicsMac OS X
QPaintEngine::QWindowSystemQt/Embedded
QPaintEngine::PostScript 
QPaintEngine::OpenGL 
QPaintEngine::PictureQPicture format
QPaintEngine::SVGScalable Vector Graphics XML format
QPaintEngine::UserFirst user type ID
QPaintEngine::MaxUserLast user type ID

Member Function Documentation

QPaintEngine::QPaintEngine ( PaintEngineFeatures caps = 0 )

Creates a paint engine with the featureset specified by caps.

QPaintEngine::~QPaintEngine ()   [virtual]

Destroys the paint engine.

bool QPaintEngine::begin ( QPaintDevice * pdev )   [pure 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() and isActive().

void QPaintEngine::clearRenderHints ( QPainter::RenderHints hints )

Clears the render hints specified by hints.

void QPaintEngine::drawArc ( const QRect & rectangle, int startAngle, int spanAngle )   [pure virtual]

Reimplement this function to draw the largest arc that can be contained within the given rectangle, starting at position startAngle and moving anti-clockwise by spanAngle.

void QPaintEngine::drawChord ( const QRect & rectangle, int startAngle, int spanAngle )   [pure virtual]

Reimplement this function to draw the largest chord that can be contained within the given rectangle, starting at position startAngle and moving anti-clockwise by spanAngle.

void QPaintEngine::drawConvexPolygon ( const QPointArray & pa, int index = 0, int npoints = -1 )   [pure virtual]

Reimplement this function to draw a convex polygon consisting of at most npoints points from the point array pa, starting with the index-th point in pa.

void QPaintEngine::drawCubicBezier ( const QPointArray & pa, int index = 0 )   [pure virtual]

Reimplement this function to draw a cubic bezier whose control points are given in the point array pa, starting with the index-th point in pa.

void QPaintEngine::drawEllipse ( const QRect & rectangle )   [pure virtual]

Reimplement this function to draw the largest ellipse that can be contained within the given rectangle.

void QPaintEngine::drawLine ( const QPoint & p1, const QPoint & p2 )   [pure virtual]

Reimplement this function to draw a line from point p1 to point p2.

void QPaintEngine::drawLineSegments ( const QPointArray & pa, int index = 0, int nlines = -1 )   [pure virtual]

Reimplement this function to draw at most nlines line segments between pairs of points in the point array pa, starting with the index-th point in pa.

void QPaintEngine::drawPath ( const QPainterPath & path )   [virtual]

The default implementation ignores the path and does nothing.

void QPaintEngine::drawPie ( const QRect & rectangle, int startAngle, int spanAngle )   [pure virtual]

Reimplement this function to draw the largest pie segment that can be contained within the given rectangle, starting at position startAngle and moving anti-clockwise by spanAngle.

void QPaintEngine::drawPixmap ( const QRect & rectangle, const QPixmap & pixmap, const QRect & sr, Qt::PixmapDrawingMode mode = Qt::ComposePixmap )   [pure virtual]

Reimplement this function to draw the part of the pixmap specified by the sr rectangle in the given rectangle using the given drawing mode.

void QPaintEngine::drawPoint ( const QPoint & point )   [pure virtual]

Reimplement this function to draw the given point.

void QPaintEngine::drawPoints ( const QPointArray & pa, int index = 0, int npoints = -1 )   [pure virtual]

Reimplement this function to draw at most npoints from the point array pa, starting at the index-th point in pa.

void QPaintEngine::drawPolygon ( const QPointArray & pa, bool winding = false, int index = 0, int npoints = -1 )   [pure virtual]

Reimplement this function to draw a polygon consisting of at most npoints points from the point array pa, starting with the index-th point in pa. If winding is true the polygon should be filled using the Winding algorithm; otherwise it should be filled using the Odd-Even algorithm.

void QPaintEngine::drawPolyline ( const QPointArray & pa, int index = 0, int npoints = -1 )   [pure virtual]

Reimplement this function to draw a polyline consisting of at most npoints points from the point array pa, starting with the index-th point in pa.

void QPaintEngine::drawRect ( const QRect & rectangle )   [pure virtual]

Reimplement this function to draw the given rectangle.

void QPaintEngine::drawRects ( const QList<QRect> & rects )   [virtual]

Draws the rectangles in the list rects.

void QPaintEngine::drawRoundRect ( const QRect & rectangle, int xRnd, int yRnd )   [pure virtual]

Reimplement this function to draw the given rectangle with rounded corners. The point (xRnd, yRnd) is the offset from which the rounded corner is notionally drawn.

void QPaintEngine::drawTextItem ( const QPoint & p, const QTextItem & ti, int textFlags )   [virtual]

This function draws the text item ti at position p in accordance with the given textFlags. The default implementation of this function renders the text to a pixmap and draws the resultant pixmap.

void QPaintEngine::drawTiledPixmap ( const QRect & rectangle, const QPixmap & pixmap, const QPoint & point, Qt::PixmapDrawingMode mode = Qt::ComposePixmap )   [pure virtual]

Reimplement this function to draw the pixmap in the given rectangle, starting at the given point. The pixmap will be drawn repeatedly until the rectangle is filled using the given mode.

bool QPaintEngine::end ()   [pure 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() and isActive().

bool QPaintEngine::hasFeature ( PaintEngineFeatures feature ) const

Returns true if the paint engine supports the specified feature; otherwise returns false.

bool QPaintEngine::isActive () const

Returns true if the paint engine is actively drawing; otherwise returns false.

See also setActive().

QPainter * QPaintEngine::painter () const

Returns the paint engine's painter.

QPainter::RenderHints QPaintEngine::renderHints () const

Returns the currently set renderhints.

void QPaintEngine::setActive ( bool state )

Sets the active state of the paint engine to state.

See also isActive().

void QPaintEngine::setRenderHints ( QPainter::RenderHints hints )

Sets the the render hints specified by hints in addition to the currently set render hints.

See also clearRenderHints().

QPainter::RenderHints QPaintEngine::supportedRenderHints () const   [virtual]

Returns the set of supported renderhints.

Type QPaintEngine::type () const   [pure virtual]

Reimplement this function to return the paint engine Type.

void QPaintEngine::updateBackground ( Qt::BGMode bgmode, const QBrush & brush )   [pure virtual]

This function is called when the engine needs to be updated with new background settings. bgmode describes the background mode and brush describes the background brush.

void QPaintEngine::updateBrush ( const QBrush & brush, const QPoint & origin )   [pure virtual]

This function is called when the engine needs to be updated with a new brush, specified with brush. origin describes the brush origin.

void QPaintEngine::updateClipRegion ( const QRegion & region, bool enabled )   [pure virtual]

This function is called when the clip region changes, specified by region or when clipping is enabled or disabled, specified by enabled.

void QPaintEngine::updateFont ( const QFont & f )   [pure virtual]

This function is called when the engine needs to be updated with a new font, specified by f

void QPaintEngine::updatePen ( const QPen & pen )   [pure virtual]

This function is called when the engine needs to be updated with the a new pen, specified by pen.

void QPaintEngine::updateRenderHints ( QPainter::RenderHints hints )   [virtual]

This function is caleed when the engine needs to be updated with the new set of renderhints specified by hints.

void QPaintEngine::updateXForm ( const QWMatrix & matrix )   [pure virtual]

This function is called when the engine needs to be updated with new transformation settings, specified with matrix.


Copyright © 2004 Trolltech. Trademarks
Qt 4.0.0-tp1