0

I have a QImage of size 12x12 in GIF format. I want to rotate it on certain angle with very high frequency. My application involves a robot so when it changes its orientation(which it does very frequently) my QImage in simulation should also be rotated but it causes loss of information. I am doing it something like below.

 robot_transform.rotate(angle);
*robot2 = robot->transformed(robot_transform,Qt::SmoothTransformation);
*robot2=  robot2->scaled(12,12, Qt::KeepAspectRatio,Qt::SmoothTransformation);

I need suggestions that whats wrong in this approach and secondly is there any other optimal approach for the desired application? Thanks

2 Answers 2

1

I would increase the resolution of the source image to at least double. Rotating an image to non-90-degree angles will cause loss of pixel information. An higher res source can compensate for that.

Most sprite based animations use pre-rendered images for each possible angle.

0
0

The problem is the scaling afterwards, you need to crop the center of the image. You can do this with QImage::copy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.