Sign in to follow this  
Emil_Halim

how to resize 2D sprite

Recommended Posts

Zipster    2365
There are many ways to resize a sprite. But it depends how your sprite is stored, whether you're working in D3D or OpenGL, or even writing your own software rasterizer, etc.

Share this post


Link to post
Share on other sites
doynax    850
Quote:
Original post by Emil_Halim
a few days ago i learned how to rotate 2D , Now i want Resizing.
Your rotation function can do scaling too. Just multiply the cos/sin rotation vector by a scaling constant.
It's not as efficient as a decicated a sprite scaler but at least you won't have to write much code.

Share this post


Link to post
Share on other sites
Emil_Halim    122
Hi doynax

thanks for your help. i will try it and let you know the result.

actually i am using rotate & resize for a percalculated some sprite, so it is
not for real time animation.

Share this post


Link to post
Share on other sites
Emil_Halim    122
it works very well but you need to change the next line

outerDeltaV = -innerDeltaU;

to

outerDeltaV = innerDeltaU;

and

innerDeltaU = cos(3.14*2) * ScaleFactor;
innerDeltaV = sin(3.14*2) * ScaleFactor;

question :

how can i make 2 scale factors, one (ScaleX) for width and outher (ScaleY) for height.



thanks for help

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this