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

## com.trolltech.qt.gui
Class QPaintDevice

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.gui.QPaintDevice

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public abstract class QPaintDevice

extends QtJambiObject
implements QPaintDeviceInterface

The `QPaintDevice` class is the base class of objects that can be painted.

A paint device is an abstraction of a two-dimensional space that can be drawn using a `QPainter`. Its default coordinate system has its origin located at the top-left position. X increases to the right and Y increases downwards. The unit is one pixel.

The drawing capabilities of `QPaintDevice` are currently implemented by the `QWidget`, `QImage`, `QPixmap`, `QGLPixelBuffer`, `QPicture`, and `QPrinter` subclasses.

To implement support for a new backend, you must derive from `QPaintDevice` and reimplement the virtual `paintEngine` function to tell `QPainter` which paint engine should be used to draw on this particular device. Note that you also must create a corresponding paint engine to be able to draw on the device, i.e derive from `QPaintEngine` and reimplement its virtual functions.

Warning: Qt requires that a `QApplication` object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.

The `QPaintDevice` class provides several functions returning the various device metrics: The `depth` function returns its bit depth (number of bit planes). The `height` function returns its height in default coordinate system units (e.g. pixels for `QPixmap` and `QWidget`) while `heightMM` returns the height of the device in millimeters. Similiarily, the `width` and `widthMM` functions return the width of the device in default coordinate system units and in millimeters, respectively. Alternatively, the protected `metric` function can be used to retrieve the metric information by specifying the desired `PaintDeviceMetric` as argument.

The `logicalDpiX` and `logicalDpiY` functions return the horizontal and vertical resolution of the device in dots per inch. The `physicalDpiX` and `physicalDpiY` functions also return the resolution of the device in dots per inch, but note that if the logical and vertical resolution differ, the corresponding `QPaintEngine` must handle the mapping. Finally, the `numColors` function returns the number of different colors available for the paint device.

See Also:
  `QPaintEngine`, `QPainter`, The Coordinate System, The Paint System

Nested Class Summary
`static class` | `QPaintDevice.PaintDeviceMetric` Describes the various metrics of a paint device.

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, 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
`QPaintDevice()` Constructs a paint device.

Method Summary
`int` | `depth()` Returns the bit depth (number of bit planes) of the paint device.
`int` | `devType()`
`static QPaintDevice` | `fromNativePointer(QNativePointer nativePointer)` This function returns the QPaintDevice instance pointed to by nativePointer
`int` | `height()` Returns the height of the paint device in default coordinate system units (e.g. pixels for `QPixmap` and `QWidget`).
`int` | `heightMM()` Returns the height of the paint device in millimeters.
`int` | `logicalDpiX()` Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes.
`int` | `logicalDpiY()` Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes.
`int` | `metric(QPaintDevice.PaintDeviceMetric metric)` Returns the metric information for the given paint device `metric`.
`int` | `numColors()` Returns the number of different colors available for the paint device.
`abstract QPaintEngine` | `paintEngine()` Returns a pointer to the paint engine used for drawing on the device.
`boolean` | `paintingActive()` Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.
`int` | `physicalDpiX()` Returns the horizontal resolution of the device in dots per inch.
`int` | `physicalDpiY()` Returns the horizontal resolution of the device in dots per inch.
`int` | `width()` Returns the width of the paint device in default coordinate system units (e.g. pixels for `QPixmap` and `QWidget`).
`int` | `widthMM()` Returns the width of the paint device in millimeters.

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

### QPaintDevice

    public QPaintDevice()

  Constructs a paint device. This constructor can be invoked only from subclasses of `QPaintDevice`.

Method Detail

### depth

    public final int depth()

  Returns the bit depth (number of bit planes) of the paint device.

  Specified by:
    `depth` in interface `QPaintDeviceInterface`

### height

    public final int height()

  Returns the height of the paint device in default coordinate system units (e.g. pixels for `QPixmap` and `QWidget`).

  Specified by:
    `height` in interface `QPaintDeviceInterface`
  See Also:
    `heightMM`

### heightMM

    public final int heightMM()

  Returns the height of the paint device in millimeters.

  Specified by:
    `heightMM` in interface `QPaintDeviceInterface`
  See Also:
    `height`

### logicalDpiX

    public final int logicalDpiX()

  Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from `widthMM`, but it varies on Windows.

  Note that if the `logicalDpiX` doesn't equal the `physicalDpiX`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `logicalDpiX` in interface `QPaintDeviceInterface`
  See Also:
    `logicalDpiY`, `physicalDpiX`

### logicalDpiY

    public final int logicalDpiY()

  Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from `heightMM`, but it varies on Windows.

  Note that if the `logicalDpiY` doesn't equal the `physicalDpiY`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `logicalDpiY` in interface `QPaintDeviceInterface`
  See Also:
    `logicalDpiX`, `physicalDpiY`

### numColors

    public final int numColors()

  Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.

  Specified by:
    `numColors` in interface `QPaintDeviceInterface`

### paintingActive

    public final boolean paintingActive()

  Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

  Specified by:
    `paintingActive` in interface `QPaintDeviceInterface`
  See Also:
    `QPainter::isActive`

### physicalDpiX

    public final int physicalDpiX()

  Returns the horizontal resolution of the device in dots per inch.

  Note that if the `physicalDpiX` doesn't equal the `logicalDpiX`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `physicalDpiX` in interface `QPaintDeviceInterface`
  See Also:
    `physicalDpiY`, `logicalDpiX`

### physicalDpiY

    public final int physicalDpiY()

  Returns the horizontal resolution of the device in dots per inch.

  Note that if the `physicalDpiY` doesn't equal the `logicalDpiY`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `physicalDpiY` in interface `QPaintDeviceInterface`
  See Also:
    `physicalDpiX`, `logicalDpiY`

### width

    public final int width()

  Returns the width of the paint device in default coordinate system units (e.g. pixels for `QPixmap` and `QWidget`).

  Specified by:
    `width` in interface `QPaintDeviceInterface`
  See Also:
    `widthMM`

### widthMM

    public final int widthMM()

  Returns the width of the paint device in millimeters.

  Specified by:
    `widthMM` in interface `QPaintDeviceInterface`
  See Also:
    `width`

### devType

    public int devType()

  Specified by:
    `devType` in interface `QPaintDeviceInterface`

### metric

    public int metric(QPaintDevice.PaintDeviceMetric metric)

  Returns the metric information for the given paint device `metric`.

  Specified by:
    `metric` in interface `QPaintDeviceInterface`
  See Also:
    `PaintDeviceMetric`

### paintEngine

    public abstract QPaintEngine paintEngine()

  Returns a pointer to the paint engine used for drawing on the device.

  Specified by:
    `paintEngine` in interface `QPaintDeviceInterface`

### fromNativePointer

    public static QPaintDevice fromNativePointer(QNativePointer nativePointer)

  This function returns the QPaintDevice instance pointed to by nativePointer

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

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