• Advertisement
Sign in to follow this  

Image Rotation in midp1.0

This topic is 4818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can I rotate the png image in midp1.0 (without using device specific api's) Is there any solution for it? Please please reply... Thanks in advance Jyothi Gopu

Share this post


Link to post
Share on other sites
Advertisement
It is possible but it will be very slow, and definitely not recommended for realtime.

There are no MIDP 1.0 apis that provide rotation so you will have to do a lot of work in code.

There are no MIDP 1.0 apis that provide direct access to pixels in source and destination images, but precise pixel copying from source to destination images is possible with setClip, drawImage, getTranslateX, etc.

If you are rotating at angles other than 90, 180, 270, you will also need to use sin, cosine, etc, in your rotation maths. MIDP 1.0 doesn't provide this either, but this is possible if you use lookup tables and/or a fixed point math class.

Share this post


Link to post
Share on other sites
hi abstractworlds,

Thanks for the reply.
Can you please explain me with some sample code.
I know how to use fixed point math(MathFP)..

Thanks
Jyothi

Share this post


Link to post
Share on other sites
To copy pixel at 3,4 from source image to pixel 6,7 in destination image, the code is something like:

public void pixelcopy(Image src, Image dst)
{
Graphics g = dst.getGraphics();
g.setClip(6, 7, 1, 1);
g.drawImage(src, -3, -4, Graphics.LEFT | Graphics.TOP);
}

Share this post


Link to post
Share on other sites
Quote:
public void pixelcopy(Image src, Image dst)
{
Graphics g = dst.getGraphics();
g.setClip(6, 7, 1, 1);
g.drawImage(src, -3, -4, Graphics.LEFT | Graphics.TOP);
}

Close. I think that last line should be:

g.drawImage(src, 6-3, 7-4, Graphics.LEFT | Graphics.TOP);

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel - Moderator - Consoles, PDAs, and Cell Phones


I gotta feel sorry for ya Sneftel... it's like your forum is invisible or something. :(

Share this post


Link to post
Share on other sites
Quote:
Original post by Zahlman
I gotta feel sorry for ya Sneftel... it's like your forum is invisible or something. :(
Shh... don't call attention to us. We're gathering strength to rise up suddenly and overpower the GP&T forum. [grin]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement