Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QPaintEngine

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.gui.QPaintEngine

All Implemented Interfaces:
  QtJambiInterface

    public abstract class QPaintEngine

extends QtJambiObject

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`/QPaintDevice::cmd() 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()`, and The Paint System.

Nested Class Summary
`static class` | `QPaintEngine.DirtyFlag` These types are used by `QPainter` to trigger lazy updates of the various states in the `QPaintEngine` using `QPaintEngine::updateState()`.
`static class` | `QPaintEngine.DirtyFlags`
`static class` | `QPaintEngine.PaintEngineFeature` This enum is used to describe the features or capabilities that the paint engine has.
`static class` | `QPaintEngine.PaintEngineFeatures`
`static class` | `QPaintEngine.PolygonDrawMode`
`static class` | `QPaintEngine.Type`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QPaintEngine()` Creates a paint engine with the featureset specified by `caps`.
`QPaintEngine(QPaintEngine.PaintEngineFeature[] features)`
`QPaintEngine(QPaintEngine.PaintEngineFeatures features)` Creates a paint engine with the featureset specified by `caps`.

Method Summary
`protected int` | `active()` Returns the active state of this paint engine.
`abstract boolean` | `begin(QPaintDeviceInterface pdev)` Reimplement this function to initialise your paint engine when painting is to start on the paint device `pdev`.
`void` | `clearDirty(QPaintEngine.DirtyFlag[] df)`
`void` | `drawEllipse(QRect r)` The default implementation of this function calls the floating point version of this function
`void` | `drawEllipse(QRectF r)` Reimplement this function to draw the largest ellipse that can be contained within rectangle `rect`.
`void` | `drawImage(QRectF r, QImage pm, QRectF sr)` 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.
`void` | `drawImage(QRectF r, QImage pm, QRectF sr, Qt.ImageConversionFlag[] flags)`
`void` | `drawImage(QRectF r, QImage pm, QRectF sr, Qt.ImageConversionFlags flags)` 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.
`void` | `drawLines(QLine[] lines)` The default implementation converts the first `lineCount` lines in `lines` to a `QLineF` and calls the floating point version of this function.
`void` | `drawLines(QLineF[] lines)` 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.
`void` | `drawPath(QPainterPath path)` The default implementation ignores the `path` and does nothing.
`abstract void` | `drawPixmap(QRectF r, QPixmap pm, QRectF sr)` Reimplement this function to draw the part of the `pm` specified by the `sr` rectangle in the given `r`.
`void` | `drawPoints(QPoint[] points)` Draws the first `pointCount` points in the buffer `points`
`void` | `drawPoints(QPointF[] points)` Draws the first `pointCount` points in the buffer `points`
`void` | `drawPolygon(QPoint[] points, QPaintEngine.PolygonDrawMode mode)`
`void` | `drawPolygon(QPointF[] points, QPaintEngine.PolygonDrawMode mode)` Reimplement this virtual function to draw the polygon defined by the `pointCount` first points in `points`, using mode `mode`.
`void` | `drawRects(QRect[] rects)` The default implementation converts the first `rectCount` rectangles in the buffer `rects` to a `QRectF` and calls the floating point version of this function.
`void` | `drawRects(QRectF[] rects)` Draws the first `rectCount` rectangles in the buffer `rects`.
`void` | `drawTextItem(QPointF p, QTextItem textItem)` This function draws the text item `textItem` at position `p`.
`void` | `drawTiledPixmap(QRectF r, QPixmap pixmap, QPointF s)` Reimplement this function to draw the `pixmap` in the given `rect`, starting at the given `p`.
`abstract boolean` | `end()` Reimplement this function to finish painting on the current paint device.
`protected QPaintEngine.PaintEngineFeatures` | `gccaps()`
`boolean` | `hasFeature(QPaintEngine.PaintEngineFeature[] feature)`
`boolean` | `hasFeature(QPaintEngine.PaintEngineFeatures feature)` Returns true if the paint engine supports the specified `feature`; otherwise returns false.
`boolean` | `isActive()` Returns true if the paint engine is actively drawing; otherwise returns false.
`QPaintDeviceInterface` | `paintDevice()` Returns the device that this engine is painting on, if painting is active; otherwise returns 0.
`QPainter` | `painter()` Returns the paint engine's painter.
`protected int` | `selfDestruct()`
`void` | `setActive(boolean newState)` Sets the active state of the paint engine to `state`.
`protected void` | `setActive(int active)` Sets the active state of the paint engine to `active`.
`void` | `setDirty(QPaintEngine.DirtyFlag[] df)`
`protected void` | `setGccaps(QPaintEngine.PaintEngineFeature[] gccaps)`
`protected void` | `setGccaps(QPaintEngine.PaintEngineFeatures gccaps)`
`protected void` | `setSelfDestruct(int selfDestruct)`
`boolean` | `testDirty(QPaintEngine.DirtyFlag[] df)`
`abstract QPaintEngine.Type` | `type()` Reimplement this function to return the paint engine `Type` .
`abstract void` | `updateState(QPaintEngineState state)` Reimplement this function to update the state of a paint engine.

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QPaintEngine

    public QPaintEngine(QPaintEngine.PaintEngineFeature[] features)

### QPaintEngine

    public QPaintEngine()

  Creates a paint engine with the featureset specified by `caps`.

### QPaintEngine

    public QPaintEngine(QPaintEngine.PaintEngineFeatures features)

  Creates a paint engine with the featureset specified by `caps`.

Method Detail

### clearDirty

    public final void clearDirty(QPaintEngine.DirtyFlag[] df)

### hasFeature

    public final boolean hasFeature(QPaintEngine.PaintEngineFeature[] feature)

### hasFeature

    public final boolean hasFeature(QPaintEngine.PaintEngineFeatures feature)

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

### isActive

    public final boolean isActive()

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

See also:
  `setActive()`.

### paintDevice

    public final QPaintDeviceInterface paintDevice()

  Returns the device that this engine is painting on, if painting is active; otherwise returns 0.

### painter

    public final QPainter painter()

  Returns the paint engine's painter.

### setActive

    public final void setActive(boolean newState)

  Sets the active state of the paint engine to `state`.

See also:
  `isActive()`.

### setDirty

    public final void setDirty(QPaintEngine.DirtyFlag[] df)

### testDirty

    public final boolean testDirty(QPaintEngine.DirtyFlag[] df)

### begin

    public abstract boolean begin(QPaintDeviceInterface pdev)

  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()`.

