03-06-2013 09:42 PM
HELP - problems with SCALE and POSITION when saving an image on top of another image
//this has rotation, and scale pinch event handlers and working well
object = ImageView::create("asset:///images/itsmorefunlogo.png"); QImageReader reader; reader.setFileName(appFolder + "app/native/assets/images/background.jpg"); QImage image = reader.read(); QPainter painter(&image); QString bomberFileName = appFolder + "app/native/assets/images/itsmorefunlogo.png"; reader.setFileName(bomberFileName); QImage bombimage = reader.read(); QTransform imageTransform; imageTransform.rotate(object->rotationZ()); imageTransform.scale(object->scaleX(), object->scaleY()); bombimage = bombimage.transformed(imageTransform); painter.drawImage(QPoint(object->translationX(), object->translationY()), bombimage); image.save(fileName, "JPG");
I am not getting the correct POSITION and SCALE, only the ROTATION is perfect.
In my app I can pinch to scale and rotate the object (ImageView) and I have a button to save it and after it saves, the scale is not the same and the position.
03-06-2013 10:08 PM
Posting some images may help to illustrate what the actual issue is.
A shot in the dark: Have you tried reversing the rotate and scale commands (so doing scale first)? The concept of transformation matrices can be tricky if on is not used to them.
Daniel
03-06-2013 10:25 PM
Initial
Output
03-06-2013 10:30 PM
03-06-2013 10:33 PM
Glad I could help.
(why not like the post if it solved the issue:-)
03-06-2013 10:53 PM
my issue is not yet solved. ![]()
03-06-2013 10:57 PM
reversing the scale and rotation still does not help ![]()
03-06-2013 11:00 PM
I can't see the images yet, just placeholders.
03-07-2013 08:24 AM
Sorry, what do you mean?