The base class of objects that can be painted. More...
#include <qpaintdevice.h>
Inherited by QPicture, QPixmap, QPrinter and QWidget.
A paint device is an abstraction of a two-dimensional space that can be drawn using a 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 right and Y increases downwards. The unit is one pixel. There are several ways to set up a user-defined coordinate system using the painter, for example by QPainter::setWorldMatrix().
Example (draw on a paint device):
void MyWidget::paintEvent( QPaintEvent * ) { QPainter p; // our painter p.begin( this ); // start painting widget 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().
Example (scroll widget contents 10 pixels to the right):
bitBlt( myWidget, 10,0, myWidget );
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.
[protected]
Constructs a paint device with internal flags devflags. This constructor can only be invoked from subclasses of QPaintDevice.
[virtual]
Destructs the paint device and frees window system resources.
[virtual protected]
Internal virtual function that interprets drawing commands from the painter.
Implemented by subclasses that have no direct support for drawing graphics (external paint devices, for example QPicture).
Reimplemented in QPrinter and QPicture.
Returns the device type identifier: QInternal::Widget, QInternal::Pixmap, QInternal::Printer, QInternal::Picture
or
QInternal::UndefinedDevice.
[virtual protected]
Internal virtual function. Reserved for future use.
[virtual protected]
Internal virtual function. Reserved for future use.
Returns TRUE if the device is a so-called external paint device.
External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.
[virtual protected]
Internal virtual function that returns paint device metrics.
Please use the QPaintDeviceMetrics class instead.
Reimplemented in QWidget, QPrinter, QPicture and QPixmap.
Returns TRUE if the device is being painted, i.e. someone has called QPainter::begin() and not yet QPainter::end() for this device.
See also QPainter::isActive().
Overloaded bitBlt() with the destination point dp and source rectangle sr.
Examples: xform/xform.cpp desktop/desktop.cpp
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 argument can be one of:
CopyROP:
dst = src.
OrROP:
dst = src OR dst.
XorROP:
dst = src XOR dst.
NotAndROP:
dst = (NOT src) AND dst
NotCopyROP:
dst = NOT src
NotOrROP:
dst = (NOT src) OR dst
NotXorROP:
dst = (NOT src) XOR dst
AndROP
dst = src AND dst
NotROP:
dst = NOT dst
ClearROP:
dst = 0
SetROP:
dst = 1
NopROP:
dst = dst
AndNotROP:
dst = src AND (NOT dst)
OrNotROP:
dst = src OR (NOT dst)
NandROP:
dst = NOT (src AND dst)
NorROP:
dst = NOT (src OR dst)
The ignoreMask argument (default FALSE) applies where src is a QPixmap with a mask. If ignoreMask is TRUE, bitBlt ignores the pixmap's mask.
BitBlt has two restrictions:
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright © 2000 Trolltech | Trademarks | Qt version 2.2.1
|