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

Inherits QObject.

- List of all members, including inherited members

### Static Public Members

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

- 4 static public members inherited from QObject

### Additional Inherited Members

- 1 property inherited from QObject
- 28 public functions 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 region() 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 Function Documentation

### 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 region() and linestep().

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

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

Returns the reserved region.

See also reserveRegion() and frameBuffer().

### 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 region().

### 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::unlock () `[static]`

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

See also lock().