Rotación QImage sin perder información
Frecuentes
Visto 2,224 veces
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 Respuestas
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.
Respondido 28 ago 12, 13:08
0
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 qt qimage or haz tu propia pregunta.