5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
8 ImageObj::ImageObj( Q3Canvas *canvas )
9 : Q3CanvasRectangle( canvas )
11 // cout << "Const ImageObj (canvas)\n";
18 // cout << "Destr ImageObj\n";
21 void ImageObj::copy(ImageObj* other)
23 setSize (other->width(), other->height() );
24 setVisibility (other->isVisible() );
32 void ImageObj::setVisibility (bool v)
40 void ImageObj::save(const QString &fn, const char *format)
44 case undef: qWarning("Warning: ImageObj::save() type=undef");break;
45 case qimage: image.save (fn,format,-1);break;
46 case qpixmap: pixmap.save (fn,format,-1);break;
50 bool ImageObj::load (const QString &fn)
52 if (!image.load( fn) )
53 //cout << "Fatal Error in ImageObj::load ("<<fn<<")\n";
55 setSize( image.width(), image.height() );
58 #if !defined(Q_WS_QWS)
59 pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
64 bool ImageObj::load (QPixmap pm)
66 #if !defined(Q_WS_QWS)
67 //pixmap.convertFromImage(image, OrderedAlphaDither);
70 setSize( pm.width(), pm.height() );
74 setSize( image.width(), image.height() );
79 void ImageObj::setImage(QImage img)
83 pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
86 QPixmap ImageObj::getPixmap()
91 void ImageObj::drawShape( QPainter &p )
93 // On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
94 // but on other platforms, we need to use a QPixmap.
96 p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
98 p.drawPixmap( int(x()), int(y()), pixmap );