[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] pygame.transform.rotozoom



On Wed, Jan 23, 2002 at 10:30:34AM +0100, wijgerden@hetnet.nl wrote:
> I know it is documented as destructive, but something is going wrong:
> 
> when img is a 16x16 image, then
>   imgT = pygame.transform.rotozoom(img, -90, 1)
> gives me a 18x18 imgT
> 
> Now I think that shouldn't happen.

Think again. Still think it shouldn't happen? Ok.. now get yourself a
simple sheet of paper. Draw a rectangle on it. Now rotate that rectangle
by 45 degrees and draw the result above the original rectangle. Do you
see how the corners are outside of your original rectangle? Now add 1+1
and remember that blitting only supports rectangular areas. So you need
to find a rectangle around your rotated rectangle. That final rect must
be bigger than the original one (as the corners are outside of the
original one)

A small ascii try to explain this:

+-+
| |
+-+

results in (yeah I know I'm bad at rotating ascii art :)

 /\
<  >
 \/

And now to get a pygame surface we need to find a rect around that:

,__,
|/\|
<  >
|\/|
`--´

Now this rect obviously has to be larger as the original.

hth,
-- 
Raiser, Frank aka CrashChaos
IRC: irc.openprojects.net #pygame

"Any sufficiently advanced technology is indistinguishable from magic."
    -- Arthur C. Clarke
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org