Rotación QImage sin perder información

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

preguntado el 28 de agosto de 12 a las 13:08

2 Respuestas

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.

Respondido 28 ago 12, 13:08

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

Respondido 28 ago 12, 13:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.