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

Re: Re: [pygame] keep-aspect scale



Err... I must be stupid, but I don't really follow you...

A simple, working code example someone?

destRect = Rect( (0,0), (x,y) )
imageRect = image.get_rect()
...what do I put here?...
image = pygame.transform.scale( image, (new_x,new_y) )

// Wigren

> So
> you have destRect=(w,h)
> origImage=(wo,ho)
> 
> lets take
> 
> alphaw=w/w0
> alphah=h/h0
> alpha_worst=min(alphaw,alphah)
> 
> and scale the original picture par factor alphaworst
> 
> and center it
> 
> Guillaume
> 
> 
> 
> 
> On Tue, 17 Jul 2001, Per Wigren wrote:
> 
> > Hi!
> >
> > A simple question:
> > I have a Rect (inside of a frame) that can be of any 
size
> > and I have another Rect (image) that also can be of any
> > size. I want to scale the image to be as big as possible
> > inside the frame while keeping aspectratio so it doesn't
> > get too wide or too tall.
> >
> > Any tips?
> >
> > Regards
> > Per Wigren
> >


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org