[solved] How to work with masks in QPainter?
I'm using Qt.5.3 and want to work with masks on a QImage to fill a region with a specific color.
My mask is a 1Bit QImage (Mono).
i thought, that i can handle this like:
QPixmap pixmap = QPixmap::fromImage(maskForegroundByUser);
but i can't create a QRegion from a QPixmap.
Can someone help me?
This solution works and has good performance:
QBitmap bitmap = QBitmap::fromImage(mask); //mask is a QImage with the format Mono
I haven't played with mask yet, but from the doc you can make a QBitmap from your maskForegroundByUser to use with setClipRegion
Hope it helps
I thought about it, too. Now I see, that the QBitmap have a finction called "fromImage()".
Since your mask is working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)