Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDirectPainter Class

TheQDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux.More...

Header:#include <QDirectPainter>
Inherits:QObject

Public Types

enumSurfaceFlag { NonReserved, Reserved, ReservedSynchronous }

Public Functions

QDirectPainter(QObject * parent = 0, SurfaceFlag flag = NonReserved)
~QDirectPainter()
QRegionallocatedRegion() const
voidendPainting()
voidendPainting(const QRegion & region)
voidflush(const QRegion & region)
QRectgeometry() const
voidlower()
voidraise()
virtual voidregionChanged(const QRegion & newRegion)
QRegionrequestedRegion() const
voidsetGeometry(const QRect & rectangle)
voidsetRegion(const QRegion & region)
voidstartPainting(bool lockDisplay = true)
WIdwinId() const
  • 29 public functions inherited fromQObject

Static Public Members

uchar *frameBuffer()
intlinestep()
voidlock()
intscreenDepth()
intscreenHeight()
intscreenWidth()
voidunlock()
  • 7 static public members inherited fromQObject

Additional Inherited Members

  • 1 property inherited fromQObject
  • 1 public slot inherited fromQObject
  • 1 signal inherited fromQObject
  • 8 protected functions inherited fromQObject

Detailed Description

TheQDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux.

Note that this class is only available inQt for Embedded Linux.

QDirectPainter allows a client application to reserve a region of the framebuffer and render directly onto the screen. There are two ways of using theQDirectPainter class: You can either reserve a region using the provided static functions, or you can instantiate an object and make use of its more dynamic API.

Dynamic Allocation

By instantiating aQDirectPainter object using the defaultQDirectPainter::NonReserved surface flag, the client application only gets some control over the reserved region, i.e., it can still render directly onto the screen but the allocated region may change (for example, if a window with a higher focus requests parts of the same region). The currently allocated region can be retrieved using theallocatedRegion() function, while therequestedRegion() function returns the originally reserved region.

Static Allocation

Using the static approach, the client application gets complete control over the reserved region, i.e., the affected region will never be modified by the screen driver.

To create a static region, pass theQDirectPainter::Reserved surface flag to the constructor. After the reserved region is reported throughregionChanged(), the allocated region will not change, unlesssetRegion() is called.

IfQDirectPainter::ReservedSynchronous is passed to the constructor, calls tosetRegion() will block until the region is reserved, meaning thatallocatedRegion() will be available immediately. Note that in the current versionsetRegion() will cause the application event loop to be entered, potentially causing reentrancy issues.

Rendering

To draw on a given region, the application must first get hold of a pointer to the framebuffer. In most cases, this pointer can be retrieved using theQDirectPainter::frameBuffer() function. But note that if the current screen has subscreens, you must query the screen driver instead to identify the correct subscreen. A pointer to the current screen driver can always be retrieved using the staticQScreen::instance() function. Then useQScreen'ssubScreenIndexAt() andsubScreens() functions to access the correct subscreen, and the subscreen'sbase() function to retrieve a pointer to the framebuffer.

Depending on the hardware, it might be necessary to lock the framebuffer for exclusive use while writing to it. This is possible using thelock() andunlock() functions. Note that callinglock() will prevent all other applications from working untilunlock() is called.

In addition,QDirectPainter provides several functions returning information about the framebuffer: thelinestep() function returns the length (in bytes) of each scanline of the framebuffer while thescreenDepth(),screenWidth() andscreenHeight() function return the screen metrics.

See alsoQScreen,QWSEmbedWidget, andQt for Embedded Linux Architecture.

Member Type Documentation

enum QDirectPainter::SurfaceFlag

This enum describes the behavior of the region reserved by thisQDirectPainter object.

ConstantValueDescription
QDirectPainter::NonReserved0The allocated region may change, e.g., if a window with a higher focus requests parts of the same region. See alsoDynamic Allocation.
QDirectPainter::Reserved1The allocated region will never change. See alsoStatic Allocation.
QDirectPainter::ReservedSynchronous3The allocated region will never change and each function that changes the allocated region will be blocking.

See alsoallocatedRegion().

Member Function Documentation

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

Constructs aQDirectPainter object with the givenparent and surfaceflag.

QDirectPainter::~QDirectPainter()

Destroys thisQDirectPainter object, releasing the reserved region.

See alsoallocatedRegion().

QRegion QDirectPainter::allocatedRegion() const

Returns the currently reserved region.

Note that if theQDirectPainter::Reserved flag is set, the region returned by this function will always be equivalent to the region returned by therequestedRegion() function. Otherwise they might differ (seeDynamic Allocation for details).

This function was introduced in Qt 4.2.

See alsorequestedRegion() andgeometry().

void QDirectPainter::endPainting()

