[QImage/QSettings] rotate and restore a rotated image from stored data.
-
Good afternoon
I have a "photo management" program, which looks a lot like a slideshow with an ever growing number of additional functions.
Since yesterday, I add the possibility to store current display options for individual pictures in the configuration: When the same bunch of images is loaded another day, the scaliing, rotation and displacement of an image on the canvas are restored, if the user has activated the option, and if the image is identified as one for which such parameters exist (by a hash on the file name and file size).
Scaling works alright and even rotation works in a way, but not as I like.
I cannot find a way to determine the exact rotation angle from the configuration, if several such operations are performed that might add to – or revert the previous.
Example: I rotate a picture by 90 degrees in any direction, then by 90 degrees in the opposite direction.
Then I have the bad idea to store the situation. The next time the image is loaded, the most recent angle is applied again, although it was meant to restore the original alignment...I am blocked.
It is possible that I just need to get away from the computer for a while and will have an epiphany... but if you have some truncheon to drive in the obvious, PSE do not hesitate.Thank youhou.
-
Store the complete QTransform of your combined rotations / scalings.
-
Store the complete QTransform of your combined rotations / scalings.
Moin.
@Christian-Ehrlicher said in [QImage/QSettings] rotate and restore a rotated image from stored data.:
Store the complete QTransform of your combined rotations / scalings.
@Christian-Ehrlicher: I see. As regards the scaling, I have no memory to even yet touch at QTransform.
Maybe I can store a vector of qreal angles to keep track of successive rotations. What annoys me with both solutions is that I would have to keep track of transformations for each and every picture, and irrespective of the fact that I store the current parameters or not.., just in case that the user wants to store them. I have never had use for an undo function but this begins to look like one.
I see two options: I comply with obvious logic or reconsider the pertinence of my idea.
Thank you so far.
-
-
I come back one last time to state that I have just been very distracted or stupid.
Subsequently applying different rotation angles means adding to - or subtracting from the most recent accumulated value. END-OF-STORY. (Beats me).I do not need to store full-blown QTransform objects but can stick with my dearly loved int-values.