CopperSpice API
1.9.2
|
Abstract definition of how QPainter draws to a given device on a given platform. More...
Inherited by QAlphaPaintEngine, QPaintEngineEx, QPdfEngine, QPicturePaintEngine, QPreviewPaintEngine
Public Types | |
enum | PolygonDrawMode |
enum | Type |
Public Methods | |
QPaintEngine (PaintEngineFeatures options=PaintEngineFeatures ()) | |
virtual | ~QPaintEngine () |
virtual bool | begin (QPaintDevice *pdev) = 0 |
virtual void | drawEllipse (const QRect &rect) |
virtual void | drawEllipse (const QRectF &rect) |
virtual void | drawImage (const QRectF &rect, const QImage &image, const QRectF &srcRect, Qt::ImageConversionFlags flags=Qt::AutoColor) |
virtual void | drawLines (const QLine *lines, int lineCount) |
virtual void | drawLines (const QLineF *lines, int lineCount) |
virtual void | drawPath (const QPainterPath &path) |
virtual void | drawPixmap (const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) = 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 QRect *rects, int rectCount) |
virtual void | drawRects (const QRectF *rects, int rectCount) |
virtual void | drawTextItem (const QPointF &point, const QTextItem &textItem) |
virtual void | drawTiledPixmap (const QRectF &rect, const QPixmap &pixmap, const QPointF &point) |
virtual bool | end () = 0 |
bool | hasFeature (PaintEngineFeatures feature) const |
bool | isActive () const |
QPaintDevice * | paintDevice () const |
QPainter * | painter () const |
void | setActive (bool newState) |
virtual Type | type () const = 0 |
virtual void | updateState (const QPaintEngineState &state) = 0 |
Friends | |
class | QPainter |
class | QWidget |
The QPaintEngine class provides an abstract definition for how QPainter draws to a given device on a given platform.
CopperSpice provides implementations of QPaintEngine for the different painter backends. There is one paint engine for each window system and painting supported platform. This includes X11 on Unix/Linux and Cocoa on Mac OS X.
QPaintEngine implementations are also provided for OpenGL (accessible through QGLWidget) and PostScript (accessible through QPSPrinter on X11). There is another raster-based paint engine which is a fallback for when an engine does not support a certain capability.
Use the QPainter class to draw to a different backend, subclass QPaintEngine and reimplement all virtual methods. The QPaintEngine class implementation is then made available by subclassing QPaintDevice and reimplementing the virtual method QPaintDevice::paintEngine().
QPaintEngine is created and owned by the QPaintDevice that created it.
Constant | Value | Description |
---|---|---|
QPaintEngine::OddEvenMode | 0 | The polygon should be drawn using OddEven fill rule. |
QPaintEngine::WindingMode | 1 | The polygon should be drawn using Winding fill rule. |
QPaintEngine::ConvexMode | 2 | The polygon is a convex polygon and can be drawn using specialized algorithms where available. |
QPaintEngine::PolylineMode | 3 | Only the outline of the polygon should be drawn. |
enum QPaintEngine::Type |
Constant | Value | Description |
---|---|---|
QPaintEngine::X11 | 0 | |
QPaintEngine::Windows | 1 | |
QPaintEngine::MacPrinter | 4 | |
QPaintEngine::CoreGraphics | 3 | Mac OS X's Quartz2D (CoreGraphics) |
QPaintEngine::QuickDraw | 2 | Mac OS X's QuickDraw |
QPaintEngine::QWindowSystem | 5 | For Embedded Linux |
QPaintEngine::PostScript | 6 | Not supported |
QPaintEngine::OpenGL | 7 | |
QPaintEngine::Picture | 8 | QPicture format |
QPaintEngine::SVG | 9 | Scalable Vector Graphics XML format |
QPaintEngine::Raster | 10 | |
QPaintEngine::Direct3D | 11 | Windows only, Direct3D based engine |
QPaintEngine::Pdf | 12 | Portable Document Format |
QPaintEngine::OpenVG | 13 | |
QPaintEngine::User | 50 | First user type ID |
QPaintEngine::MaxUser | 100 | Last user type ID |
QPaintEngine::OpenGL2 | 14 | |
QPaintEngine::PaintBuffer | 15 | |
QPaintEngine::Blitter | 16 |
|
explicit |
Creates a paint engine with the feature set specified by options.
|
virtual |
Destroys the paint engine.
|
pure virtual |
Reimplement this method to initialize your paint engine when painting is to start on the paint device pdev. Return true if the initialization was successful, otherwise return false.
Implemented in QRasterPaintEngine::begin()
|
virtual |
Reimplement this method to draw the largest ellipse that can be contained within rect. The default implementation calls drawPolygon().
|
virtual |
Reimplement this method to draw the largest ellipse that can be contained within rect. The default implementation calls drawPolygon().
Reimplemented in QRasterPaintEngine::drawEllipse()
|
virtual |
Reimplement this method to draw the part of the image specified by srcRect in the given rect using the given conversion flags, to convert it to a pixmap.
Reimplemented in QRasterPaintEngine::drawImage()
|
virtual |
The default implementation converts the list of lines starting at lines for the given number of lines, specified in lineCount, to a QLineF and calls the floating point version of this method.
Reimplemented in QRasterPaintEngine::drawLines()
|
virtual |
The default implementation splits the list of lines starting at lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.
Reimplemented in QRasterPaintEngine::drawLines()
|
virtual |
The default implementation ignores the path and does nothing.
|
pure virtual |
Reimplement to draw a portion of the pixmap specified by the rectangle srcRect, in the given rect.
Implemented in QRasterPaintEngine::drawPixmap()
|
virtual |
Draws points starting from points for the given number of points specified in pointCount.
Reimplemented in QRasterPaintEngine::drawPoints()
|
virtual |
Draws points starting from points for the given number of points specified in pointCount.
Reimplemented in QRasterPaintEngine::drawPoints()
|
virtual |
Draws a polygon defined by points starting at points for the given number of points specified in pointCount. The mode specifies the algorithm used to draw the polygon.
Reimplemented in QRasterPaintEngine::drawPolygon()
|
virtual |
Draws a polygon defined by points starting at points for the given number of points specified in pointCount. The mode specifies the algorithm used to draw the polygon.
Reimplemented in QRasterPaintEngine::drawPolygon()
|
virtual |
The default implementation converts rectangles starting from rects for the given number of rectangles specified in rectCount, to QRectF and calls the floating point version of this method.
Reimplemented in QRasterPaintEngine::drawRects()
|
virtual |
Draws rectangles starting from rects for the given number of rectangles specified in rectCount. The default implementation of this method calls drawPath() or drawPolygon() depending on the feature set of the paint engine.
Reimplemented in QRasterPaintEngine::drawRects()
Draws the text item textItem at position point. The default implementation of this method converts the text to a QPainterPath and paints the resulting path.
Reimplemented in QRasterPaintEngine::drawTextItem()
|
virtual |
Reimplement this method to draw the pixmap in the given rect, starting at the given point. The pixmap will be drawn repeatedly until the rect is filled.
Reimplemented in QRasterPaintEngine::drawTiledPixmap()
|
pure virtual |
Reimplement this method to finish painting on the current paint device. Returns true if painting was finished successfully, otherwise return false.
Implemented in QRasterPaintEngine::end()
|
inline |
Returns true if the paint engine supports the specified feature, otherwise returns false.
|
inline |
Returns true if the paint engine is actively drawing, otherwise returns false.
QPaintDevice * QPaintEngine::paintDevice | ( | ) | const |
Returns the device that this engine is painting on, if painting is active, otherwise returns a nullptr.
QPainter * QPaintEngine::painter | ( | ) | const |
Returns the paint engine's painter.
|
inline |
Sets the active state of the paint engine to newState.
|
pure virtual |
Reimplement this method to return the paint engine Type.
Implemented in QRasterPaintEngine::type()
|
pure virtual |
Reimplement this method to update the state of a paint engine.
This method is responsible for checking the paint engine's current state and updating the properties which have changed. Call QPaintEngineState::state() to find out which properties must be updated, then use the corresponding get methods to retrieve the current values for the given properties.