The QPaintDevice is the base class of objects that can be painted. (details) (complete member list)
#include <qpaintd.h>
Inherited by QPicture, QPixmap, QPrinter and QWidget.
A paint device is an abstraction of a two-dimensional space that can be drawn into using a painter (see QPainter). The drawing capabilities are implemented by the subclasses: QWidget, QPixmap, QPicture and QPrinter.
The default coordinate system of a paint device has its origin located at the top left position. X increases to the left and Y increases to the bottom. The unit is one pixel. A user-defined coordinate system can be specified to the painter (see Q2DMatrix).
Here is an example how to draw on a paint device:
void GiraffeWidget::paintEvent( QPaintEvent * e ) {
QPainter p; // our painter
p.begin( this ); // start painting
p.setPen( red ); // blue outline
p.setBrush( yellow ); // yellow fill
p.drawEllipse( 10,20, 100,100 ); // 100x100 ellipse at 10,20
p.end(); // painting done
}
The bit block transfer is an extremely useful operation for copying pixels from one paint device to another (or to itself). It is implemented as the global function bitBlt().
This code demonstrates how to scroll the contents of a widget 10 pixels
to the right:
QWidget w;
bitBlt( &w, 10, 0, &w, 0, 0, -1, -1 );
Warning: Qt requires that a QApplication object must exist 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.
Constructs a paint device with internal flags devflags. This constructor can only be invoked from subclasses of QPaintDevice.
Destroys the paint device and frees window system resources.
Internal virtual function that interprets drawing commands from the painter.
Implemented by subclasses that have no direct support for drawing graphics (for instance QPicture). Reimplemented in QPicture.
Returns the device type identifier: PDT_WIDGET,
PDT_PIXMAP,
PDT_PRINTER
or PDT_PICTURE.
Returns a pointer to the X display (X-Windows only).
Returns the window system handle of the paint device (Windows only).
Returns the window system handle of the paint device (OS/2 PM only).
Returns the window system handle of the paint device (X-Windows only).
Returns TRUE if the device is a so-called external paint device.
External paint devices cannot be bitBlt'ed from.
Internal virtual function that returns paint device metrics.
Implemented by all subclasses. Reimplemented in QPixmap and QWidget.
Returns TRUE if the device is currently active (someone has called QPainter::begin() and not yet QPainter::end() on this device).
This function copies a block of pixels from one paint device to another (bitBlt means bit block transfer).
Arguments:
If sw is negative, then bitBlt calculates
sw = src->width - sx.
If sh is negative, then bitBlt calculates
sh = src->height - sy.
The rop parameter can be one of:
CopyROP:
dst = src.
OrROP:
dst = dst OR src.
XorROP:
dst = dst XOR src.
EraseROP:
dst = (NOT src) AND dst
NotCopyROP:
dst = NOT src
NotOrROP:
dst = (NOT src) OR dst
NotXorROP:
dst = (NOT src) XOR dst
NotEraseROP:
dst = src AND dst
NotROP:
dst = NOT dst
There are some restrictions:
Synonymous bitBlt with the destination point dp and source rectangle sr.
This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.
It was generated from the following files: