<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qpaintdevice_x11.cpp:46 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QPaintDevice Class</title> <style type="text/css"><!-- h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPaintDevice Class Reference</h1> <p>The QPaintDevice class is the base class of objects that can be painted. <a href="#details">More...</a> <p><tt>#include <<a href="qpaintdevice-h.html">qpaintdevice.h</a>></tt> <p>Inherited by <a href="qpixmap.html">QPixmap</a>, <a href="qwidget.html">QWidget</a>, <a href="qpicture.html">QPicture</a> and <a href="qprinter.html">QPrinter</a>. <p><a href="qpaintdevice-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li><div class=fn>virtual <a href="#~QPaintDevice"><b>~QPaintDevice</b></a> ()</div></li> <li><div class=fn>int <a href="#devType"><b>devType</b></a> () const</div></li> <li><div class=fn>bool <a href="#isExtDev"><b>isExtDev</b></a> () const</div></li> <li><div class=fn>bool <a href="#paintingActive"><b>paintingActive</b></a> () const</div></li> <li><div class=fn>virtual HDC <b>handle</b> () const</div></li> <li><div class=fn>virtual Qt::HANDLE <a href="#handle"><b>handle</b></a> () const</div></li> <li><div class=fn>Display * <a href="#x11Display"><b>x11Display</b></a> () const</div></li> <li><div class=fn>int <a href="#x11Screen"><b>x11Screen</b></a> () const</div></li> <li><div class=fn>int <a href="#x11Depth"><b>x11Depth</b></a> () const</div></li> <li><div class=fn>int <a href="#x11Cells"><b>x11Cells</b></a> () const</div></li> <li><div class=fn>Qt::HANDLE <a href="#x11Colormap"><b>x11Colormap</b></a> () const</div></li> <li><div class=fn>bool <a href="#x11DefaultColormap"><b>x11DefaultColormap</b></a> () const</div></li> <li><div class=fn>void * <a href="#x11Visual"><b>x11Visual</b></a> () const</div></li> <li><div class=fn>bool <a href="#x11DefaultVisual"><b>x11DefaultVisual</b></a> () const</div></li> <li><div class=fn>virtual unsigned char * <b>scanLine</b> ( int ) const</div></li> <li><div class=fn>virtual int <b>bytesPerLine</b> () const</div></li> <li><div class=fn>virtual QGfx * <b>graphicsContext</b> ( bool clip_children = TRUE ) const</div></li> </ul> <h2>Static Public Members</h2> <ul> <li><div class=fn>Display * <a href="#x11AppDisplay"><b>x11AppDisplay</b></a> ()</div></li> <li><div class=fn>int <a href="#x11AppScreen"><b>x11AppScreen</b></a> ()</div></li> <li><div class=fn>int <a href="#x11AppDepth"><b>x11AppDepth</b></a> ()</div></li> <li><div class=fn>int <a href="#x11AppCells"><b>x11AppCells</b></a> ()</div></li> <li><div class=fn>int <a href="#x11AppDpiX"><b>x11AppDpiX</b></a> ()</div></li> <li><div class=fn>int <a href="#x11AppDpiY"><b>x11AppDpiY</b></a> ()</div></li> <li><div class=fn>Qt::HANDLE <a href="#x11AppColormap"><b>x11AppColormap</b></a> ()</div></li> <li><div class=fn>bool <a href="#x11AppDefaultColormap"><b>x11AppDefaultColormap</b></a> ()</div></li> <li><div class=fn>void * <a href="#x11AppVisual"><b>x11AppVisual</b></a> ()</div></li> <li><div class=fn>bool <a href="#x11AppDefaultVisual"><b>x11AppDefaultVisual</b></a> ()</div></li> <li><div class=fn>void <a href="#x11SetAppDpiX"><b>x11SetAppDpiX</b></a> ( int dpi )</div></li> <li><div class=fn>void <a href="#x11SetAppDpiY"><b>x11SetAppDpiY</b></a> ( int dpi )</div></li> <li><div class=fn>QWSDisplay * <b>qwsDisplay</b> ()</div></li> </ul> <h2>Protected Members</h2> <ul> <li><div class=fn><a href="#QPaintDevice"><b>QPaintDevice</b></a> ( uint devflags )</div></li> <li><div class=fn>virtual bool <a href="#cmd"><b>cmd</b></a> ( int, QPainter *, QPDevCmdParam * )</div></li> <li><div class=fn>virtual int <a href="#metric"><b>metric</b></a> ( int ) const</div></li> <li><div class=fn>virtual CGContextRef <b>macCGContext</b> ( bool clipped = TRUE ) const</div></li> </ul> <h2>Related Functions</h2> <ul> <li><div class=fn>void <a href="#bitBlt"><b>bitBlt</b></a> ( QPaintDevice * dst, int dx, int dy, const QPaintDevice * src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool ignoreMask )</div></li> <li><div class=fn>void <a href="#bitBlt-2"><b>bitBlt</b></a> ( QPaintDevice * dst, const QPoint & dp, const QPaintDevice * src, const QRect & sr, RasterOp rop )</div></li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QPaintDevice class is the base class of objects that can be painted. <p> <p> A paint device is an abstraction of a two-dimensional space that can be drawn using a <a href="qpainter.html">QPainter</a>. The drawing capabilities are implemented by the subclasses <a href="qwidget.html">QWidget</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qpicture.html">QPicture</a> and <a href="qprinter.html">QPrinter</a>. <p> 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, by <a href="qpainter.html#setWorldMatrix">QPainter::setWorldMatrix</a>(). <p> Example (draw on a paint device): <pre> void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * ) { <a href="qpainter.html">QPainter</a> p; // our painter p.<a href="qpainter.html#begin">begin</a>( this ); // start painting the widget p.<a href="qpainter.html#setPen">setPen</a>( red ); // red outline p.<a href="qpainter.html#setBrush">setBrush</a>( yellow ); // yellow fill p.<a href="qpainter.html#drawEllipse">drawEllipse</a>( 10, 20, 100,100 ); // 100x100 ellipse at positin (10, 20) p.<a href="qpainter.html#end">end</a>(); // painting done } </pre> <p> 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 <a href="#bitBlt">bitBlt</a>(). <p> Example (scroll widget contents 10 pixels to the right): <pre> <a href="#bitBlt">bitBlt</a>( myWidget, 10, 0, myWidget ); </pre> <p> <b>Warning:</b> Qt requires that a <a href="qapplication.html">QApplication</a> 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. <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QPaintDevice"></a>QPaintDevice::QPaintDevice ( uint devflags )<tt> [protected]</tt> </h3> Constructs a paint device with internal flags <em>devflags</em>. This constructor can be invoked only from subclasses of QPaintDevice. <h3 class=fn><a name="~QPaintDevice"></a>QPaintDevice::~QPaintDevice ()<tt> [virtual]</tt> </h3> Destroys the paint device and frees window system resources. <h3 class=fn>bool <a name="cmd"></a>QPaintDevice::cmd ( int, <a href="qpainter.html">QPainter</a> *, QPDevCmdParam * )<tt> [virtual protected]</tt> </h3> Internal virtual function that interprets drawing commands from the painter. <p> Implemented by subclasses that have no direct support for drawing graphics (external paint devices - for example, <a href="qpicture.html">QPicture</a>). <h3 class=fn>int <a name="devType"></a>QPaintDevice::devType () const </h3> <p> Returns the device type identifier, which is <tt>QInternal::Widget</tt> if the device is a <a href="qwidget.html">QWidget</a>, <tt>QInternal::Pixmap</tt> if it's a <a href="qpixmap.html">QPixmap</a>, <tt>QInternal::Printer</tt> if it's a <a href="qprinter.html">QPrinter</a>, <tt>QInternal::Picture</tt> if it's a <a href="qpicture.html">QPicture</a> or <tt>QInternal::UndefinedDevice</tt> in other cases (which should never happen). <h3 class=fn>Qt::HANDLE <a name="handle"></a>QPaintDevice::handle () const<tt> [virtual]</tt> </h3> Returns the window system handle of the paint device, for low-level access. Using this function is not portable. <p> The HANDLE type varies with platform; see qpaintdevice.h and qwindowdefs.h for details. <p> <p>See also <a href="#x11Display">x11Display</a>(). <h3 class=fn>bool <a name="isExtDev"></a>QPaintDevice::isExtDev () const </h3> Returns TRUE if the device is an external paint device; otherwise returns FALSE. <p> External paint devices cannot be <a href="#bitBlt">bitBlt</a>()'ed from. <a href="qpicture.html">QPicture</a> and <a href="qprinter.html">QPrinter</a> are external paint devices. <h3 class=fn>int <a name="metric"></a>QPaintDevice::metric ( int ) const<tt> [virtual protected]</tt> </h3> Internal virtual function that returns paint device metrics. <p> Please use the <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> class instead. <p>Reimplemented in <a href="qpixmap.html#metric">QPixmap</a>, <a href="qwidget.html#metric">QWidget</a> and <a href="qpicture.html#metric">QPicture</a>. <h3 class=fn>bool <a name="paintingActive"></a>QPaintDevice::paintingActive () const </h3> <p> Returns TRUE if the device is being painted, i.e. someone has called <a href="qpainter.html#begin">QPainter::begin</a>() but not yet <a href="qpainter.html#end">QPainter::end</a>() for this device; otherwise returns FALSE. <p> <p>See also <a href="qpainter.html#isActive">QPainter::isActive</a>(). <h3 class=fn>int <a name="x11AppCells"></a>QPaintDevice::x11AppCells ()<tt> [static]</tt> </h3> <p> Returns the number of entries in the colormap of the X display global to the application (X11 only). Using this function is not portable. <p> <p>See also <a href="#x11Colormap">x11Colormap</a>(). <h3 class=fn>Qt::HANDLE <a name="x11AppColormap"></a>QPaintDevice::x11AppColormap ()<tt> [static]</tt> </h3> <p> Returns the colormap of the X display global to the application (X11 only). Using this function is not portable. <p> <p>See also <a href="#x11Cells">x11Cells</a>(). <h3 class=fn>bool <a name="x11AppDefaultColormap"></a>QPaintDevice::x11AppDefaultColormap ()<tt> [static]</tt> </h3> <p> Returns the default colormap of the X display global to the application (X11 only). Using this function is not portable. <p> <p>See also <a href="#x11Cells">x11Cells</a>(). <h3 class=fn>bool <a name="x11AppDefaultVisual"></a>QPaintDevice::x11AppDefaultVisual ()<tt> [static]</tt> </h3> <p> Returns the default Visual of the X display global to the application (X11 only). Using this function is not portable. <h3 class=fn>int <a name="x11AppDepth"></a>QPaintDevice::x11AppDepth ()<tt> [static]</tt> </h3> <p> Returns the depth of the X display global to the application (X11 only). Using this function is not portable. <p> <p>See also <a href="qpixmap.html#defaultDepth">QPixmap::defaultDepth</a>(). <h3 class=fn>Display * <a name="x11AppDisplay"></a>QPaintDevice::x11AppDisplay ()<tt> [static]</tt> </h3> <p> Returns a pointer to the X display global to the application (X11 only). Using this function is not portable. <p> <p>See also <a href="#handle">handle</a>(). <h3 class=fn>int <a name="x11AppDpiX"></a>QPaintDevice::x11AppDpiX ()<tt> [static]</tt> </h3> Returns the horizontal DPI of the X display (X11 only). Using this function is not portable. See <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> for portable access to related information. Using this function is not portable. <p> <p>See also <a href="#x11AppDpiY">x11AppDpiY</a>(), <a href="#x11SetAppDpiX">x11SetAppDpiX</a>() and <a href="qpaintdevicemetrics.html#logicalDpiX">QPaintDeviceMetrics::logicalDpiX</a>(). <h3 class=fn>int <a name="x11AppDpiY"></a>QPaintDevice::x11AppDpiY ()<tt> [static]</tt> </h3> Returns the vertical DPI of the X11 display (X11 only). Using this function is not portable. See <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> for portable access to related information. Using this function is not portable. <p> <p>See also <a href="#x11AppDpiX">x11AppDpiX</a>(), <a href="#x11SetAppDpiY">x11SetAppDpiY</a>() and <a href="qpaintdevicemetrics.html#logicalDpiY">QPaintDeviceMetrics::logicalDpiY</a>(). <h3 class=fn>int <a name="x11AppScreen"></a>QPaintDevice::x11AppScreen ()<tt> [static]</tt> </h3> <p> Returns the screen number on the X display global to the application (X11 only). Using this function is not portable. <h3 class=fn>void * <a name="x11AppVisual"></a>QPaintDevice::x11AppVisual ()<tt> [static]</tt> </h3> <p> Returns the Visual of the X display global to the application (X11 only). Using this function is not portable. <h3 class=fn>int <a name="x11Cells"></a>QPaintDevice::x11Cells () const </h3> <p> Returns the number of entries in the colormap of the X display for the paint device (X11 only). Using this function is not portable. <p> <p>See also <a href="#x11Colormap">x11Colormap</a>(). <h3 class=fn>Qt::HANDLE <a name="x11Colormap"></a>QPaintDevice::x11Colormap () const </h3> <p> Returns the colormap of the X display for the paint device (X11 only). Using this function is not portable. <p> <p>See also <a href="#x11Cells">x11Cells</a>(). <h3 class=fn>bool <a name="x11DefaultColormap"></a>QPaintDevice::x11DefaultColormap () const </h3> <p> Returns the default colormap of the X display for the paint device (X11 only). Using this function is not portable. <p> <p>See also <a href="#x11Cells">x11Cells</a>(). <h3 class=fn>bool <a name="x11DefaultVisual"></a>QPaintDevice::x11DefaultVisual () const </h3> <p> Returns the default Visual of the X display for the paint device (X11 only). Using this function is not portable. <h3 class=fn>int <a name="x11Depth"></a>QPaintDevice::x11Depth () const </h3> <p> Returns the depth of the X display for the paint device (X11 only). Using this function is not portable. <p> <p>See also <a href="qpixmap.html#defaultDepth">QPixmap::defaultDepth</a>(). <h3 class=fn>Display * <a name="x11Display"></a>QPaintDevice::x11Display () const </h3> <p> Returns a pointer to the X display for the paint device (X11 only). Using this function is not portable. <p> <p>See also <a href="#handle">handle</a>(). <h3 class=fn>int <a name="x11Screen"></a>QPaintDevice::x11Screen () const </h3> <p> Returns the screen number on the X display for the paint device (X11 only). Using this function is not portable. <h3 class=fn>void <a name="x11SetAppDpiX"></a>QPaintDevice::x11SetAppDpiX ( int dpi )<tt> [static]</tt> </h3> Sets the value returned by <a href="#x11AppDpiX">x11AppDpiX</a>() to <em>dpi</em>. 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. <p> <p>See also <a href="#x11SetAppDpiY">x11SetAppDpiY</a>(). <h3 class=fn>void <a name="x11SetAppDpiY"></a>QPaintDevice::x11SetAppDpiY ( int dpi )<tt> [static]</tt> </h3> Sets the value returned by <a href="#x11AppDpiY">x11AppDpiY</a>() to <em>dpi</em>. 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. <p> <p>See also <a href="#x11SetAppDpiX">x11SetAppDpiX</a>(). <h3 class=fn>void * <a name="x11Visual"></a>QPaintDevice::x11Visual () const </h3> <p> Returns the Visual of the X display for the paint device (X11 only). Using this function is not portable. <hr><h2>Related Functions</h2> <h3 class=fn>void <a name="bitBlt"></a>bitBlt ( <a href="qpaintdevice.html">QPaintDevice</a> * dst, int dx, int dy, const <a href="qpaintdevice.html">QPaintDevice</a> * src, int sx, int sy, int sw, int sh, <a href="qt.html#RasterOp-enum">Qt::RasterOp</a> rop, bool ignoreMask ) </h3> <p> Copies a block of pixels from <em>src</em> to <em>dst</em>, perhaps merging each pixel according to the <a href="qt.html#RasterOp">raster operation</a> <em>rop</em>. <em>sx</em>, <em>sy</em> is the top-left pixel in <em>src</em> (0, 0) by default, <em>dx</em>, <em>dy</em> is the top-left position in <em>dst</em> and <em>sw</em>, <em>sh</em> is the size of the copied block (all of <em>src</em> by default). <p> The most common values for <em>rop</em> are CopyROP and XorROP; the <a href="qt.html#RasterOp-enum">Qt::RasterOp</a> documentation defines all the possible values. <p> If <em>ignoreMask</em> is TRUE (the default is FALSE) and <em>src</em> is a masked <a href="qpixmap.html">QPixmap</a>, the entire blit is masked by <em>src</em>->mask(). <p> If <em>src</em>, <em>dst</em>, <em>sw</em> or <em>sh</em> is 0, <a href="#bitBlt">bitBlt</a>() does nothing. If <em>sw</em> or <em>sh</em> is negative bitBlt() copies starting at <em>sx</em> (and resp. <em>sy</em>) and ending at the right end (resp. bottom) of <em>src</em>. <p> <em>src</em> must be a <a href="qwidget.html">QWidget</a> or QPixmap. You cannot blit from a <a href="qprinter.html">QPrinter</a>, for example. bitBlt() does nothing if you attempt to blit from an unsupported device. <p> bitBlt() does nothing if <em>src</em> has a greater depth than <em>dst</em>. If you need to, for example, draw a 24-bit pixmap on an 8-bit widget, you must use drawPixmap(). <h3 class=fn>void <a name="bitBlt-2"></a>bitBlt ( <a href="qpaintdevice.html">QPaintDevice</a> * dst, const <a href="qpoint.html">QPoint</a> & dp, const <a href="qpaintdevice.html">QPaintDevice</a> * src, const <a href="qrect.html">QRect</a> & sr, RasterOp rop ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Overloaded <a href="#bitBlt">bitBlt</a>() with the destination point <em>dp</em> and source rectangle <em>sr</em>. <p> <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2001 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2001 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a> <td align=right><div align=right>Qt version 3.0.2</div> </table></div></address></body> </html>