### drawEllipse

    public void drawEllipse(QRect r)

  The default implementation of this function calls the floating point version of this function

### drawEllipse

    public void drawEllipse(QRectF r)

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

  The default implementation calls `drawPolygon()`.

### drawImage

    public final void drawImage(QRectF r,
                                QImage pm,
                                QRectF sr,
                                Qt.ImageConversionFlag[] flags)

### drawImage

    public final void drawImage(QRectF r,
                                QImage pm,
                                QRectF sr)

  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.

### drawImage

    public void drawImage(QRectF r,
                          QImage pm,
                          QRectF sr,
                          Qt.ImageConversionFlags flags)

  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.

### drawLines

    public void drawLines(QLine[] lines)

  The default implementation converts the first `lineCount` lines in `lines` to a `QLineF` and calls the floating point version of this function.

### drawLines

    public void drawLines(QLineF[] lines)

  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.

### drawPath

    public void drawPath(QPainterPath path)

  The default implementation ignores the `path` and does nothing.

### drawPixmap

    public abstract void drawPixmap(QRectF r,
                                    QPixmap pm,
                                    QRectF sr)

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

### drawPoints

    public void drawPoints(QPoint[] points)

  Draws the first `pointCount` points in the buffer `points`

  The default implementation converts the first `pointCount` QPoints in `points` to QPointFs and calls the floating point version of drawPoints.

### drawPoints

    public void drawPoints(QPointF[] points)

  Draws the first `pointCount` points in the buffer `points`

### drawPolygon

    public void drawPolygon(QPoint[] points,
                            QPaintEngine.PolygonDrawMode mode)

### drawPolygon

    public void drawPolygon(QPointF[] points,
                            QPaintEngine.PolygonDrawMode mode)

  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.

### drawRects

    public void drawRects(QRect[] rects)

  The default implementation converts the first `rectCount` rectangles in the buffer `rects` to a `QRectF` and calls the floating point version of this function.

### drawRects

    public void drawRects(QRectF[] rects)

  Draws the first `rectCount` rectangles in the buffer `rects`. The default implementation of this function calls `drawPath()` or `drawPolygon()` depending on the feature set of the paint engine.

### drawTextItem

    public void drawTextItem(QPointF p,
                             QTextItem textItem)

  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.

### drawTiledPixmap

    public void drawTiledPixmap(QRectF r,
                                QPixmap pixmap,
                                QPointF s)

  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.

### end

    public abstract boolean end()

  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()`.

### type

    public abstract QPaintEngine.Type type()

  Reimplement this function to return the paint engine `Type` .

### updateState

    public abstract void updateState(QPaintEngineState state)

  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 `get function` to retrieve the current values for the given properties.

See also:
  `QPaintEngineState`.

### setSelfDestruct

    protected final void setSelfDestruct(int selfDestruct)

### selfDestruct

    protected final int selfDestruct()

### setActive

    protected final void setActive(int active)

  Sets the active state of the paint engine to `active`.

### active

    protected final int active()

  Returns the active state of this paint engine.

### setGccaps

    protected final void setGccaps(QPaintEngine.PaintEngineFeature[] gccaps)

### setGccaps

    protected final void setGccaps(QPaintEngine.PaintEngineFeatures gccaps)

### gccaps

    protected final QPaintEngine.PaintEngineFeatures gccaps()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD