| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qpainter.h:1 -->
|
|---|
| 3 | <html>
|
|---|
| 4 | <head>
|
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|---|
| 6 | <title>qpainter.h Include File</title>
|
|---|
| 7 | <style type="text/css"><!--
|
|---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
|---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
|---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
|---|
| 11 | body { background: #ffffff; color: black; }
|
|---|
| 12 | --></style>
|
|---|
| 13 | </head>
|
|---|
| 14 | <body>
|
|---|
| 15 |
|
|---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|---|
| 17 | <tr bgcolor="#E5E5E5">
|
|---|
| 18 | <td valign=center>
|
|---|
| 19 | <a href="index.html">
|
|---|
| 20 | <font color="#004faf">Home</font></a>
|
|---|
| 21 | | <a href="classes.html">
|
|---|
| 22 | <font color="#004faf">All Classes</font></a>
|
|---|
| 23 | | <a href="mainclasses.html">
|
|---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
|---|
| 25 | | <a href="annotated.html">
|
|---|
| 26 | <font color="#004faf">Annotated</font></a>
|
|---|
| 27 | | <a href="groups.html">
|
|---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
|---|
| 29 | | <a href="functions.html">
|
|---|
| 30 | <font color="#004faf">Functions</font></a>
|
|---|
| 31 | </td>
|
|---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qpainter.h</h1>
|
|---|
| 33 |
|
|---|
| 34 | <p>This is the verbatim text of the qpainter.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
|---|
| 35 | <hr>
|
|---|
| 36 | <pre>
|
|---|
| 37 | /****************************************************************************
|
|---|
| 38 | ** $Id: qpainter-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
|---|
| 39 | **
|
|---|
| 40 | ** Definition of QPainter class
|
|---|
| 41 | **
|
|---|
| 42 | ** Created : 940112
|
|---|
| 43 | **
|
|---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|---|
| 45 | **
|
|---|
| 46 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
|---|
| 47 | **
|
|---|
| 48 | ** This file may be distributed under the terms of the Q Public License
|
|---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
|---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
|
|---|
| 51 | **
|
|---|
| 52 | ** This file may be distributed and/or modified under the terms of the
|
|---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
|
|---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 55 | ** packaging of this file.
|
|---|
| 56 | **
|
|---|
| 57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|---|
| 58 | ** licenses may use this file in accordance with the Qt Commercial License
|
|---|
| 59 | ** Agreement provided with the Software.
|
|---|
| 60 | **
|
|---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 63 | **
|
|---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|---|
| 65 | ** information about Qt Commercial License Agreements.
|
|---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|---|
| 68 | **
|
|---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
|---|
| 70 | ** not clear to you.
|
|---|
| 71 | **
|
|---|
| 72 | **********************************************************************/
|
|---|
| 73 |
|
|---|
| 74 | #ifndef QPAINTER_H
|
|---|
| 75 | #define QPAINTER_H
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | #ifndef QT_H
|
|---|
| 79 | #include "qcolor.h"
|
|---|
| 80 | #include "qfontmetrics.h"
|
|---|
| 81 | #include "qfontinfo.h"
|
|---|
| 82 | #include "qregion.h"
|
|---|
| 83 | #include "qpen.h"
|
|---|
| 84 | #include "qbrush.h"
|
|---|
| 85 | #include "qpointarray.h"
|
|---|
| 86 | #include "qwmatrix.h"
|
|---|
| 87 | #endif // QT_H
|
|---|
| 88 |
|
|---|
| 89 | class QGfx;
|
|---|
| 90 | class QTextCodec;
|
|---|
| 91 | class QTextParag;
|
|---|
| 92 | class QPaintDevice;
|
|---|
| 93 | class QTextItem;
|
|---|
| 94 | #if defined( Q_WS_MAC )
|
|---|
| 95 | class QMacSavedPortInfo;
|
|---|
| 96 | #endif
|
|---|
| 97 | class QPainterPrivate;
|
|---|
| 98 |
|
|---|
| 99 | #if defined(Q_WS_QWS)
|
|---|
| 100 | class QScreen;
|
|---|
| 101 | #endif
|
|---|
| 102 |
|
|---|
| 103 | class Q_EXPORT QPainter : public Qt
|
|---|
| 104 | {
|
|---|
| 105 | public:
|
|---|
| 106 | enum CoordinateMode { CoordDevice, CoordPainter };
|
|---|
| 107 |
|
|---|
| 108 | QPainter();
|
|---|
| 109 | QPainter( const QPaintDevice *, bool unclipped = FALSE );
|
|---|
| 110 | QPainter( const QPaintDevice *, const QWidget *, bool unclipped = FALSE );
|
|---|
| 111 | ~QPainter();
|
|---|
| 112 |
|
|---|
| 113 | bool begin( const QPaintDevice *, bool unclipped = FALSE );
|
|---|
| 114 | bool begin( const QPaintDevice *, const QWidget *, bool unclipped = FALSE );
|
|---|
| 115 | bool end();
|
|---|
| 116 | QPaintDevice *device() const;
|
|---|
| 117 |
|
|---|
| 118 | #ifdef Q_WS_QWS
|
|---|
| 119 | QGfx * internalGfx();
|
|---|
| 120 | #ifdef QT_QWS_EXPERIMENTAL_SCREENPAINTER
|
|---|
| 121 | bool begin(QScreen *screen);
|
|---|
| 122 | #endif
|
|---|
| 123 | #endif
|
|---|
| 124 |
|
|---|
| 125 | static void redirect( QPaintDevice *pdev, QPaintDevice *replacement );
|
|---|
| 126 | static QPaintDevice *redirect( QPaintDevice *pdev );
|
|---|
| 127 |
|
|---|
| 128 | bool isActive() const;
|
|---|
| 129 |
|
|---|
| 130 | void flush( const QRegion &region, CoordinateMode cm = CoordDevice );
|
|---|
| 131 | void flush();
|
|---|
| 132 | void save();
|
|---|
| 133 | void restore();
|
|---|
| 134 |
|
|---|
| 135 | // Drawing tools
|
|---|
| 136 |
|
|---|
| 137 | QFontMetrics fontMetrics() const;
|
|---|
| 138 | QFontInfo fontInfo() const;
|
|---|
| 139 |
|
|---|
| 140 | const QFont &font() const;
|
|---|
| 141 | void setFont( const QFont & );
|
|---|
| 142 | const QPen &pen() const;
|
|---|
| 143 | void setPen( const QPen & );
|
|---|
| 144 | void setPen( PenStyle );
|
|---|
| 145 | void setPen( const QColor & );
|
|---|
| 146 | const QBrush &brush() const;
|
|---|
| 147 | void setBrush( const QBrush & );
|
|---|
| 148 | void setBrush( BrushStyle );
|
|---|
| 149 | void setBrush( const QColor & );
|
|---|
| 150 | QPoint pos() const;
|
|---|
| 151 |
|
|---|
| 152 | // Drawing attributes/modes
|
|---|
| 153 |
|
|---|
| 154 | const QColor &backgroundColor() const;
|
|---|
| 155 | void setBackgroundColor( const QColor & );
|
|---|
| 156 | BGMode backgroundMode() const;
|
|---|
| 157 | void setBackgroundMode( BGMode );
|
|---|
| 158 | RasterOp rasterOp() const;
|
|---|
| 159 | void setRasterOp( RasterOp );
|
|---|
| 160 | const QPoint &brushOrigin() const;
|
|---|
| 161 | void setBrushOrigin( int x, int y );
|
|---|
| 162 | void setBrushOrigin( const QPoint & );
|
|---|
| 163 |
|
|---|
| 164 | // Scaling and transformations
|
|---|
| 165 |
|
|---|
| 166 | // PaintUnit unit() const; // get set painter unit
|
|---|
| 167 | // void setUnit( PaintUnit ); // NOT IMPLEMENTED!!!
|
|---|
| 168 |
|
|---|
| 169 | bool hasViewXForm() const;
|
|---|
| 170 | bool hasWorldXForm() const;
|
|---|
| 171 |
|
|---|
| 172 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 173 | void setViewXForm( bool ); // set xform on/off
|
|---|
| 174 | QRect window() const; // get window
|
|---|
| 175 | void setWindow( const QRect & ); // set window
|
|---|
| 176 | void setWindow( int x, int y, int w, int h );
|
|---|
| 177 | QRect viewport() const; // get viewport
|
|---|
| 178 | void setViewport( const QRect & ); // set viewport
|
|---|
| 179 | void setViewport( int x, int y, int w, int h );
|
|---|
| 180 |
|
|---|
| 181 | void setWorldXForm( bool ); // set world xform on/off
|
|---|
| 182 | const QWMatrix &worldMatrix() const; // get/set world xform matrix
|
|---|
| 183 | void setWorldMatrix( const QWMatrix &, bool combine=FALSE );
|
|---|
| 184 |
|
|---|
| 185 | void saveWorldMatrix();
|
|---|
| 186 | void restoreWorldMatrix();
|
|---|
| 187 |
|
|---|
| 188 | void scale( double sx, double sy );
|
|---|
| 189 | void shear( double sh, double sv );
|
|---|
| 190 | void rotate( double a );
|
|---|
| 191 | #endif
|
|---|
| 192 | void translate( double dx, double dy );
|
|---|
| 193 | void resetXForm();
|
|---|
| 194 | double translationX() const;
|
|---|
| 195 | double translationY() const;
|
|---|
| 196 |
|
|---|
| 197 | QPoint xForm( const QPoint & ) const; // map virtual -> device
|
|---|
| 198 | QRect xForm( const QRect & ) const;
|
|---|
| 199 | QPointArray xForm( const QPointArray & ) const;
|
|---|
| 200 | QPointArray xForm( const QPointArray &, int index, int npoints ) const;
|
|---|
| 201 | QPoint xFormDev( const QPoint & ) const; // map device -> virtual
|
|---|
| 202 | QRect xFormDev( const QRect & ) const;
|
|---|
| 203 | QPointArray xFormDev( const QPointArray & ) const;
|
|---|
| 204 | QPointArray xFormDev( const QPointArray &, int index, int npoints ) const;
|
|---|
| 205 |
|
|---|
| 206 | // Clipping
|
|---|
| 207 |
|
|---|
| 208 | void setClipping( bool ); // set clipping on/off
|
|---|
| 209 | bool hasClipping() const;
|
|---|
| 210 | QRegion clipRegion( CoordinateMode = CoordDevice ) const;
|
|---|
| 211 | void setClipRect( const QRect &, CoordinateMode = CoordDevice ); // set clip rectangle
|
|---|
| 212 | void setClipRect( int x, int y, int w, int h, CoordinateMode = CoordDevice );
|
|---|
| 213 | void setClipRegion( const QRegion &, CoordinateMode = CoordDevice );// set clip region
|
|---|
| 214 |
|
|---|
| 215 | // Graphics drawing functions
|
|---|
| 216 |
|
|---|
| 217 | void drawPoint( int x, int y );
|
|---|
| 218 | void drawPoint( const QPoint & );
|
|---|
| 219 | void drawPoints( const QPointArray& a,
|
|---|
| 220 | int index=0, int npoints=-1 );
|
|---|
| 221 | void moveTo( int x, int y );
|
|---|
| 222 | void moveTo( const QPoint & );
|
|---|
| 223 | void lineTo( int x, int y );
|
|---|
| 224 | void lineTo( const QPoint & );
|
|---|
| 225 | void drawLine( int x1, int y1, int x2, int y2 );
|
|---|
| 226 | void drawLine( const QPoint &, const QPoint & );
|
|---|
| 227 | void drawRect( int x, int y, int w, int h );
|
|---|
| 228 | void drawRect( const QRect & );
|
|---|
| 229 | void drawWinFocusRect( int x, int y, int w, int h );
|
|---|
| 230 | void drawWinFocusRect( int x, int y, int w, int h,
|
|---|
| 231 | const QColor &bgColor );
|
|---|
| 232 | void drawWinFocusRect( const QRect & );
|
|---|
| 233 | void drawWinFocusRect( const QRect &,
|
|---|
| 234 | const QColor &bgColor );
|
|---|
| 235 | void drawRoundRect( int x, int y, int w, int h, int = 25, int = 25 );
|
|---|
| 236 | void drawRoundRect( const QRect &, int = 25, int = 25 );
|
|---|
| 237 | void drawEllipse( int x, int y, int w, int h );
|
|---|
| 238 | void drawEllipse( const QRect & );
|
|---|
| 239 | void drawArc( int x, int y, int w, int h, int a, int alen );
|
|---|
| 240 | void drawArc( const QRect &, int a, int alen );
|
|---|
| 241 | void drawPie( int x, int y, int w, int h, int a, int alen );
|
|---|
| 242 | void drawPie( const QRect &, int a, int alen );
|
|---|
| 243 | void drawChord( int x, int y, int w, int h, int a, int alen );
|
|---|
| 244 | void drawChord( const QRect &, int a, int alen );
|
|---|
| 245 | void drawLineSegments( const QPointArray &,
|
|---|
| 246 | int index=0, int nlines=-1 );
|
|---|
| 247 | void drawPolyline( const QPointArray &,
|
|---|
| 248 | int index=0, int npoints=-1 );
|
|---|
| 249 | void drawPolygon( const QPointArray &, bool winding=FALSE,
|
|---|
| 250 | int index=0, int npoints=-1 );
|
|---|
| 251 | void drawConvexPolygon( const QPointArray &,
|
|---|
| 252 | int index=0, int npoints=-1 );
|
|---|
| 253 | #ifndef QT_NO_BEZIER
|
|---|
| 254 | void drawCubicBezier( const QPointArray &, int index=0 );
|
|---|
| 255 | #endif
|
|---|
| 256 | void drawPixmap( int x, int y, const QPixmap &,
|
|---|
| 257 | int sx=0, int sy=0, int sw=-1, int sh=-1 );
|
|---|
| 258 | void drawPixmap( const QPoint &, const QPixmap &,
|
|---|
| 259 | const QRect &sr );
|
|---|
| 260 | void drawPixmap( const QPoint &, const QPixmap & );
|
|---|
| 261 | void drawPixmap( const QRect &, const QPixmap & );
|
|---|
| 262 | void drawImage( int x, int y, const QImage &,
|
|---|
| 263 | int sx = 0, int sy = 0, int sw = -1, int sh = -1,
|
|---|
| 264 | int conversionFlags = 0 );
|
|---|
| 265 | void drawImage( const QPoint &, const QImage &,
|
|---|
| 266 | const QRect &sr, int conversionFlags = 0 );
|
|---|
| 267 | void drawImage( const QPoint &, const QImage &,
|
|---|
| 268 | int conversion_flags = 0 );
|
|---|
| 269 | void drawImage( const QRect &, const QImage & );
|
|---|
| 270 | void drawTiledPixmap( int x, int y, int w, int h, const QPixmap &,
|
|---|
| 271 | int sx=0, int sy=0 );
|
|---|
| 272 | void drawTiledPixmap( const QRect &, const QPixmap &,
|
|---|
| 273 | const QPoint & );
|
|---|
| 274 | void drawTiledPixmap( const QRect &, const QPixmap & );
|
|---|
| 275 | #ifndef QT_NO_PICTURE
|
|---|
| 276 | void drawPicture( const QPicture & );
|
|---|
| 277 | void drawPicture( int x, int y, const QPicture & );
|
|---|
| 278 | void drawPicture( const QPoint &, const QPicture & );
|
|---|
| 279 | #endif
|
|---|
| 280 |
|
|---|
| 281 | void fillRect( int x, int y, int w, int h, const QBrush & );
|
|---|
| 282 | void fillRect( const QRect &, const QBrush & );
|
|---|
| 283 | void eraseRect( int x, int y, int w, int h );
|
|---|
| 284 | void eraseRect( const QRect & );
|
|---|
| 285 |
|
|---|
| 286 | // Text drawing functions
|
|---|
| 287 |
|
|---|
| 288 | enum TextDirection {
|
|---|
| 289 | Auto,
|
|---|
| 290 | RTL,
|
|---|
| 291 | LTR
|
|---|
| 292 | };
|
|---|
| 293 |
|
|---|
| 294 | void drawText( int x, int y, const QString &, int len = -1, TextDirection dir = Auto );
|
|---|
| 295 | void drawText( const QPoint &, const QString &, int len = -1, TextDirection dir = Auto );
|
|---|
| 296 |
|
|---|
| 297 | void drawText( int x, int y, const QString &, int pos, int len, TextDirection dir = Auto );
|
|---|
| 298 | void drawText( const QPoint &p, const QString &, int pos, int len, TextDirection dir = Auto );
|
|---|
| 299 |
|
|---|
| 300 | void drawText( int x, int y, int w, int h, int flags,
|
|---|
| 301 | const QString&, int len = -1, QRect *br=0,
|
|---|
| 302 | QTextParag **intern=0 );
|
|---|
| 303 | void drawText( const QRect &, int flags,
|
|---|
| 304 | const QString&, int len = -1, QRect *br=0,
|
|---|
| 305 | QTextParag **intern=0 );
|
|---|
| 306 |
|
|---|
| 307 | void drawTextItem( int x, int y, const QTextItem &ti, int textflags = 0 );
|
|---|
| 308 | void drawTextItem( const QPoint& p, const QTextItem &ti, int textflags = 0 );
|
|---|
| 309 |
|
|---|
| 310 | QRect boundingRect( int x, int y, int w, int h, int flags,
|
|---|
| 311 | const QString&, int len = -1, QTextParag **intern=0 );
|
|---|
| 312 | QRect boundingRect( const QRect &, int flags,
|
|---|
| 313 | const QString&, int len = -1, QTextParag **intern=0 );
|
|---|
| 314 |
|
|---|
| 315 | int tabStops() const;
|
|---|
| 316 | void setTabStops( int );
|
|---|
| 317 | int *tabArray() const;
|
|---|
| 318 | void setTabArray( int * );
|
|---|
| 319 |
|
|---|
| 320 | // Other functions
|
|---|
| 321 |
|
|---|
| 322 | #if defined(Q_WS_WIN)
|
|---|
| 323 | HDC handle() const;
|
|---|
| 324 | #elif defined(Q_WS_X11) || defined(Q_WS_MAC)
|
|---|
| 325 | HANDLE handle() const;
|
|---|
| 326 | #endif
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 | static void initialize();
|
|---|
| 330 | static void cleanup();
|
|---|
| 331 |
|
|---|
| 332 | private:
|
|---|
| 333 | void init();
|
|---|
| 334 | void destroy();
|
|---|
| 335 | void updateFont();
|
|---|
| 336 | void updatePen();
|
|---|
| 337 | void updateBrush();
|
|---|
| 338 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 339 | void updateXForm();
|
|---|
| 340 | void updateInvXForm();
|
|---|
| 341 | #endif
|
|---|
| 342 | void map( int, int, int *rx, int *ry ) const;
|
|---|
| 343 | void map( int, int, int, int, int *, int *, int *, int * ) const;
|
|---|
| 344 | void mapInv( int, int, int *, int * ) const;
|
|---|
| 345 | void mapInv( int, int, int, int, int *, int *, int *, int * ) const;
|
|---|
| 346 | void drawPolyInternal( const QPointArray &, bool close=TRUE );
|
|---|
| 347 | void drawWinFocusRect( int x, int y, int w, int h, bool xorPaint,
|
|---|
| 348 | const QColor &penColor );
|
|---|
| 349 |
|
|---|
| 350 | enum { IsActive=0x01, ExtDev=0x02, IsStartingUp=0x04, NoCache=0x08,
|
|---|
| 351 | VxF=0x10, WxF=0x20, ClipOn=0x40, SafePolygon=0x80, MonoDev=0x100,
|
|---|
| 352 | DirtyFont=0x200, DirtyPen=0x400, DirtyBrush=0x800,
|
|---|
| 353 | RGBColor=0x1000, FontMet=0x2000, FontInf=0x4000, CtorBegin=0x8000,
|
|---|
| 354 | UsePrivateCx = 0x10000, VolatileDC = 0x20000, Qt2Compat = 0x40000 };
|
|---|
| 355 | uint flags;
|
|---|
| 356 | bool testf( uint b ) const { return (flags&b)!=0; }
|
|---|
| 357 | void setf( uint b ) { flags |= b; }
|
|---|
| 358 | void setf( uint b, bool v );
|
|---|
| 359 | void clearf( uint b ) { flags &= (uint)(~b); }
|
|---|
| 360 | void fix_neg_rect( int *x, int *y, int *w, int *h );
|
|---|
| 361 |
|
|---|
| 362 | QPainterPrivate *d;
|
|---|
| 363 | QPaintDevice *pdev;
|
|---|
| 364 | QColor bg_col;
|
|---|
| 365 | uchar bg_mode;
|
|---|
| 366 | uchar rop;
|
|---|
| 367 | uchar pu;
|
|---|
| 368 | QPoint bro;
|
|---|
| 369 | QFont cfont;
|
|---|
| 370 | QFont *pfont; // font used for metrics (might be different for printers)
|
|---|
| 371 | QPen cpen;
|
|---|
| 372 | QBrush cbrush;
|
|---|
| 373 | QRegion crgn;
|
|---|
| 374 | int tabstops;
|
|---|
| 375 | int *tabarray;
|
|---|
| 376 | int tabarraylen;
|
|---|
| 377 | bool block_ext; // for temporary blocking of external devices
|
|---|
| 378 |
|
|---|
| 379 | // Transformations
|
|---|
| 380 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 381 | QCOORD wx, wy, ww, wh;
|
|---|
| 382 | QCOORD vx, vy, vw, vh;
|
|---|
| 383 | QWMatrix wxmat;
|
|---|
| 384 |
|
|---|
| 385 | // Cached composition (and inverse) of transformations
|
|---|
| 386 | QWMatrix xmat;
|
|---|
| 387 | QWMatrix ixmat;
|
|---|
| 388 |
|
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 | double m11() const { return xmat.m11(); }
|
|---|
| 392 | double m12() const { return xmat.m12(); }
|
|---|
| 393 | double m21() const { return xmat.m21(); }
|
|---|
| 394 | double m22() const { return xmat.m22(); }
|
|---|
| 395 | double dx() const { return xmat.dx(); }
|
|---|
| 396 | double dy() const { return xmat.dy(); }
|
|---|
| 397 | double im11() const { return ixmat.m11(); }
|
|---|
| 398 | double im12() const { return ixmat.m12(); }
|
|---|
| 399 | double im21() const { return ixmat.m21(); }
|
|---|
| 400 | double im22() const { return ixmat.m22(); }
|
|---|
| 401 | double idx() const { return ixmat.dx(); }
|
|---|
| 402 | double idy() const { return ixmat.dy(); }
|
|---|
| 403 |
|
|---|
| 404 | int txop;
|
|---|
| 405 | bool txinv;
|
|---|
| 406 |
|
|---|
| 407 | #else
|
|---|
| 408 | // even without transformations we still have translations
|
|---|
| 409 | int xlatex;
|
|---|
| 410 | int xlatey;
|
|---|
| 411 | #endif
|
|---|
| 412 |
|
|---|
| 413 | void *penRef; // pen cache ref
|
|---|
| 414 | void *brushRef; // brush cache ref
|
|---|
| 415 | void *ps_stack;
|
|---|
| 416 | void *wm_stack;
|
|---|
| 417 | void killPStack();
|
|---|
| 418 |
|
|---|
| 419 | protected:
|
|---|
| 420 | #ifdef Q_OS_TEMP
|
|---|
| 421 | QPoint internalCurrentPos;
|
|---|
| 422 | uint old_pix; // ### All win platforms in 4.0
|
|---|
| 423 | #endif
|
|---|
| 424 | #if defined(Q_WS_WIN)
|
|---|
| 425 | friend class QFontEngineWin;
|
|---|
| 426 | friend class QFontEngineBox;
|
|---|
| 427 | QT_WIN_PAINTER_MEMBERS
|
|---|
| 428 | #elif defined(Q_WS_X11)
|
|---|
| 429 | friend class QFontEngineXLFD;
|
|---|
| 430 | friend class QFontEngineXft;
|
|---|
| 431 | friend class QFontEngineBox;
|
|---|
| 432 | Display *dpy; // current display
|
|---|
| 433 | int scrn; // current screen
|
|---|
| 434 | Qt::HANDLE hd; // handle to drawable
|
|---|
| 435 | Qt::HANDLE rendhd; // handle to Xft draw
|
|---|
| 436 | GC gc; // graphics context (standard)
|
|---|
| 437 | GC gc_brush; // graphics contect for brush
|
|---|
| 438 | QPoint curPt; // current point
|
|---|
| 439 | uint clip_serial; // clipping serial number
|
|---|
| 440 | #elif defined(Q_WS_MAC)
|
|---|
| 441 | Qt::HANDLE hd; // handle to drawable
|
|---|
| 442 | void initPaintDevice(bool force=FALSE, QPoint *off=NULL, QRegion *rgn=NULL);
|
|---|
| 443 | friend const QRegion &qt_mac_update_painter(QPainter *, bool);
|
|---|
| 444 | friend class QFontEngineMac;
|
|---|
| 445 | friend class QMacPainter;
|
|---|
| 446 | #elif defined(Q_WS_QWS)
|
|---|
| 447 | friend class QFontEngine;
|
|---|
| 448 | QGfx * gfx;
|
|---|
| 449 | friend void qwsUpdateActivePainters();
|
|---|
| 450 | #endif
|
|---|
| 451 | friend class QFontMetrics;
|
|---|
| 452 | friend class QFontInfo;
|
|---|
| 453 | friend class QTextLayout;
|
|---|
| 454 | friend void qt_format_text( const QFont &, const QRect &r,
|
|---|
| 455 | int tf, const QString& str, int len, QRect *brect,
|
|---|
| 456 | int tabstops, int* tabarray, int tabarraylen,
|
|---|
| 457 | QTextParag **internal, QPainter* painter );
|
|---|
| 458 | friend void qt_draw_background( QPainter *p, int x, int y, int w, int h );
|
|---|
| 459 | friend void qt_draw_transformed_rect( QPainter *p, int x, int y, int w, int h, bool fill );
|
|---|
| 460 | friend class QPrinter;
|
|---|
| 461 |
|
|---|
| 462 | private: // Disabled copy constructor and operator=
|
|---|
| 463 | #if defined(Q_DISABLE_COPY)
|
|---|
| 464 | QPainter( const QPainter & );
|
|---|
| 465 | QPainter &operator=( const QPainter & );
|
|---|
| 466 | #endif
|
|---|
| 467 |
|
|---|
| 468 | enum TransformationCodes {
|
|---|
| 469 | TxNone = 0, // transformation codes
|
|---|
| 470 | TxTranslate = 1, // copy in qpainter_*.cpp
|
|---|
| 471 | TxScale = 2,
|
|---|
| 472 | TxRotShear = 3
|
|---|
| 473 | };
|
|---|
| 474 | };
|
|---|
| 475 |
|
|---|
| 476 |
|
|---|
| 477 | /*****************************************************************************
|
|---|
| 478 | QPainter member functions
|
|---|
| 479 | *****************************************************************************/
|
|---|
| 480 |
|
|---|
| 481 | inline QPaintDevice *QPainter::device() const
|
|---|
| 482 | {
|
|---|
| 483 | return pdev;
|
|---|
| 484 | }
|
|---|
| 485 |
|
|---|
| 486 | inline bool QPainter::isActive() const
|
|---|
| 487 | {
|
|---|
| 488 | return testf(IsActive);
|
|---|
| 489 | }
|
|---|
| 490 |
|
|---|
| 491 | inline const QFont &QPainter::font() const
|
|---|
| 492 | {
|
|---|
| 493 | return cfont;
|
|---|
| 494 | }
|
|---|
| 495 |
|
|---|
| 496 | inline const QPen &QPainter::pen() const
|
|---|
| 497 | {
|
|---|
| 498 | return cpen;
|
|---|
| 499 | }
|
|---|
| 500 |
|
|---|
| 501 | inline const QBrush &QPainter::brush() const
|
|---|
| 502 | {
|
|---|
| 503 | return cbrush;
|
|---|
| 504 | }
|
|---|
| 505 |
|
|---|
| 506 | /*
|
|---|
| 507 | inline PaintUnit QPainter::unit() const
|
|---|
| 508 | {
|
|---|
| 509 | return (PaintUnit)pu;
|
|---|
| 510 | }
|
|---|
| 511 | */
|
|---|
| 512 |
|
|---|
| 513 | inline const QColor &QPainter::backgroundColor() const
|
|---|
| 514 | {
|
|---|
| 515 | return bg_col;
|
|---|
| 516 | }
|
|---|
| 517 |
|
|---|
| 518 | inline Qt::BGMode QPainter::backgroundMode() const
|
|---|
| 519 | {
|
|---|
| 520 | return (BGMode)bg_mode;
|
|---|
| 521 | }
|
|---|
| 522 |
|
|---|
| 523 | inline Qt::RasterOp QPainter::rasterOp() const
|
|---|
| 524 | {
|
|---|
| 525 | return (RasterOp)rop;
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 | inline const QPoint &QPainter::brushOrigin() const
|
|---|
| 529 | {
|
|---|
| 530 | return bro;
|
|---|
| 531 | }
|
|---|
| 532 |
|
|---|
| 533 | inline bool QPainter::hasViewXForm() const
|
|---|
| 534 | {
|
|---|
| 535 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 536 | return testf(VxF);
|
|---|
| 537 | #else
|
|---|
| 538 | return xlatex || xlatey;
|
|---|
| 539 | #endif
|
|---|
| 540 | }
|
|---|
| 541 |
|
|---|
| 542 | inline bool QPainter::hasWorldXForm() const
|
|---|
| 543 | {
|
|---|
| 544 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 545 | return testf(WxF);
|
|---|
| 546 | #else
|
|---|
| 547 | return xlatex || xlatey;
|
|---|
| 548 | #endif
|
|---|
| 549 | }
|
|---|
| 550 |
|
|---|
| 551 | inline double QPainter::translationX() const
|
|---|
| 552 | {
|
|---|
| 553 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 554 | return worldMatrix().dx();
|
|---|
| 555 | #else
|
|---|
| 556 | return xlatex;
|
|---|
| 557 | #endif
|
|---|
| 558 | }
|
|---|
| 559 |
|
|---|
| 560 | inline double QPainter::translationY() const
|
|---|
| 561 | {
|
|---|
| 562 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 563 | return worldMatrix().dy();
|
|---|
| 564 | #else
|
|---|
| 565 | return xlatey;
|
|---|
| 566 | #endif
|
|---|
| 567 | }
|
|---|
| 568 |
|
|---|
| 569 |
|
|---|
| 570 | inline bool QPainter::hasClipping() const
|
|---|
| 571 | {
|
|---|
| 572 | return testf(ClipOn);
|
|---|
| 573 | }
|
|---|
| 574 |
|
|---|
| 575 | inline int QPainter::tabStops() const
|
|---|
| 576 | {
|
|---|
| 577 | return tabstops;
|
|---|
| 578 | }
|
|---|
| 579 |
|
|---|
| 580 | inline int *QPainter::tabArray() const
|
|---|
| 581 | {
|
|---|
| 582 | return tabarray;
|
|---|
| 583 | }
|
|---|
| 584 |
|
|---|
| 585 | #if defined(Q_WS_WIN)
|
|---|
| 586 | inline HDC QPainter::handle() const
|
|---|
| 587 | {
|
|---|
| 588 | return hdc;
|
|---|
| 589 | }
|
|---|
| 590 | #elif defined(Q_WS_X11) || defined(Q_WS_MAC)
|
|---|
| 591 | inline Qt::HANDLE QPainter::handle() const
|
|---|
| 592 | {
|
|---|
| 593 | return hd;
|
|---|
| 594 | }
|
|---|
| 595 | #endif
|
|---|
| 596 |
|
|---|
| 597 | inline void QPainter::setBrushOrigin( const QPoint &p )
|
|---|
| 598 | {
|
|---|
| 599 | setBrushOrigin( p.x(), p.y() );
|
|---|
| 600 | }
|
|---|
| 601 |
|
|---|
| 602 | #ifndef QT_NO_TRANSFORMATIONS
|
|---|
| 603 | inline void QPainter::setWindow( const QRect &r )
|
|---|
| 604 | {
|
|---|
| 605 | setWindow( r.x(), r.y(), r.width(), r.height() );
|
|---|
| 606 | }
|
|---|
| 607 |
|
|---|
| 608 | inline void QPainter::setViewport( const QRect &r )
|
|---|
| 609 | {
|
|---|
| 610 | setViewport( r.x(), r.y(), r.width(), r.height() );
|
|---|
| 611 | }
|
|---|
| 612 | #endif
|
|---|
| 613 |
|
|---|
| 614 | inline void QPainter::setClipRect( int x, int y, int w, int h, CoordinateMode m )
|
|---|
| 615 | {
|
|---|
| 616 | setClipRect( QRect(x,y,w,h), m );
|
|---|
| 617 | }
|
|---|
| 618 |
|
|---|
| 619 | inline void QPainter::drawPoint( const QPoint &p )
|
|---|
| 620 | {
|
|---|
| 621 | drawPoint( p.x(), p.y() );
|
|---|
| 622 | }
|
|---|
| 623 |
|
|---|
| 624 | inline void QPainter::moveTo( const QPoint &p )
|
|---|
| 625 | {
|
|---|
| 626 | moveTo( p.x(), p.y() );
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 | inline void QPainter::lineTo( const QPoint &p )
|
|---|
| 630 | {
|
|---|
| 631 | lineTo( p.x(), p.y() );
|
|---|
| 632 | }
|
|---|
| 633 |
|
|---|
| 634 | inline void QPainter::drawLine( const QPoint &p1, const QPoint &p2 )
|
|---|
| 635 | {
|
|---|
| 636 | drawLine( p1.x(), p1.y(), p2.x(), p2.y() );
|
|---|
| 637 | }
|
|---|
| 638 |
|
|---|
| 639 | inline void QPainter::drawRect( const QRect &r )
|
|---|
| 640 | {
|
|---|
| 641 | drawRect( r.x(), r.y(), r.width(), r.height() );
|
|---|
| 642 | }
|
|---|
| 643 |
|
|---|
| 644 | inline void QPainter::drawWinFocusRect( const QRect &r )
|
|---|
| 645 | {
|
|---|
| 646 | drawWinFocusRect( r.x(), r.y(), r.width(), r.height() );
|
|---|
| 647 | }
|
|---|
| 648 |
|
|---|
| 649 | inline void QPainter::drawWinFocusRect( const QRect &r,const QColor &penColor )
|
|---|
| 650 | {
|
|---|
| 651 | drawWinFocusRect( r.x(), r.y(), r.width(), r.height(), penColor );
|
|---|
| 652 | }
|
|---|
| 653 |
|
|---|
| 654 | inline void QPainter::drawRoundRect( const QRect &r, int xRnd, int yRnd )
|
|---|
| 655 | {
|
|---|
| 656 | drawRoundRect( r.x(), r.y(), r.width(), r.height(), xRnd, yRnd );
|
|---|
| 657 | }
|
|---|
| 658 |
|
|---|
| 659 | inline void QPainter::drawEllipse( const QRect &r )
|
|---|
| 660 | {
|
|---|
| 661 | drawEllipse( r.x(), r.y(), r.width(), r.height() );
|
|---|
| 662 | }
|
|---|
| 663 |
|
|---|
| 664 | inline void QPainter::drawArc( const QRect &r, int a, int alen )
|
|---|
| 665 | {
|
|---|
| 666 | drawArc( r.x(), r.y(), r.width(), r.height(), a, alen );
|
|---|
| 667 | }
|
|---|
| 668 |
|
|---|
| 669 | inline void QPainter::drawPie( const QRect &r, int a, int alen )
|
|---|
| 670 | {
|
|---|
| 671 | drawPie( r.x(), r.y(), r.width(), r.height(), a, alen );
|
|---|
| 672 | }
|
|---|
| 673 |
|
|---|
| 674 | inline void QPainter::drawChord( const QRect &r, int a, int alen )
|
|---|
| 675 | {
|
|---|
| 676 | drawChord( r.x(), r.y(), r.width(), r.height(), a, alen );
|
|---|
| 677 | }
|
|---|
| 678 |
|
|---|
| 679 | inline void QPainter::drawPixmap( const QPoint &p, const QPixmap &pm,
|
|---|
| 680 | const QRect &sr )
|
|---|
| 681 | {
|
|---|
| 682 | drawPixmap( p.x(), p.y(), pm, sr.x(), sr.y(), sr.width(), sr.height() );
|
|---|
| 683 | }
|
|---|
| 684 |
|
|---|
| 685 | inline void QPainter::drawImage( const QPoint &p, const QImage &pm,
|
|---|
| 686 | const QRect &sr, int conversionFlags )
|
|---|
| 687 | {
|
|---|
| 688 | drawImage( p.x(), p.y(), pm,
|
|---|
| 689 | sr.x(), sr.y(), sr.width(), sr.height(), conversionFlags );
|
|---|
| 690 | }
|
|---|
| 691 |
|
|---|
| 692 | inline void QPainter::drawTiledPixmap( const QRect &r, const QPixmap &pm,
|
|---|
| 693 | const QPoint &sp )
|
|---|
| 694 | {
|
|---|
| 695 | drawTiledPixmap( r.x(), r.y(), r.width(), r.height(), pm, sp.x(), sp.y() );
|
|---|
| 696 | }
|
|---|
| 697 |
|
|---|
| 698 | inline void QPainter::drawTiledPixmap( const QRect &r, const QPixmap &pm )
|
|---|
| 699 | {
|
|---|
| 700 | drawTiledPixmap( r.x(), r.y(), r.width(), r.height(), pm, 0, 0 );
|
|---|
| 701 | }
|
|---|
| 702 |
|
|---|
| 703 | inline void QPainter::fillRect( const QRect &r, const QBrush &brush )
|
|---|
| 704 | {
|
|---|
| 705 | fillRect( r.x(), r.y(), r.width(), r.height(), brush );
|
|---|
| 706 | }
|
|---|
| 707 |
|
|---|
| 708 | inline void QPainter::eraseRect( int x, int y, int w, int h )
|
|---|
| 709 | {
|
|---|
| 710 | fillRect( x, y, w, h, backgroundColor() );
|
|---|
| 711 | }
|
|---|
| 712 |
|
|---|
| 713 | inline void QPainter::eraseRect( const QRect &r )
|
|---|
| 714 | {
|
|---|
| 715 | fillRect( r.x(), r.y(), r.width(), r.height(), backgroundColor() );
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | inline void QPainter::drawText( const QPoint &p, const QString &s, int len, TextDirection dir )
|
|---|
| 719 | {
|
|---|
| 720 | drawText( p.x(), p.y(), s, 0, len, dir );
|
|---|
| 721 | }
|
|---|
| 722 |
|
|---|
| 723 | inline void QPainter::drawText( const QPoint &p, const QString &s, int pos, int len, TextDirection dir )
|
|---|
| 724 | {
|
|---|
| 725 | drawText( p.x(), p.y(), s, pos, len, dir );
|
|---|
| 726 | }
|
|---|
| 727 |
|
|---|
| 728 | inline void QPainter::drawText( int x, int y, int w, int h, int tf,
|
|---|
| 729 | const QString& str, int len, QRect *br, QTextParag **i )
|
|---|
| 730 | {
|
|---|
| 731 | QRect r(x, y, w, h);
|
|---|
| 732 | drawText( r, tf, str, len, br, i );
|
|---|
| 733 | }
|
|---|
| 734 |
|
|---|
| 735 | inline void QPainter::drawTextItem( const QPoint& p, const QTextItem &ti, int textflags )
|
|---|
| 736 | {
|
|---|
| 737 | drawTextItem( p.x(), p.y(), ti, textflags );
|
|---|
| 738 | }
|
|---|
| 739 |
|
|---|
| 740 | inline QRect QPainter::boundingRect( int x, int y, int w, int h, int tf,
|
|---|
| 741 | const QString& str, int len, QTextParag **i )
|
|---|
| 742 | {
|
|---|
| 743 | QRect r(x, y, w, h);
|
|---|
| 744 | return boundingRect( r, tf, str, len, i );
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 | #if defined(Q_WS_QWS)
|
|---|
| 748 | inline QGfx * QPainter::internalGfx()
|
|---|
| 749 | {
|
|---|
| 750 | return gfx;
|
|---|
| 751 | }
|
|---|
| 752 | #endif
|
|---|
| 753 |
|
|---|
| 754 | #endif // QPAINTER_H
|
|---|
| 755 | </pre>
|
|---|
| 756 | <!-- eof -->
|
|---|
| 757 | <p><address><hr><div align=center>
|
|---|
| 758 | <table width=100% cellspacing=0 border=0><tr>
|
|---|
| 759 | <td>Copyright © 2007
|
|---|
| 760 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|---|
| 761 | <td align=right><div align=right>Qt 3.3.8</div>
|
|---|
| 762 | </table></div></address></body>
|
|---|
| 763 | </html>
|
|---|