×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    15

    How can let picture rotate in screen??

    how can i let picture rotate in my degree??
    is it fullcanvas only can rotate in 90,180,270 ??

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    You need to use the com.nokia.mid.ui.DirectGraphics class to do that as it is not supported in MIDP 1.0:
    Code:
    import com.nokia.mid.ui.DirectGraphics;
    import com.nokia.mid.ui.DirectUtils;
    import javax.microedition.lcdui.Image;
    
    // ....
    
    // load the original image
    Image originalImage = Image.createImage("/res/somepicture.png");
    // create a mutable image to hold the rotated image
    Image rotatedImage = Image.createImage(originalImage.getWidth(),originalImage.getHeight());
    // get the reference to the new image's DirectGraphics object
    DirectGraphics dg = DirectUtils.getDirectGraphics(rotatedImage.getGraphics());
    // draw the original image using dg's image manipulation (the last parameter)
    dg.drawImage(originalImage,0,0,Graphics.TOP|Graphics.LEFT,DirectGraphics.ROTATE_90);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •