how to clean data in qimage with transparent?
I want to draw a real time scan radar image on widget with background terrian data, so I want to clean previous data to no color with transparent to show background correctly , I try to use codes as following
Code:
painter->setPen(qclr);
painter->setBrush(qclr);
painter->drawConvexPolygon(pg);
but it does not works, previous data are not cleared. if I replace color with Qt::gray ,it works but I can not see the background .
I have read the post http://www.qtcentre.org/threads/3310...nsparent-color , it seem that there was no solution at that time ,how about now ?
thanks
Re: how to clean data in qimage with transparent?
Hi, probably the data is not "cleared" because you paint above it with a transparent brush, so you can see through the newly painted pixels and see the old data.
Have you tried wysota's solution from the other thread (set QPainter::QPainter::CompositionMode_Clear)?
Ginsengelf
Re: how to clean data in qimage with transparent?
What is the painter object working on? Is it a pixmap, a widget or what?
Re: how to clean data in qimage with transparent?
Re: how to clean data in qimage with transparent?
Why don't you just create an empty QImage and draw on that instead of clearing the one you have?
Re: how to clean data in qimage with transparent?
In my case, I have to update the image every serveral milliseconds, only part of the image should be erased and repainted. so I think create a new QImage is infeasible.
Re: how to clean data in qimage with transparent?
In that case you should indeed use Clear composition mode.
Re: how to clean data in qimage with transparent?
Finally QPainter::CompositionMode_Source works ,thanks.