home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qpainter.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  20KB  |  683 lines

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