Page 1 of 1

Reset all Image Attributes

Posted: 2017-07-24T01:41:39-07:00
by jeroenooms
Is there an easy way to reset all attributes on an Image object to their original (blank) state ?

A common problem that I experience in my application is that the behavior of some method is affected by some image attribute that was set by a previous operation.

For example we might draw some text. So we set image->fillColor() and image->fontPointsize() and then call with image-> annotate() with our text. However if some previous operation on the image might have set a fontWeight or boxColorImage, then these are also applied to our text which we did not intend.

So I guess what we need to get predictable behavior is to reset the attributes before staring our new operation?

image->reset()
image->fillColor()
image->fontPointsize()
image-> annotate()

Or perhaps I am doing this wrong and there is a way to specify which attributes a method should use?