void AiView::paintEvent ( QPaintEvent *  event  )  [protected]
Parameters:
event : Qt paint event

Definition at line 56 of file aiview.cpp.

00057 {
00058      if ( !this->m_image.isNull() )
00059      {
00060          QPainter painter( this );
00061          QMatrix matrix;
00062 
00063          //~ set a custom scale
00064          if( m_scaleX != .0 && m_scaleY != .0  )
00065          {
00066              static qreal scaleX = .0;
00067              static qreal scaleY = .0;
00068 
00069              scaleX = m_scale ? m_clearScale ? m_scaleX : scaleX + m_scaleX : scaleX;
00070              scaleY = m_scale ? m_clearScale ? m_scaleY : scaleY + m_scaleY : scaleY;
00071 
00072              matrix.scale(scaleX, scaleY);
00073              m_scale = m_clearScale = false;
00074          }
00075          //~ set a custom retation
00076          if( m_retation != .0 && m_retation <= 360. )
00077          {
00078              //# rotation
00079              matrix.rotate( m_retation );
00080          }
00081 
00082          //~ set image mirror
00083          else if( m_canRetate && m_retation == 361. )
00084          {
00085              //# horizonatal
00086              m_image = m_image.mirrored(true,false);
00087              m_canRetate = false ;
00088          }
00089          else if( m_canRetate && m_retation == 362. )
00090          {
00091              //# virdircal
00092              m_image = m_image.mirrored(false,true);
00093              m_canRetate = false ;
00094          }
00095 
00096          QImage tmp = this->m_image.transformed( matrix) ;
00097          //~ fill and draw image with current view parameters, with and height
00098          if( m_fill2Win )
00099          {
00100              painter.drawPixmap(0, 0, this->width(), this->height(), QPixmap::fromImage(tmp) ) ;
00101          }
00102          else
00103          {
00104              int x = ( this->width() / 2 ) - ( tmp.width() / 2 );
00105              int y = ( this->height() / 2 ) - ( tmp.height() / 2 );
00106              painter.drawPixmap(x, y, QPixmap::fromImage(tmp) ) ;
00107          }
00108 
00109 
00110          if( m_isZooming )
00111          {
00112              int x = ( this->width() / 2 ) - ( tmp.width() / 2 );
00113              int y = ( this->height() / 2 ) - ( tmp.height() / 2 );
00114              //~ tesing if zooming zone in image *ONLY*
00115              if( m_startX >= x && m_startY >= y && m_endX <= x + tmp.width() && m_endY <= y + tmp.height() && m_endX > m_startX && m_endY > m_startY )
00116              {
00117                 painter.setPen(QColor(255,255,255));
00118 
00119                 painter.drawRect(m_startX, m_startY, m_endX - m_startX , m_endY - m_startY );
00120                 painter.drawPixmap(m_endX , m_endY , QPixmap(":/png/zoom-in"));
00121              }
00122          }
00123 
00124 
00125          painter.end();
00126      }
00127 }

 All Classes Namespaces Files Functions Variables Typedefs

Generated on Sat Feb 27 08:33:25 2010 for AiFractals by  doxygen 1.6.1