Initial import.
3 /////////////////////////////////////////////////////////////////
5 /////////////////////////////////////////////////////////////////
6 ImageObj::ImageObj( QCanvas *canvas )
7 : QCanvasRectangle( canvas )
9 // cout << "Const ImageObj (canvas)\n";
16 // cout << "Destr ImageObj\n";
19 void ImageObj::copy(ImageObj* other)
21 setSize (other->width(), other->height() );
22 setVisibility (other->isVisible() );
30 void ImageObj::setVisibility (bool v)
38 void ImageObj::save(const QString &fn, const char *format)
42 case undef: qWarning("undef");break;
43 case qimage: image.save (fn,format,-1);break;
44 case qpixmap: pixmap.save (fn,format,-1);break;
48 bool ImageObj::load (const QString &fn)
50 if (!image.load( fn) )
51 //cout << "Fatal Error in ImageObj::load ("<<fn<<")\n";
53 setSize( image.width(), image.height() );
56 #if !defined(Q_WS_QWS)
57 pixmap.convertFromImage(image, OrderedAlphaDither);
62 bool ImageObj::load (QPixmap pm)
64 #if !defined(Q_WS_QWS)
65 //pixmap.convertFromImage(image, OrderedAlphaDither);
68 setSize( pm.width(), pm.height() );
72 setSize( image.width(), image.height() );
77 void ImageObj::setImage(QImage img)
81 pixmap.convertFromImage(image, OrderedAlphaDither);
84 QPixmap ImageObj::getPixmap()
89 void ImageObj::drawShape( QPainter &p )
91 // On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
92 // but on other platforms, we need to use a QPixmap.
94 p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
96 p.drawPixmap( int(x()), int(y()), pixmap );