com.trolltech.qt.gui
Class QPaintEngine

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by 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, 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
          This QFlag class provides flags for the int enum.
static class QPaintEngine.PaintEngineFeature
          This enum is used to describe the features or capabilities that the paint engine has.
static class QPaintEngine.PaintEngineFeatures
          This QFlag class provides flags for the int enum.
static class QPaintEngine.PolygonDrawMode
          Press link for info on QPaintEngine.PolygonDrawMode
static class QPaintEngine.Type
          Press link for info on QPaintEngine.Type
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QPaintEngine()
          Equivalent to QPaintEngine(0).
QPaintEngine(QPaintEngine.PaintEngineFeatures features)
          Creates a paint engine with the featureset specified by features.
 
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)
          This method is used internally by Qt Jambi.
 void clearDirty(QPaintEngine.DirtyFlags df)
          This method is used internally by Qt Jambi.
 QPoint coordinateOffset()
          This method is used internally by Qt Jambi.
 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 r.
 void drawImage(QRectF r, QImage pm, QRectF sr)
          Equivalent to drawImage(r, pm, sr, Qt::AutoColor).
 void drawImage(QRectF r, QImage pm, QRectF sr, Qt.ImageConversionFlag... flags)
          Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r using the given conversion flags flags, to convert it to a pixmap.
 void drawImage(QRectF r, QImage pm, QRectF sr, Qt.ImageConversionFlags flags)
          Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r using the given conversion flags flags, to convert it to a pixmap.
 void drawLines(QLine[] lines)
          Equivalent to drawLines(lines, ).
 void drawLines(QLineF[] lines)
          Equivalent to drawLines(lines, ).
 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)
          Equivalent to drawPoints(points, ).
 void drawPoints(QPointF[] points)
          Equivalent to drawPoints(points, ).
 void drawPolygon(QPoint[] points, QPaintEngine.PolygonDrawMode mode)
          Equivalent to drawPolygon(points, mode, ).
 void drawPolygon(QPointF[] points, QPaintEngine.PolygonDrawMode mode)
          Equivalent to drawPolygon(points, mode, ).
 void drawRects(QRect[] rects)
          Equivalent to drawRects(rects, ).
 void drawRects(QRectF[] rects)
          Equivalent to drawRects(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 r, starting at the given s.
abstract  boolean end()
          Reimplement this function to finish painting on the current paint device.
static QPaintEngine fromNativePointer(QNativePointer nativePointer)
          This function returns the QPaintEngine instance pointed to by nativePointer
 boolean hasFeature(QPaintEngine.PaintEngineFeature... feature)
          Returns true if the paint engine supports the specified feature; otherwise returns false.
 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.
 void setActive(boolean newState)
          Sets the active state of the paint engine to newState.
protected  void setActive(int active)
          Sets the active state of the paint engine to active.
 void setDirty(QPaintEngine.DirtyFlag... df)
          This method is used internally by Qt Jambi.
 void setDirty(QPaintEngine.DirtyFlags df)
          This method is used internally by Qt Jambi.
protected  void setGccaps(QPaintEngine.PaintEngineFeature... gccaps)
          Sets this QPaintEngine's gccaps.
 void setSystemClip(QRegion baseClip)
          This method is used internally by Qt Jambi.
 void setSystemRect(QRect rect)
          This method is used internally by Qt Jambi.
 void syncState()
          This method is used internally by Qt Jambi.
 QRegion systemClip()
          This method is used internally by Qt Jambi.
 QRect systemRect()
          This method is used internally by Qt Jambi.
 boolean testDirty(QPaintEngine.DirtyFlag... df)
          This method is used internally by Qt Jambi.
 boolean testDirty(QPaintEngine.DirtyFlags df)
          This method is used internally by Qt Jambi.
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, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, 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()

Equivalent to QPaintEngine(0).


QPaintEngine

public QPaintEngine(QPaintEngine.PaintEngineFeatures features)

Creates a paint engine with the featureset specified by features.

Method Detail

clearDirty

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

This method is used internally by Qt Jambi. Do not use it in your applications.


clearDirty

public final void clearDirty(QPaintEngine.DirtyFlags df)

This method is used internally by Qt Jambi. Do not use it in your applications.


hasFeature

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

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


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 newState.

See Also:
active, isActive

setDirty

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

This method is used internally by Qt Jambi. Do not use it in your applications.


setDirty

public final void setDirty(QPaintEngine.DirtyFlags df)

This method is used internally by Qt Jambi. Do not use it in your applications.


setSystemClip

public final void setSystemClip(QRegion baseClip)

This method is used internally by Qt Jambi. Do not use it in your applications.

See Also:
systemClip

setSystemRect

public final void setSystemRect(QRect rect)

This method is used internally by Qt Jambi. Do not use it in your applications.

See Also:
systemRect

syncState

public final void syncState()

This method is used internally by Qt Jambi. Do not use it in your applications.


systemClip

public final QRegion systemClip()

This method is used internally by Qt Jambi. Do not use it in your applications.

See Also:
setSystemClip

systemRect

public final QRect systemRect()

This method is used internally by Qt Jambi. Do not use it in your applications.

See Also:
setSystemRect

testDirty

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

This method is used internally by Qt Jambi. Do not use it in your applications.


testDirty

public final boolean testDirty(QPaintEngine.DirtyFlags df)

This method is used internally by Qt Jambi. Do not use it in your applications.


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, isActive

coordinateOffset

public QPoint coordinateOffset()

This method is used internally by Qt Jambi. Do not use it in your applications.


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 r.

The default implementation calls drawPolygon.


drawImage

public final void drawImage(QRectF r,
                            QImage pm,
                            QRectF sr,
                            Qt.ImageConversionFlag... flags)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r using the given conversion flags flags, to convert it to a pixmap.


drawImage

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

Equivalent to drawImage(r, pm, sr, Qt::AutoColor).


drawImage

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

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r using the given conversion flags flags, to convert it to a pixmap.


drawLines

public void drawLines(QLineF[] lines)

Equivalent to drawLines(lines, ).


drawLines

public void drawLines(QLine[] lines)

Equivalent to drawLines(lines, ).


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(QPointF[] points)

Equivalent to drawPoints(points, ).


drawPoints

public void drawPoints(QPoint[] points)

Equivalent to drawPoints(points, ).


drawPolygon

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

Equivalent to drawPolygon(points, mode, ).


drawPolygon

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

Equivalent to drawPolygon(points, mode, ).


drawRects

public void drawRects(QRect[] rects)

Equivalent to drawRects(rects, ).


drawRects

public void drawRects(QRectF[] rects)

Equivalent to drawRects(rects, ).


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 r, starting at the given s. The pixmap will be drawn repeatedly until the r 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, 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

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)
Sets this QPaintEngine's gccaps.


fromNativePointer

public static QPaintEngine fromNativePointer(QNativePointer nativePointer)
This function returns the QPaintEngine instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.