Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
|
The base class of objects that can be painted. More...
#include <qpaintdevice.h>
Inherited by QWidget, QPixmap, and QPicture.
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.
See also
Implemented by subclasses that have no direct support for drawing graphics (external paint devices, for example QPicture).
Returns the device type identifier: QInternal::Widget, QInternal::Pixmap, QInternal::Printer, QInternal::Picture or QInternal::UndefinedDevice.
External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.
Please use the QPaintDeviceMetrics class instead.
Reimplemented in QWidget, QPixmap, and QPicture.
See also QPainter::isActive().
\arg dst is the paint device to copy to. \arg dx and dy is the position to copy to. \arg src is the paint device to copy from. \arg sx and sy is the position to copy from. \arg sw and sh is the width and height of the block to be copied. \arg rop defines the raster operation to be used when copying.
If sw is 0 or sh is 0, then bitBlt will do nothing.
If sw is negative, then bitBlt calculates sw = src->width -
sx. If sh is negative, then bitBlt calculates sh =
src->height - sy.
The most common values for rop are CopyROP and XorROP; the Qt::RasterOp documentation defines all the possible values.
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:
Overloaded bitBlt() with the destination point dp and source rectangle sr.
This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|