Image Rotation in midp1.0

Started by
5 comments, last by Sneftel 19 years, 5 months ago
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
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.
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
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);
}
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);
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. :(
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]

This topic is closed to new replies.

Advertisement