Call this function when you are done updating the screen. It will notify the hardware, if necessary, that your painting operations have ended.

This function was introduced in Qt 4.2.

void QDirectPainter::endPainting(constQRegion & region)

This is an overloaded function.

This function will automatically callflush() to flush theregion to the display before notifying the hardware, if necessary, that painting operations have ended.

This function was introduced in Qt 4.3.

void QDirectPainter::flush(constQRegion & region)

Flushes theregion onto the screen.

This function was introduced in Qt 4.3.

[static]uchar * QDirectPainter::frameBuffer()

Returns a pointer to the beginning of the display memory.

Note that it is the application's responsibility to limit itself to modifying only the reserved region.

Do not use this pointer if the current screen has subscreens, query the screen driver instead: A pointer to the current screen driver can always be retrieved using the staticQScreen::instance() function. Then useQScreen'ssubScreenIndexAt() andsubScreens() functions to access the correct subscreen, and the subscreen'sbase() function to retrieve a pointer to the framebuffer.

See alsorequestedRegion(),allocatedRegion(), andlinestep().

QRect QDirectPainter::geometry() const

Returns the bounding rectangle of the requested region.

This function was introduced in Qt 4.2.

See alsosetGeometry() andrequestedRegion().

[static]int QDirectPainter::linestep()

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

See alsoframeBuffer().

[static]void QDirectPainter::lock()

Locks access to the framebuffer.

Note that calling this function will prevent all other applications from updating the display untilunlock() is called.

See alsounlock().

void QDirectPainter::lower()

Lowers the reserved region to the bottom of the widget stack.

After this call the reserved region will be visually behind (and therefore obscured by) any overlapping widgets.

This function was introduced in Qt 4.2.

See alsoraise() andrequestedRegion().

void QDirectPainter::raise()

Raises the reserved region to the top of the widget stack.

After this call the reserved region will be visually in front of any overlapping widgets.

This function was introduced in Qt 4.2.

See alsolower() andrequestedRegion().

[virtual]void QDirectPainter::regionChanged(constQRegion & newRegion)

This function is called when the allocated region changes.

This function is not called for region changes that happen while thestartPainting() function is executing.

Note that the given region,newRegion, is not guaranteed to be correct at the time you access the display. To prevent reentrancy problems you should always callstartPainting() before updating the display and then useallocatedRegion() to retrieve the correct region.

This function was introduced in Qt 4.2.

See alsoallocatedRegion(),startPainting(), andDynamic Allocation.

QRegion QDirectPainter::requestedRegion() const

Returns the region requested by thisQDirectPainter.

Note that if theQDirectPainter::Reserved flag is set, the region returned by this function will always be equivalent to the region returned by theallocatedRegion() function. Otherwise they might differ (seeDynamic Allocation for details).

This function was introduced in Qt 4.2.

See alsogeometry(),setRegion(), andallocatedRegion().

[static]int QDirectPainter::screenDepth()

Returns the bit depth of the display.

See alsoscreenHeight() andscreenWidth().

[static]int QDirectPainter::screenHeight()

Returns the height of the display in pixels.

See alsoscreenWidth() andscreenDepth().

[static]int QDirectPainter::screenWidth()

Returns the width of the display in pixels.

See alsoscreenHeight() andscreenDepth().

void QDirectPainter::setGeometry(constQRect & rectangle)

Request to reserve the givenrectangle of the framebuffer.

Note that the actually allocated region might differ from the requested one, e.g., if the given region overlaps with the region of anotherQDirectPainter object.

This function was introduced in Qt 4.2.

See alsogeometry(),allocatedRegion(), andsetRegion().

void QDirectPainter::setRegion(constQRegion & region)

Requests to reserve the givenregion of the framebuffer.

Note that the actually allocated region might differ from the requested one, e.g., if the given region overlaps with the region of anotherQDirectPainter object.

This function was introduced in Qt 4.2.

See alsoregion(),requestedRegion(),allocatedRegion(), andDynamic Allocation.

void QDirectPainter::startPainting(bool lockDisplay = true)

Call this function before you start updating the pixels in the allocated region. The hardware will be notified, if necessary, that you are about to start painting operations.

SetlockDisplay if you want startPainting() andendPainting() tolock() andunlock() the display automatically.

Note that for aNonReserved direct painter, you must callallocatedRegion() after calling this function, since the allocated region is only guaranteed to be correct after this function has returned.

TheregionChanged() function will not be called between startPainting() andendPainting().

This function was introduced in Qt 4.2.

See alsoendPainting() andflush().

[static]void QDirectPainter::unlock()

Unlocks the lock on the framebuffer (set using thelock() function), allowing other applications to access the screen.

See alsolock().

WId QDirectPainter::winId() const

Returns the window system identifier of the widget.

This function was introduced in Qt 4.2.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp