QPaintDevice(3qt)

NAME
QPaintDevice - The base class of objects that can be painted

SYNOPSIS
#include <qpaintdevice.h>

Inherited by QPixmap, QWidget, QPicture and QPrinter.

  Public Members
virtual ~QPaintDevice ()
bool isExtDev () const
bool paintingActive () const
virtual HDC handle () const
virtual Qt::HANDLE handle () const
Display * x11Display () const
int x11Screen () const
int x11Depth () const
int x11Cells () const
Qt::HANDLE x11Colormap () const
bool x11DefaultColormap () const
void * x11Visual () const
bool x11DefaultVisual () const

  Static Public Members
Display * x11AppDisplay ()
int x11AppScreen ()
int x11AppDepth ()
int x11AppCells ()
int x11AppDpiX ()
int x11AppDpiY ()
Qt::HANDLE x11AppColormap ()
bool x11AppDefaultColormap ()
void * x11AppVisual ()
bool x11AppDefaultVisual ()
void x11SetAppDpiX ( int dpi )
void x11SetAppDpiY ( int dpi )

  Protected Members
QPaintDevice ( uint devflags )
virtual bool cmd ( int, QPainter *, QPDevCmdParam * )

RELATED FUNCTION DOCUMENTATION
void bitBlt ( QPaintDevice * dst, int dx, int dy, const QPaintDevice * src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool ignoreMask )
void bitBlt ( QPaintDevice * dst, const QPoint & dp, const QPaintDevice * src, const QRect & sr, RasterOp rop )

DESCRIPTION
The QPaintDevice class is the base class of objects that can be painted.

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 downward. The unit is one pixel. There are several ways to set up a user-defined coordinate system using the painter, for example, using QPainter::setWorldMatrix().

Example (draw on a paint device):

    void MyWidget::paintEvent( QPaintEvent * )
    {
        QPainter p;                       // our painter
        p.begin( this );                  // start painting the widget
        p.setPen( red );                  // red outline
        p.setBrush( yellow );             // yellow fill
        p.drawEllipse( 10, 20, 100,100 ); // 100x100 ellipse at position (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 exists 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 Graphics Classes and Image Processing Classes.

MEMBER FUNCTION DOCUMENTATION

QPaintDevice::QPaintDevice ( uint devflags ) [protected]
Constructs a paint device with internal flags devflags. This constructor can be invoked only from QPaintDevice subclasses.

QPaintDevice::~QPaintDevice () [virtual]
Destroys the paint device and frees window system resources.

bool QPaintDevice::cmd ( int, QPainter *, QPDevCmdParam * ) [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).

Qt::HANDLE QPaintDevice::handle () const [virtual]
Returns the window system handle of the paint device, for low-level access. Using this function is not portable.

The HANDLE type varies with platform; see qpaintdevice.h and qwindowdefs.h for details.

See also x11Display().

bool QPaintDevice::isExtDev () const
Returns TRUE if the device is an external paint device; otherwise returns FALSE.

External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.

bool QPaintDevice::paintingActive () const
Returns TRUE if the device is being painted, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns FALSE.

See also QPainter::isActive().

int QPaintDevice::x11AppCells () [static]
Returns the number of entries in the colormap of the X display global to the application (X11 only). Using this function is not portable.

See also x11Colormap().

Qt::HANDLE QPaintDevice::x11AppColormap () [static]
Returns the colormap of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11AppDefaultColormap () [static]
Returns the default colormap of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11AppDefaultVisual () [static]
Returns the default Visual of the X display global to the application (X11 only). Using this function is not portable.

int QPaintDevice::x11AppDepth () [static]
Returns the depth of the X display global to the application (X11 only). Using this function is not portable.

See also QPixmap::defaultDepth().

Display * QPaintDevice::x11AppDisplay () [static]
Returns a pointer to the X display global to the application (X11 only). Using this function is not portable.

See also handle().

int QPaintDevice::x11AppDpiX () [static]
Returns the horizontal DPI of the X display (X11 only). Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiY(), x11SetAppDpiX() and QPaintDeviceMetrics::logicalDpiX().

int QPaintDevice::x11AppDpiY () [static]
Returns the vertical DPI of the X11 display (X11 only). Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiX(), x11SetAppDpiY() and QPaintDeviceMetrics::logicalDpiY().

int QPaintDevice::x11AppScreen () [static]
Returns the screen number on the X display global to the application (X11 only). Using this function is not portable.

void * QPaintDevice::x11AppVisual () [static]
Returns the Visual of the X display global to the application (X11 only). Using this function is not portable.

int QPaintDevice::x11Cells () const
Returns the number of entries in the colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Colormap().

Qt::HANDLE QPaintDevice::x11Colormap () const
Returns the colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11DefaultColormap () const
Returns the default colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11DefaultVisual () const
Returns the default Visual of the X display for the paint device (X11 only). Using this function is not portable.

int QPaintDevice::x11Depth () const
Returns the depth of the X display for the paint device (X11 only). Using this function is not portable.

See also QPixmap::defaultDepth().

Display * QPaintDevice::x11Display () const
Returns a pointer to the X display for the paint device (X11 only). Using this function is not portable.

See also handle().

int QPaintDevice::x11Screen () const
Returns the screen number on the X display for the paint device (X11 only). Using this function is not portable.

void QPaintDevice::x11SetAppDpiX ( int dpi ) [static]
Sets the value returned by x11AppDpiX() to dpi. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.

See also x11SetAppDpiY().

void QPaintDevice::x11SetAppDpiY ( int dpi ) [static]
Sets the value returned by x11AppDpiY() to dpi. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.

See also x11SetAppDpiX().

void * QPaintDevice::x11Visual () const
Returns the Visual of the X display for the paint device (X11 only). Using this function is not portable.

RELATED FUNCTION DOCUMENTATION

void bitBlt ( QPaintDevice * dst, int dx, int dy, const QPaintDevice * src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool ignoreMask )
Copies a block of pixels from src to dst, perhaps merging each pixel according to the raster operation rop. sx, sy is the top-left pixel in src (0, 0) by default, dx, dy is the top-left position in dst and sw, sh is the size of the copied block (all of src by default).

The most common values for rop are CopyROP and XorROP; the Qt::RasterOp documentation defines all the possible values.

If ignoreMask is TRUE (the default is FALSE) and src is a masked QPixmap, the entire blit is masked by src->mask().

If src, dst, sw or sh is 0, bitBlt() does nothing. If sw or sh is negative bitBlt() copies starting at sx (and respectively, sy) and ending at the right end (respectively, bottom) of src.

src must be a QWidget or QPixmap. You cannot blit from a QPrinter, for example. bitBlt() does nothing if you attempt to blit from an unsupported device.

bitBlt() does nothing if src has a greater depth than dst. If you need to for example, draw a 24-bit pixmap on an 8-bit widget, you must use drawPixmap().

void bitBlt ( QPaintDevice * dst, const QPoint & dp, const QPaintDevice * src, const QRect & sr, RasterOp rop )
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Overloaded bitBlt() with the destination point dp and source rectangle sr.

SEE ALSO
http://doc.trolltech.com/qpaintdevice.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

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 is located 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 (qpaintdevice.3qt) and the Qt version (3.0.6).