Sign in to follow this  
jyothigopu

Image Rotation in midp1.0

Recommended Posts

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

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