On Sep 25, 2011, at 6:27 PM, ext Holger Freyther wrote: > Hi, > > I tried to run the autotests for the directFB backend and for one I > am not sure how to proceed. In tst_qpixmap::mask() the test constructs > a QBitmap() and then sets this mask on the QPixmap and check that > pixmap.mask().isNull().
Doing QPixmap::setMask(QBitmap()) clears the mask, as stated in the documentation: "Setting a null mask resets the mask, leaving the previously transparent pixels black. The effect of this function is undefined when the pixmap is being painted on." > > The reduced test case is: > QPixmap pm(100,100); > QVERIFY(pm.mask().isNull()); > > or with looking at the implementation of QPixmap::mask() > QPixmap pm(); > QVERIFY(!pm.handle() || !pm.hasAlphaChannel()); > > > Is this a requirement for QPA platforms that the QPixmap by default > has no alphachannel or should the test be altered? A default constructed pixmap is opaque by default and will not have a mask and will not have an alpha channel. X11 is the only platform where we make a distinction between mask and alpha channel as Mac OS X, Windows and the Qt 5 lighthouse platforms use QImage with mask baked into the alpha channel. opacity = 0 means mask is 1. You need to fill a QPixmap with Qt::transparent or some other non-opaque color for it to get an alpha channel. I would be opposed to start changing the behavior here as that would start breaking existing code, primarily in the QWidget stack where pixmaps are used extensively. best regards, Gunnar > > cheers > holger > > _______________________________________________ > Qt5-feedback mailing list > [email protected] > http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback _______________________________________________ Qt5-feedback mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback
