如何在智能移动工作室中创建屏幕外图像?

时间:2012-05-17 06:12:50

标签: javascript smart-mobile-studio

使用图形时,如何在智能移动工作室中创建屏幕外图像?我想画画来创建图像,画到画布上 - 然后将这些图形复制到游戏项目的显示器上。

1 个答案:

答案 0 :(得分:3)

http://op4js.optimalesystemer.no/2012/01/10/how-do-i-move-graphics-from-the-canvas-to-an-image/

简而言之:

var image  := TW3Image.Create(self);
//create temp graphic and canvas to draw on
var graph  := TW3GraphicContext.Create(NIL);
graph.Allocate(image.Width, image.Height);
var canvas := TW3Canvas.Create(graph);
// Draw some text on the canvas
canvas.font:='10pt verdana';
canvas.FillStyle:='rgb(255,255,255)';
canvas.FillTextF('This was generated on a canvas!',10,20,MAXINT);
//You can load it in as a picture
image.LoadFromUrl(canvas.toDataUrl(''));