How to flip an image in Java ME
This articles shows how to to flip a given Image in Java ME.
- Create a new Image using createImage
- Or use drawRegion to fllp the image when drawn.
- Apply Mirror transformation using Sprite.TRANS_MIRROR
On some devices, pre-transformed images may render more quickly than images that are transformed on the fly using drawRegion. However, creating such images does consume additional heap space, so this technique should be applied only to images whose rendering speed is critical.
Create a new flipped image with createImage. For immutable source images, transparency information, if any, is copied to the new image unchanged.
Or use drawRegion to fllp the image when drawn.
For MIDP 1.0 devices we can use com.nokia.mid.ui.DirectGraphics.drawImage(javax.microedition.lcdui.Image img, int x, int y, int anchor, int manipulation) with manipulation = DirectGraphics.FLIP_HORIZONTAL
--Submitted by Amitabh Srivastava at 16:55(IST), 5 July 2010.