2010-06-04 30 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

谢谢!