[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-cygwin
Subject:    Re: Qt3/Win Free: qtoolbar problem?
From:       Peter_Kümmel <syntheticpp () gmx ! net>
Date:       2005-01-23 18:34:43
Message-ID: 41F3EE43.6000700 () gmx ! net
[Download RAW message or body]

Chris January wrote:

> I've attached two PNGs (one from Qt/Win 3.3.3 Free and one from Qt/Win 2.3
> NC) and a small test program for QBitmap. As you can see rendering of masked
> bitmaps is currently broken in every case.

One more bugs: the picture looks also different if no static variables are used,
see qt-333free-non-static.png and main.cpp.

The only good news is (for me) I haven't destroyed working code as picture
qt-333free-non-static-OLD-code.png shows, generated by disabling
the true case with >selfmask = false;< in QPainter::drawPixmap.

And I must confess that I don't really understand how all this bitmapping
and masking works, so it would take a while...

Peter



["qt-333free-non-static.png" (image/png)]
["main.cpp" (text/plain)]

/****************************************************************************
**
** QBitmap test program
**
*****************************************************************************/

#include <qapplication.h>
#include <qwidget.h>
#include <qbitmap.h>
#include <qpaintdevice.h>
#include <qpainter.h>


#include "standrews.xbm"
#include "stpatricks.xbm"
#include "stgeorges.xbm"
#include "stgeorges_mask.xbm"


class QBitmapWidget : public QWidget {
public:
	QBitmapWidget () : QWidget () 
	{
		standrews =		*new QBitmap (108, 70, (const uchar *) standrews_bits, true);
		stpatricks =	*new QBitmap (108, 70, (const uchar *) stpatricks_bits, true);
		stgeorges =		*new QBitmap (108, 70, (const uchar *) stgeorges_bits, true);
		stgeorges_mask = *new QBitmap (108, 70, (const uchar *) stgeorges_mask_bits, true);

		standrews_masked = standrews;
		standrews_masked.setMask (standrews_masked);

		stpatricks_masked = stpatricks;
		stpatricks_masked.setMask (stpatricks_masked);

		stgeorges_masked = stgeorges;
		stgeorges_masked.setMask (stgeorges_masked);

		setMinimumSize (324, 210);
	}

protected:
	void paintEvent ( QPaintEvent *e ) 
	{
		QPainter p (this);
//		p.setBrush (Qt::white);
//		p.eraseRect (e->rect ());

		p.setPen (Qt::blue);	p.drawPixmap (QPoint (0, 0),	standrews);
		p.setPen (Qt::black);	p.drawPixmap (QPoint (0, 70),	standrews);
		p.setPen (Qt::blue);	p.drawPixmap (QPoint (0, 140),	standrews_masked);
		
		p.setPen (Qt::red);		p.drawPixmap (QPoint (108, 0),	stpatricks);
		p.setPen (Qt::black);	p.drawPixmap (QPoint (108, 70),	stpatricks);
		p.setPen (Qt::red);		p.drawPixmap (QPoint (108, 140),stpatricks_masked);
		
		p.setPen (Qt::red); 	p.drawPixmap (QPoint (216, 0),	stgeorges);
		p.setPen (Qt::black);	p.drawPixmap (QPoint (216, 70), stgeorges_mask);
		p.setPen (Qt::red);		p.drawPixmap (QPoint (216, 140),stgeorges_masked);

		p.setPen (Qt::blue);	p.drawPixmap (QPoint (324, 0),	standrews);
		p.setPen (Qt::red);		p.drawPixmap (QPoint (324, 0),	stpatricks);
								p.drawPixmap (QPoint (324, 0),	stgeorges);
		p.setPen (Qt::black);	p.drawPixmap (QPoint (324, 70), standrews);
								p.drawPixmap (QPoint (324, 70), stpatricks);
								p.drawPixmap (QPoint (324, 70), stgeorges_mask);
								//p.drawPixmap (QPoint (324, 70), stgeorges);
		p.setPen (Qt::blue);	p.drawPixmap (QPoint (324, 140),standrews_masked);
		p.setPen (Qt::red);		p.drawPixmap (QPoint (324, 140),stpatricks_masked);
								p.drawPixmap (QPoint (324, 140),stgeorges_masked);
	}
private:
	QBitmap standrews, stpatricks, stgeorges, stgeorges_mask;
	QBitmap standrews_masked, stpatricks_masked, stgeorges_masked;
};

/*
QBitmap QBitmapWidget::standrews = QBitmap (108, 70, (const uchar *) standrews_bits, true);
QBitmap QBitmapWidget::stpatricks = QBitmap (108, 70, (const uchar *) stpatricks_bits, true);
QBitmap QBitmapWidget::stgeorges = QBitmap (108, 70, (const uchar *) stgeorges_bits, true);
QBitmap QBitmapWidget::stgeorges_mask = QBitmap (108, 70, (const uchar *) stgeorges_mask_bits, true);
*/

int main( int argc, char **argv )
{
    QApplication a(argc,argv);
   	
	QBitmapWidget w;
	a.setMainWidget( &w );
	w.resize(430, 210 );
	w.show();

    return a.exec();
}



["qt-333free-non-static-OLD-code.png" (image/png)]

_______________________________________________
kde-cygwin mailing list
kde-cygwin@kde.org
https://mail.kde.org/mailman/listinfo/kde-cygwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic