我们可以在j2me中的Canvas上垂直绘制文本吗
我正在为诺基亚 N97 开发 j2me 项目。我想垂直编写测试,即垂直旋转我的文本。我正在使用 Graphics.DrawString();方法在画布上绘制文本。
任何人都可以帮助我如何在画布上绘制和旋转文本。
提前致谢
I am working on j2me project for nokia N97.I want to write the test vertically i.e rotate my text vertically.I am using Graphics.DrawString(); method to draw text on canvas.
Can any one help me how to draw and rotate text on canvas.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建所需文本大小的可变
Image
(使用Font.stringWidth()
和Font.getHeight()
作为尺寸),将文本绘制到Image
的Graphics
对象上,使用图像实例化Sprite
,使用旋转它Sprite.setTransform(Sprite.TRANS_ROT90)
,最后使用Sprite.paint()
进行绘制。有关所有这些的更多信息,请参见 MIDP2规格。
华泰
You can create a mutable
Image
of the size of the text you require (useFont.stringWidth()
andFont.getHeight()
for the dimensions), draw the text on to theImage
'sGraphics
object, use the image to instantiate aSprite
, rotate it usingSprite.setTransform(Sprite.TRANS_ROT90)
, and finally draw it usingSprite.paint()
.More info on all of these in the MIDP2 spec.
HTH