|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QDirectPainter Class Reference
[QtGui module]

The QDirectPainter class provides direct access to the video hardware. More...

     #include <QDirectPainter>

This class is under development and is subject to change.

Inherits QObject.

- List of all members, including inherited members
- Obsolete members

### Public Types

- enum SurfaceFlag { NonReserved, Reserved }

### Public Functions

- QDirectPainter ( QObject * parent = 0, SurfaceFlag flag = NonReserved )
- ~QDirectPainter ()
- QRegion allocatedRegion () const
- void endPainting ()
- QRect geometry () const
- void lower ()
- void raise ()
- virtual void regionChanged ( const QRegion & region )
- QRegion requestedRegion () const
- void setGeometry ( const QRect & rect )
- void setRegion ( const QRegion & region )
- void startPainting ( bool lockDisplay = false )
- WId winId () const

- 29 public functions inherited from QObject

### Static Public Members

- uchar * frameBuffer ()
- int linestep ()
- void lock ()
- QRegion reserveRegion ( const QRegion & region )
- QRegion reservedRegion ()
- int screenDepth ()
- int screenHeight ()
- int screenWidth ()
- void unlock ()

- 5 static public members inherited from QObject

### Additional Inherited Members

- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 signal inherited from QObject
- 7 protected functions inherited from QObject

## Detailed Description

The QDirectPainter class provides direct access to the video hardware.

When the hardware is known and well defined, as is often the case with software for embedded devices, it may be useful to manipulate the underlying video hardware directly. Note that this functionality is only available in Qtopia Core.

Access to the video hardware is provided by the frameBuffer() function which returns a pointer to the beginning of the display memory. In order to access the video hardware in a way that is co-operative with other applications, a region of the screen must be reserved for the application, QDirectPainter provides the necessary functionality: The reserveRegion() function attempts to reserve the given region and returns the region actually reserved. The reserved region can also be retrieved using the reservedRegion() function.

Depending on the hardware, it might be necessary to lock the video hardware for exclusive use while writing to it. This is possible using the lock() and unlock() functions. Note that calling lock() will prevent all other applications from working until unlock() is called.

In addition, QDirectPainter provides several functions returning information about the framebuffer as well as the screen: the linestep() function returns the length (in bytes) of each scanline of the framebuffer while the screenDepth(), screenWidth() and screenHeight() function return the screen metrics.

See also QScreen and QDecoration.

## Member Type Documentation

### enum QDirectPainter::SurfaceFlag

## Member Function Documentation

### QDirectPainter::QDirectPainter ( QObject * parent = 0, SurfaceFlag flag = NonReserved )

Constructs a QDirectPainter with parent parent and flag flags.

### QDirectPainter::~QDirectPainter ()

Destroys the object.

The reserved region will be released.

### QRegion QDirectPainter::allocatedRegion () const

Returns the region allocated to this QDirectPainter.

This function was introduced in Qt 4.2.

### void QDirectPainter::endPainting ()

This function was introduced in Qt 4.2.

### uchar * QDirectPainter::frameBuffer () `[static]`

Returns a pointer to the beginning of the display memory.

Note that it is the applications responsibility to limit itself to modifying only the reserved region.

See also reservedRegion() and linestep().

### QRect QDirectPainter::geometry () const

Returns the bounding rect of the requested region.

This function was introduced in Qt 4.2.

See also setGeometry() and requestedRegion().

### int QDirectPainter::linestep () `[static]`

Returns the length (in bytes) of each scanline of the framebuffer.

See also frameBuffer().

### void QDirectPainter::lock () `[static]`

Locks access to the video hardware.

Note that calling this function will prevent all other applications from working until unlock() is called.

See also unlock().

### void QDirectPainter::lower ()

This function was introduced in Qt 4.2.

### void QDirectPainter::raise ()

This function was introduced in Qt 4.2.

### void QDirectPainter::regionChanged ( const QRegion & region ) `[virtual]`

This function is called whenever the allocated region changes.

This function was introduced in Qt 4.2.

### QRegion QDirectPainter::requestedRegion () const

Returns the region requested by this QDirectPainter.

This function was introduced in Qt 4.2.

See also setRegion() and allocatedRegion().

### QRegion QDirectPainter::reserveRegion ( const QRegion & region ) `[static]`

Attempts to reserve the given region, and returns the region that is actually reserved.

This function also releases the previously reserved region if any. If not released explicitly, the region will be released on application exit.

See also reservedRegion().

### QRegion QDirectPainter::reservedRegion () `[static]`

Returns the reserved region.

This function was introduced in Qt 4.2.

See also reserveRegion() and frameBuffer().

### int QDirectPainter::screenDepth () `[static]`

Returns the bit depth of the display.

See also screenHeight() and screenWidth().

### int QDirectPainter::screenHeight () `[static]`

Returns the height of the display in pixels.

See also screenWidth() and screenDepth().

### int QDirectPainter::screenWidth () `[static]`

Returns the width of the display in pixels.

See also screenHeight() and screenDepth().

### void QDirectPainter::setGeometry ( const QRect & rect )

Request to reserve the rectangle rect of the screen.

The requested rectangle will be the maximum available rectangle for this object. The actually allocated region may be less, for instance if the rectangle overlaps with another QDirectPainter.

This function was introduced in Qt 4.2.

See also geometry(), allocatedRegion(), and setRegion().

### void QDirectPainter::setRegion ( const QRegion & region )

Request to reserve the region region of the screen.

The requested region will be the maximum available region for this object. The actually allocated region may be less, for instance if the region overlaps with another QDirectPainter.

This function was introduced in Qt 4.2.

See also region().

### void QDirectPainter::startPainting ( bool lockDisplay = false )

This function was introduced in Qt 4.2.

### void QDirectPainter::unlock () `[static]`

Unlocks the lock on the video hardware (set by the lock() function), allowing other applications to access the screen.

See also lock().

### WId QDirectPainter::winId () const

Returns the window system identifier of the widget.

This function was introduced in Qt 4.2.