Skip to main content
gamedev.net
🔒 Locked

[java] rotate image

Started by mill-o Nov 27, 2001 at 4:40 PM 2 replies 300+ views
Original Post
mill-o
mill-o
i need an easy way of rotating an image without using Graphics2D (as in i wanna use it in an applet). i''d like to specify an image and then i want to rotate the image n degrees and store it in images[] to be used in a 2D game. how do i accomplish that? any ideas are appreciated. pseudo code or proper code, doesn''t matter. i just need a point in the right direction to get started.
Soulice
Soulice
Go to java site and pull down the AWT tutorial. has a great section on using a bitmap strip image to rotate around 8 different images for rotation.



-Soulice
-Soulice
Wrathnut
Wrathnut
Depending on the number of images you want to rotate and the size of the images, it will probably be faster for you to pre-render the images on your drawing program. Paintshop pro or whatever you use will rotate your image more correctly witout as much distortion than if you rotated each pixel and then made it back into an image. Like I said depending on the size and number of images it might not be a likely solution though. Good luck

War doesn''t determine who is right, war determines who is left.
mill-o
mill-o
Wrathnut>>> yeah, that was what i was planning on doing first, but then i decided i should write a general Sprite-class what does all basic things. since i''m lazy i wanted just to draw an image, tell the Sprite-class that i want to use that image and then the Sprite-class would generate all the images i need.
that''s good cause if i want to add a little detail to my image i don''t have to rotate them in psp again.

Soulice>>> i did what you suggested and i found a great example using ImageFilters so i''m gonna try that tonight. thanks alot.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.