Eneboo - Documentación para desarrolladores
src/flbase/FLPicture.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002  FLPicture.h
00003  -------------------
00004  begin                : 30/01/2008
00005  copyright            : (C) 2003-2008 by InfoSiAL S.L.
00006  email                : mail@infosial.com
00007  ***************************************************************************/
00008 /***************************************************************************
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; version 2 of the License.               *
00012  ***************************************************************************/
00013 /***************************************************************************
00014  Este  programa es software libre. Puede redistribuirlo y/o modificarlo
00015  bajo  los  términos  de  la  Licencia  Pública General de GNU   en  su
00016  versión 2, publicada  por  la  Free  Software Foundation.
00017  ***************************************************************************/
00018 
00019 #ifndef FLPICTURE_H
00020 #define FLPICTURE_H
00021 
00022 #include <qobject.h>
00023 #include <qpicture.h>
00024 #include <qpainter.h>
00025 #include <qpaintdevice.h>
00026 #include <qpixmap.h>
00027 #include <qdeepcopy.h>
00028 
00029 class FLPicturePrivate;
00030 
00031 class FL_EXPORT FLPicture : public QObject {
00032 
00033   Q_OBJECT
00034   Q_ENUMS( FLPenStyle )
00035   Q_ENUMS( FLBrushStyle )
00036   Q_ENUMS( FLBGMode )
00037   Q_ENUMS( FLRasterOp )
00038   Q_ENUMS( FLCoordinateMode );
00039   Q_ENUMS( FLTextDirection );
00040 
00041 public:
00042 
00043   enum FLPenStyle {
00044     NoPen,
00045     SolidLine,
00046     DashLine,
00047     DotLine,
00048     DashDotLine,
00049     DashDotDotLine,
00050     MPenStyle = 0x0f
00051   };
00052 
00053   enum FLBrushStyle {
00054     NoBrush,
00055     SolidPattern,
00056     Dense1Pattern,
00057     Dense2Pattern,
00058     Dense3Pattern,
00059     Dense4Pattern,
00060     Dense5Pattern,
00061     Dense6Pattern,
00062     Dense7Pattern,
00063     HorPattern,
00064     VerPattern,
00065     CrossPattern,
00066     BDiagPattern,
00067     FDiagPattern,
00068     DiagCrossPattern,
00069     CustomPattern = 24
00070   };
00071 
00072   enum FLBGMode {
00073     TransparentMode,
00074     OpaqueMode
00075   };
00076 
00077   enum FLRasterOp {
00078     CopyROP,
00079     OrROP,
00080     XorROP,
00081     NotAndROP, EraseROP = NotAndROP,
00082     NotCopyROP,
00083     NotOrROP,
00084     NotXorROP,
00085     AndROP, NotEraseROP = AndROP,
00086     NotROP,
00087     ClearROP,
00088     SetROP,
00089     NopROP,
00090     AndNotROP,
00091     OrNotROP,
00092     NandROP,
00093     NorROP, LastROP = NorROP
00094   };
00095 
00096   enum FLCoordinateMode {
00097     CoordDevice,
00098     CoordPainter
00099   };
00100 
00101   enum FLTextDirection {
00102     Auto,
00103     RTL,
00104     LTR
00105   };
00106 
00107   enum FLAlignment {
00108     AlignAuto = Qt::AlignAuto,
00109     AlignLeft = Qt::AlignLeft,
00110     AlignRight = Qt::AlignRight,
00111     AlignHCenter = Qt::AlignHCenter,
00112     AlignJustify = Qt::AlignJustify,
00113     AlignTop = Qt::AlignTop,
00114     AlignBottom= Qt::AlignBottom,
00115     AlignVCenter = Qt::AlignVCenter,
00116     AlignCenter = Qt::AlignCenter,
00117     AlignHorizontal_Mask = Qt::AlignHorizontal_Mask,
00118     AlignVertical_Mask = Qt::AlignVertical_Mask
00119   };
00120 
00121   FLPicture( QObject * parent = 0, const char * name = 0 );
00122   FLPicture( FLPicture * other );
00123   FLPicture( const QPicture & pic );
00124   FLPicture( QPicture * pic, QObject * parent, const char * name = 0 );
00125   FLPicture( QPicture * pic, QPainter * pte, QObject * parent, const char * name = 0 );
00126 
00127   ~FLPicture();
00128 
00129 public slots:
00130 
00131   QPicture * picture() const;
00132   void setPicture( const QPicture & pic );
00133   void setPicture( QPicture * pic );
00134 
00135   bool isNull() const;
00136   bool load( const QString & fileName, const char * format = 0 );
00137   bool save( const QString & fileName, const char * format = 0 );
00138   QRect boundingRect() const;
00139   void setBoundingRect( const QRect & r );
00140   bool begin();
00141   bool end() const;
00142   void cleanup();
00143   bool isActive() const;
00144   void flush() const;
00145   void savePainter() const;
00146   void restorePainter() const;
00147 
00148   const QFont & font() const;
00149   void setFont( const QFont & font ) const;
00150   void setPen( const QColor & color, uint width = 0, FLPenStyle style = FLPicture::SolidLine ) const;
00151   void setBrush( const QColor & color, FLBrushStyle style = FLPicture::SolidPattern ) const;
00152 
00153   const QColor & backgroundColor() const;
00154   void setBackgroundColor( const QColor & color ) const;
00155   FLPicture::FLBGMode backgroundMode() const;
00156   void setBackgroundMode( FLBGMode bgm ) const;
00157   FLPicture::FLRasterOp rasterOp() const;
00158   void setRasterOp( FLRasterOp rop ) const;
00159   const QPoint & brushOrigin() const;
00160   void setBrushOrigin( int x, int y ) const;
00161   void setBrushOrigin( const QPoint & pt ) const;
00162 
00163   //bool hasViewXForm() const;
00164   //bool hasWorldXForm() const;
00165   //void setViewXForm( bool );
00166   QRect window() const;
00167   void setWindow( const QRect & r ) const;
00168   void setWindow( int x, int y, int w, int h ) const;
00169   QRect viewport() const;
00170   void setViewport( const QRect & r ) const;
00171   void setViewport( int x, int y, int w, int h ) const;
00172 
00173   //void setWorldXForm( bool );
00174   //const QWMatrix &worldMatrix() const;
00175   //void setWorldMatrix( const QWMatrix &, bool combine=FALSE );
00176 
00177   //void saveWorldMatrix();
00178   //void restoreWorldMatrix();
00179 
00180   void scale( double sx, double sy ) const;
00181   void shear( double sh, double sv ) const;
00182   void rotate( double a ) const;
00183   void translate( double dx, double dy ) const;
00184   //void resetXForm();
00185   double translationX() const;
00186   double translationY() const;
00187 
00188   //QPoint xForm( const QPoint & ) const;
00189   //QRect xForm( const QRect & ) const;
00190   //QPointArray xForm( const QPointArray & ) const;
00191   //QPointArray xForm( const QPointArray &, int index, int npoints ) const;
00192   //QPoint xFormDev( const QPoint & ) const;
00193   //QRect xFormDev( const QRect & )  const;
00194   //QPointArray xFormDev( const QPointArray & ) const;
00195   //QPointArray xFormDev( const QPointArray &, int index, int npoints ) const;
00196 
00197   void setClipping( bool c ) const;
00198   bool hasClipping() const;
00199   //QRegion clipRegion( CoordinateMode = CoordDevice ) const;
00200   void setClipRect( const QRect & r, FLCoordinateMode co = CoordDevice ) const;
00201   void setClipRect( int x, int y, int w, int h, FLCoordinateMode co = CoordDevice ) const;
00202   //void setClipRegion( const QRegion &, CoordinateMode = CoordDevice );
00203 
00204   void drawLine( int x1, int y1, int x2, int y2 ) const;
00205   void drawLine( const QPoint & pt1, const QPoint & pt2 ) const;
00206   void drawPoint( int x, int y ) const;
00207   void drawPoint( const QPoint & pt ) const;
00208   //void drawPoints( const QPointArray& a, int index=0, int npoints=-1 );
00209   void moveTo( int x, int y ) const;
00210   void moveTo( const QPoint & pt ) const;
00211   void lineTo( int x, int y ) const;
00212   void lineTo( const QPoint & pt ) const;
00213   void drawRect( int x, int y, int w, int h ) const;
00214   void drawRect( const QRect & r ) const;
00215   void drawWinFocusRect( int x, int y, int w, int h ) const;
00216   void drawWinFocusRect( int x, int y, int w, int h, const QColor & bgColor ) const;
00217   void drawWinFocusRect( const QRect & r ) const;
00218   void drawWinFocusRect( const QRect & r, const QColor & bgColor ) const;
00219   void drawRoundRect( int x, int y, int w, int h, int xRnd = 25, int yRnd = 25 ) const;
00220   void drawRoundRect( const QRect & r, int xRnd = 25, int yRnd = 25 ) const;
00221   void drawEllipse( int x, int y, int w, int h ) const;
00222   void drawEllipse( const QRect & r ) const;
00223   void drawArc( int x, int y, int w, int h, int a, int alen ) const;
00224   void drawArc( const QRect & r, int a, int alen ) const;
00225   void drawPie( int x, int y, int w, int h, int a, int alen ) const;
00226   void drawPie( const QRect & r, int a, int alen ) const;
00227   void drawChord( int x, int y, int w, int h, int a, int alen ) const;
00228   void drawChord( const QRect & r, int a, int alen ) const;
00229   //void drawLineSegments( const QPointArray &, int index=0, int nlines=-1 );
00230   //void drawPolyline( const QPointArray &, int index=0, int npoints=-1 );
00231   //void drawPolygon( const QPointArray &, bool winding=FALSE, int index=0, int npoints=-1 );
00232   //void drawConvexPolygon( const QPointArray &, int index=0, int npoints=-1 );
00233   //void drawCubicBezier( const QPointArray &, int index=0 );
00234   void drawPixmap( int x, int y, const QPixmap & pix, int sx = 0, int sy = 0, int sw = -1, int sh = -1 ) const;
00235   void drawPixmap( const QPoint & pt, const QPixmap & pix, const QRect & r ) const;
00236   void drawPixmap( const QPoint & pt, const QPixmap & pix ) const;
00237   void drawPixmap( const QRect & r, const QPixmap & pix ) const;
00238   //void drawImage( int x, int y, const QImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 );
00239   //void drawImage( const QPoint &, const QImage &, const QRect &sr, int conversionFlags = 0 );
00240   //void drawImage( const QPoint &, const QImage &, int conversion_flags = 0 );
00241   //void drawImage( const QRect &, const QImage & );
00242   void drawTiledPixmap( int x, int y, int w, int h, const QPixmap & pix, int sx = 0, int sy = 0 ) const;
00243   void drawTiledPixmap( const QRect & r, const QPixmap & pix, const QPoint & pt ) const;
00244   void drawTiledPixmap( const QRect & r, const QPixmap & pix ) const;
00245   void drawPicture( FLPicture * pic );
00246   void drawPicture( int x, int y, FLPicture * pic ) const;
00247   void drawPicture( const QPoint & pt, FLPicture * pic ) const;
00248 
00249   void fillRect( int x, int y, int w, int h, const QColor & color, FLBrushStyle style = FLPicture::SolidPattern ) const;
00250   void fillRect( const QRect & r, const QColor & color, FLBrushStyle style = FLPicture::SolidPattern ) const;
00251   void eraseRect( int x, int y, int w, int h ) const;
00252   void eraseRect( const QRect & r ) const;
00253 
00254   void drawText( int x, int y, const QString & t, int len = -1, FLTextDirection dir = Auto ) const;
00255   void drawText( const QPoint & pt, const QString & t, int len = -1, FLTextDirection dir = Auto ) const;
00256   void drawText( int x, int y, const QString & t, int pos, int len, FLTextDirection dir = Auto ) const;
00257   void drawText( const QPoint & p, const QString & t, int pos, int len, FLTextDirection dir = Auto ) const;
00258   void drawText( int x, int y, int w, int h, int flags, const QString & t, int len = -1, QRect * br = 0/*, QTextParag **intern=0*/) const;
00259   void drawText( const QRect & r, int flags, const QString & t, int len = -1, QRect * br = 0/*, QTextParag **intern=0*/) const;
00260 
00261   //void drawTextItem( int x, int y, const QTextItem &ti, int textflags = 0 );
00262   //void drawTextItem( const QPoint& p, const QTextItem &ti, int textflags = 0 );
00263 
00264   QRect boundingRect( int x, int y, int w, int h, int flags, const QString & t, int len = -1/*, QTextParag **intern=0*/) const;
00265   QRect boundingRect( const QRect & r, int flags, const QString & t, int len = -1/*, QTextParag **intern=0*/) const;
00266 
00267   QPixmap * playOnPixmap( QPixmap * pix );
00268   FLPicture * playOnPicture( FLPicture * pic );
00269 
00270 private:
00271 
00272   FLPicturePrivate * d;
00273 };
00274 
00275 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'