I've a QLabel which I use to display a reference QImage. Now, I'd like to paint over the reference image, and save only the overlay strokes as a separate QImage (thus no pixels from the reference image have to be accounted).
Any suggestion? Thanks
Printable View
I've a QLabel which I use to display a reference QImage. Now, I'd like to paint over the reference image, and save only the overlay strokes as a separate QImage (thus no pixels from the reference image have to be accounted).
Any suggestion? Thanks
one brute-force & not very good way is to save a copy of the original pixmap, then let user draw whatever they want on the other copy. When you want to save, compare each pixel to the backup. If the pixel value is different, save it, otherwise save a transparent/empty pixel.
A better way would be to have enough control of the strokes and user operations that you can just copy the painter path and write them to an empty pixmap at the same time as painting them on the image.
You don't need to compare.Quote:
hen you want to save, compare each pixel to the backup.
Just have two pixmaps.
Draw the original in to the first pixmap and show it.
When the user draws, draw it in to the other pixmap *and* on to the original (and don't show the second pixmap), this way you can show the composite result, while having both versions separate.
yeah, I already said that in my other paragraph.
Not quite:
This is not necessary.Quote:
When you want to save, compare each pixel to the backup.
like I said, I already said that in my other paragraph.
The second paragraph is clearly separate from the first paragraph that you keep quoting because it is a separate paragraph. I hope it is clear now. :p I haven't even mentioned that I started that paragraph with 'A better way' to indicate that I am talking about an alternative method. A method where I make no reference to comparisons at all.
... dangit!
From your second paragraph one can understand (as I did) that you imply that operations should be taken to save a painter path (as in, explicitly deal with the painter path), specially when one reads your fist paragraph where you suggest comparing pixels.
My point was that this all is not needed.
If you didn't mean it, well, that's the way (at least) I understood it.
And cool down man.
I think it is rather a case of not reading what I have written. anyway...