ImageGraphicsItem.qt.C

00001 #ifndef IMAGEGRAPHICSITEM_C
00002 #define IMAGEGRAPHICSITEM_C
00003 
00004 #include <QtGui/qgraphicsscene.h>
00005 #include <QtGui/qpainter.h>
00006 #include <QtGui/qstyleoption.h>
00007 #include <QtCore/qcoreevent.h>
00008 
00009 #include "Qt4/ImageGraphicsItem.qt.H"
00010 #include "QtUtil/ImageConvert4.H"
00011 #include "Image/Image.H"
00012 
00013 
00014 // ######################################################################
00015 ImageGraphicsItem::ImageGraphicsItem()
00016 {
00017   QGraphicsItem::setZValue(0);
00018 }
00019 
00020 // ######################################################################
00021 QRectF ImageGraphicsItem::boundingRect() const
00022 {
00023   //return QRectF(0, 0, itsSize.width(), itsSize.height());
00024   return itsImage.rect();
00025 }
00026 
00027 // ######################################################################
00028 void ImageGraphicsItem::setImage(QImage img)
00029 {
00030   itsImage = img;
00031 }
00032 
00033 // ######################################################################
00034 void ImageGraphicsItem::setSize(QSize size)
00035 {
00036   itsSize = size;
00037   update();
00038 }
00039 
00040 
00041 // ######################################################################
00042 void ImageGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
00043 {
00044   painter->setClipRect( option->exposedRect );
00045   painter->drawImage(QPoint(0,0),itsImage);
00046 }
00047 
00048 QRectF ImageGraphicsItem::getRect()
00049 {
00050   return itsImage.rect();
00051 }
00052 #endif //IMAGEGRAPHICSITEM_C
00053 
Generated on Sun May 8 08:05:34 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3