how to resize 2D sprite

Started by
4 comments, last by Emil_Halim 19 years ago
Hi all does any one know how to resize 2D Sprite
Advertisement
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.
i meant 2d world , no 3d World.

a few days ago i learned how to rotate 2D , Now i want Resizing.

thanks
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.
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.
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

This topic is closed to new replies.

Advertisement