markg85
3rd August 2010, 19:27
Hi,
I use this effect together with QLinearGradient to create a alphaGradient mask, however this is extremely slow even with hardware acceleration turned on. When you search for it http://labs.trolltech.com/blogs/2009/12/16/qt-graphics-and-performance-an-overview/ it turns out to be a known issue:
There is also the QGraphicsOpacityEffect which allows you to set a mask widgets and graphics items, but as of today, it is not as fast as we would like it to be.
and this is roughly how i use it:
QLinearGradient alphaGradient(cust->rect().topLeft(), cust->rect().bottomLeft());
alphaGradient.setColorAt(0.12, Qt::transparent);
alphaGradient.setColorAt(0.20, Qt::black);
alphaGradient.setColorAt(0.8, Qt::black);
alphaGradient.setColorAt(0.9, Qt::transparent);
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
effect->setOpacityMask(alphaGradient);
effect->setOpacity(1.0);
So anyway, is there a way to make this extremely fast (with hardware acceleration turned on)? If so, how?
All is has to do is set the alpha channel of an widget (QGraphicsWidget in this case)
The one hardware accelerated way i know but can't do (don't have the knowledge to do it) is by making a shader for it.
Mark.
I use this effect together with QLinearGradient to create a alphaGradient mask, however this is extremely slow even with hardware acceleration turned on. When you search for it http://labs.trolltech.com/blogs/2009/12/16/qt-graphics-and-performance-an-overview/ it turns out to be a known issue:
There is also the QGraphicsOpacityEffect which allows you to set a mask widgets and graphics items, but as of today, it is not as fast as we would like it to be.
and this is roughly how i use it:
QLinearGradient alphaGradient(cust->rect().topLeft(), cust->rect().bottomLeft());
alphaGradient.setColorAt(0.12, Qt::transparent);
alphaGradient.setColorAt(0.20, Qt::black);
alphaGradient.setColorAt(0.8, Qt::black);
alphaGradient.setColorAt(0.9, Qt::transparent);
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
effect->setOpacityMask(alphaGradient);
effect->setOpacity(1.0);
So anyway, is there a way to make this extremely fast (with hardware acceleration turned on)? If so, how?
All is has to do is set the alpha channel of an widget (QGraphicsWidget in this case)
The one hardware accelerated way i know but can't do (don't have the knowledge to do it) is by making a shader for it.
Mark.