2010-06-04 31 views
1

我很難找到如何在畫布上繪製/打印字符串,旋轉90度,而不是垂直字母。在一些不同的方法沒有成功之後,我試圖去關注一個將Graphics對象打印到Image對象的方法。隨着API的減少,這是一項艱鉅的任務。 所以基本上我問你們是如果你知道如何繪製一個字符串旋轉90º在畫布或如果你不這樣做,我怎麼能保存圖形對象到一個圖像,所以我可以按照我的「提示」 。 非常感謝!在畫布中畫字符串

吉列爾梅

+0

我假設這是基於Java的? – 2010-06-04 16:42:19

+0

對不起,是的! – GuilhermeA 2010-06-04 16:43:13

回答

3

最後,在網頁最後一個研究,那就是:

//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); 

來自:http://wiki.forum.nokia.com/index.php/How_to_display_rotated_text_in_Java_ME

謝謝!