Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

qsdrvqt.h

00001 
00002 /***************************************************************************
00003                                qsdrvqt.h
00004                              -------------------                                         
00005     begin                : 01-January-2000
00006     copyright            : (C) 2000 by Kamil Dobkowski                         
00007     email                : kamildobk@poczta.onet.pl                                     
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   * 
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef QSDRVQT_H
00020 #define QSDRVQT_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025 
00026 #include"qsdrv.h"
00027 #include<math.h>
00028 #include<qpainter.h>
00029 
00030 class QImage;
00031 
00032 //-------------------------------------------------------------//
00033 
00038 class QSDrvQt : public QSDrv
00039  {
00040   public:
00044     QSDrvQt();
00048     virtual ~QSDrvQt();
00052     virtual QSDrvQt *copy();
00056     static QPainter *copyPainter( const QPainter *painter );
00060     void copySettingsFrom( const QSDrvQt *drv );
00065     virtual void setDC( QPainter *p, double dpi = 72.0, bool deletePainter = false );
00069     QPainter *painter() const { return m_paint; }
00073     bool deletePainter() const { return m_delete_painter; }
00074 
00078     void startDrawing();
00083     void stopDrawing();
00084 
00085     void clearCanvas( const QSGFill& f, const QSPt2f& pos, const QSPt2f& size );
00086     void drawLine( const QSPt2f &one, const QSPt2f &two );
00087     void beginPolyline( const QSPt2f& pos );
00088     void drawPolylineTo( const QSPt2f& pos );
00089     void endPolyline(); 
00090     QSPt2f currPolylinePos() { return m_curr_polyline_pos; }
00091     void drawRect( const QSPt2f &p1, const QSPt2f &p2 );
00092     void drawPoly( const QSPt2f pts[], int npoints, const bool edges[] = NULL, int edgeAutoColor = 0 );
00093     void drawEllipse( const QSPt2f& p1, const QSPt2f& p2  );
00094     void drawText( const QSPt2f &pos, const QString& text, int align = AlignLeft | AlignBottom );
00095     QSPt2f textSize( const QString& text );
00096     void drawRText( const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom );
00097     void getRTextBoundingPoly(  QSPt2f outPts[4], const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom );
00098     void getPixmapBuffer( PixmapBuffer *buff, int pwidth, int pheight );
00099     void drawPixmap( const QSPt2f& pos, PixmapBuffer *data );
00100     void setFill( const QSGFill &f );
00101     void setFont( const QSGFont &f );
00102     void setLine( const QSGLine &l );
00103     QSGFont currentFont();
00104     QSGFill currentFill();
00105     QSGLine currentLine();
00109     static QSGFont toQSGFont( const QFont &f, const QColor &c, double dpi = 72.0 );
00113     static QFont toQFont( const QSGFont &f, double dpi = 72.0 );
00117     static QSGColor toQSGColor( const QColor &c );
00121     static QColor toQColor( const QSGColor &c );
00125     static QSGFill toQSGFill( const QBrush &b );
00129     static QBrush toQBrush( const QSGFill &f );
00133     static QSGLine toQSGLine( const QPen &p );
00137     static QPen toQPen( const QSGLine &p );
00138 
00139     protected:
00140     QPainter    *m_paint;
00141     QPointArray m_vert_array;
00142     QPointArray m_edge_array;
00143     QImage      *m_pixmap;
00144     QSGLine     m_line;
00145     QSGFill     m_cfill;
00146     QSGFont     m_curr_font;
00147     bool        m_delete_painter;
00148         QPen        m_curr_pen;
00149 
00150     QSPt2f m_curr_polyline_pos;
00151     int m_curr_polyline_style;
00152     double m_curr_polyline_t;
00153     double m_curr_polyline_pattern_length;
00154     double m_curr_polyline_pattern[6];
00155     static const int defpatterns[4][6];
00156     QPoint align_rect( const QRect& r, int align );
00157     inline int toInt( double value ) { return int(value+0.5); }
00158     void set_auto_pen( int autoColor );
00159  };
00160 
00161 
00162 #endif
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236 
00237 

Generated on Mon Mar 18 19:16:32 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002