views:

46

answers:

1

Hey there!

I'm having an hard time finding how to draw/print a String in a canvas, rotated 90º, NOT vertical letters. After some different approaches without success I was trying to follow one that would involve printing the Graphics object to an Image object. As the API is reduced it has been a difficult task. So basically what I'm asking you guys is if you know how to draw a String rotated 90º in a Canvas or if you don't, how can I save the graphics object to an Image one so I can follow my "hint". Thank you very much!

Guilherme

+2  A: 

Finally, one last research in the web and here it is:

    //The text that will be displayed
    String s="java";
    //Create the blank image, specifying its size
    Image img=Image.createImage(50,50);
    //Create an instance of the image's Graphics class and draw the string to it
    Graphics gr=img.getGraphics();
    gr.drawString(s, 0, 0, Graphics.TOP|Graphics.LEFT);
    //Display the image, specifying the rotation value. For example, 90 degrees
    g.drawRegion(img, 0, 0, 50, 50, Sprite.TRANS_ROT90, 0, 0, Graphics.TOP|Graphics.LEFT);

from: http://wiki.forum.nokia.com/index.php/How_to_display_rotated_text_in_Java_ME

Thank you!

GuilhermeA