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.