File:  [Faith Repository] / faith / tests / rgba.cpp
Revision 1.2: download - view: text, annotated - select for diffs
Sat Dec 23 08:33:08 2006 UTC (3 years, 8 months ago) by charles
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +10 -1 lines
now make image effects support alpha channels

#include <faith/mainwindow.h>
#include <faith/application.h>
#include <faith/painter.h>
#include <faith/pixmapeffect.h>
#include <plastif.h>

class Alpha : public Faith::Widget
{

public:
	Alpha()
		: Widget(0)
	{
		setPaletteBackgroundColor(Faith::Color(64, 64, 64, 64));
		setCaption("Composite");
	}
	
	void paintEvent(Faith::PaintEvent *)
	{
		Faith::Pixmap pm(size());
		Faith::PixmapEffect::gradient(
				pm,
				Faith::Color(255, 255, 255),
				Faith::Color(0, 64, 64, 64),
				Faith::PixmapEffect::EllipticGradient
			);
		
		Faith::Painter p(this);
		p.drawPixmap(pm);
		p.drawText(0, 30, "Hello Transparent World!");
	}

};


int main(int argc, char **argv)
{
	Faith::Application app(argc, argv);
	app.setStyle(new Plastif);

	Alpha a;
	a.show();

	return app.exec();
}


Faith