Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

http://www.youtube.com/watch?v=lNJFxvR6ex8&feature=youtu.be

On rotate and rotozoom, can't find fixes on these on the internet, anywhere. Basically, the video is showing 4 things in this order: 1. A ring image being rotated with .rotate. 2. A simple image being rotated with .rotate. 3. The ring rotated with .rotozoom. 4. The simple circle rotated with .rotozoom.

The difference: In 1 and 2, the images do not have that slight quiver/movement, but are reduced in quality. It might be difficult to tell with the video quality, but the ring image is slightly pixelated/blurred. In 3 and 4, the images are of equal/better than 1&2 quality when rotated with rotozoom, but they have this VERY SLIGHT but noticeable wobble about them. This is VERY noticable with test 3, where I put my mouse next to the circle outline, and you can see it move.

ANY and all help will be greatly appreciated, AND this will help many people for a long time, i'm sure.

Here are images of the differences in picture quality of rotate vs rotozoom:

http://s189.beta.photobucket.com/user/ECSit/library/PyGame%20and%20Python

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

Rotations of anything other than 90 degree increments requires resampling which cannot be done both quickly and accurately in software, and always loses detail anyway. The same applies for scaling/zooming for anything other than integer increments.

The slight 'wobble' you sometimes see is presumably related to the fact that the image size and height must change during rotation and therefore the centre of the image falls between 2 pixels half of the time, and must be rounded to one or the other to be rendered.

Ideally, if you want real-time rotation and scaling with sub-pixel precision, you need to be using a system backed by OpenGL or DirectX. In Python, that usually means pyglet, but you can roll your own using pyopengl. This cannot completely prevent some degree of blurring or pixellation, because information is necessarily thrown away when you resample an image, but it will usually be better than if done in software and certainly faster.

share|improve this answer
    
Thanks for the help! –  Eliot Leo Carney-Seim Feb 7 '13 at 3:33
add comment

I don't know anything about pygame, but this looks like an alpha blending aliasing issue. You can read about the topic here, for example: http://blogs.msdn.com/b/shawnhar/archive/2011/05/06/antialiasing-alpha-cutouts.aspx

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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