QDirectPainter(3qt)
β¨ NAME β¨
QDirectPainter β direct access to the video hardware, no middleman, no cap π
πΈ SYNOPSIS πΈ
#include <qdirectpainter_qws.h>
Okay so first things first: it inherits QPainter. So it's a painter, but make it direct. π¦
π Public Members
QDirectPainter ( const QWidget * w )~QDirectPainter ()uchar * frameBuffer ()int lineStep ()int transformOrientation ()int numRects () constconst QRect & rect ( int i ) constQRegion region () constint depth () constint width () constint height () constint xOffset () constint yOffset () constQPoint offset () constQSize size () constvoid setAreaChanged ( const QRect & r )
π DESCRIPTION π
The QDirectPainter class gives you direct access to the video hardware. Iconic, honestly.
Not me needing to say this but: it's only available in Qt/Embedded. π§
So here's the vibe. When the hardware is known and well defined β which is literally the whole situation with embedded device software β it can be genuinely useful to poke the underlying video hardware yourself. But you can't just barge in, bestie. To do it co-operatively with other applications you have to:
- Lock the video hardware for exclusive use for a short little moment while you write to it.
- Know the clipping region that's been allocated to a widget.
QDirectPainter hands you both of those. Periodt. β¨
In the simplest case, you make a QDirectPainter on a widget and then β observing the clip region β you go do some platform-specific operation. Like, for example:
void MyWidget::updatePlatformGraphics()
{
QDirectPainter dp( this );
for ( int i = 0; i < dp.numRects; i++ ) {
const QRect& clip = dp.rect(i);
... // platform specific operation
}
}
Your platform-specific code has access to the display, but it should ONLY modify graphics in the rectangles specified by numRects() and rect(). And heads up: those rectangles are relative to the entire display, not to your widget. iykyk.
The offset() function returns the position of the widget relative to the entire display, so you can offset your platform-specific operations appropriately. And xOffset() and yOffset() are just the component values of offset(), one each. π«Ά
For simple frame-buffer hardware, frameBuffer(), lineStep() and depth() give you the basic access β though ngl, some hardware configurations are just insufficiently specified by such simple parameters. π€·βοΈ
π¨ BIG ONE. While a QDirectPainter exists, the entire Qt/Embedded window system is locked from use by other applications. Always construct the QDirectPainter as an auto (stack) variable, and be very careful to write robust and stable code within its scope. This is not the vibe to be sloppy in. π
See also Graphics Classes.
π MEMBER FUNCTION DOCUMENTATION π
QDirectPainter::QDirectPainter ( const QWidget * w )β Constructs a direct painter on w. The display gets locked, and the mouse cursor is hidden if it's above w. π±οΈπQDirectPainter::~QDirectPainter ()β Destroys the direct painter. The mouse cursor is revealed if necessary, and the display is unlocked. Closing the loop, as she should. πint QDirectPainter::depth () constβ Returns the bit-depth of the display.uchar * QDirectPainter::frameBuffer ()β Returns a pointer to the framebuffer memory, if available. (Emphasis on if available, bestie.)int QDirectPainter::height () constβ Returns the height of the widget drawn upon.int QDirectPainter::lineStep ()β Returns the spacing in bytes from one framebuffer line to the next. π§int QDirectPainter::numRects () constβ Returns the number of rectangles in the drawable region.
See also rect() and region().
QPoint QDirectPainter::offset () constβ Returns the position of the widget relative to the entire display.const QRect & QDirectPainter::rect ( int i ) constβ Returns a reference to rectangle i of the drawable region. Valid values for i are0..numRects()-1.
See also region().
QRegion QDirectPainter::region () constβ Returns the region of the framebuffer which represents the exposed area of the widget being painted on. β οΈ Note that this may be a sub-area of the clip region, because of child widgets and overlapping cousin widgets. It's giving family drama.
See also numRects() and rect().
void QDirectPainter::setAreaChanged ( const QRect & r )β Sets the area changed by the transaction to r. By default, the entire widget is assumed to have changed. The area changed is only used by some graphics drivers, so often calling this function for a smaller area will make no difference to performance. (Yeah. Sometimes you do the work and nothing happens. So relatable. π)QSize QDirectPainter::size () constβ Returns the size of the widget drawn upon.
See also width() and height().
int QDirectPainter::transformOrientation ()β Returns a number that signifies the orientation of the framebuffer. And then the docs justβ¦ have a little stray markup artifact sitting here (.nfand</center>, if you were wondering what that ghost was). We're leaving it exactly as we found it. π«Άint QDirectPainter::width () constβ Returns the width of the widget drawn upon.int QDirectPainter::xOffset () constβ Returns the X-position of the widget relative to the entire display.int QDirectPainter::yOffset () constβ Returns the Y-position of the widget relative to the entire display.
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. π
π¦ AUTHOR π¦
Generated automatically from the source code. (A robot wrote this. Respect. π€β¨)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά
The definitive Qt documentation is provided in HTML format; it lives at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qdirectpainter.3qt) and the Qt version (3.3.8). Don't be shy, bestie, they literally asked. π
Trolltech AS Β· 2 February 2007 Β· QDirectPainter(3qt)
okay that's the whole thing, ily, go lock some video hardware (responsibly, on the stack, for a small time only) πππΈ
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms