Javascript 如何在smart mobile studio中创建屏幕外图像?

Javascript 如何在smart mobile studio中创建屏幕外图像?,javascript,smart-mobile-studio,Javascript,Smart Mobile Studio,使用图形时,如何在smart mobile studio中创建屏幕外图像?我想通过绘画来创建图像,在画布上绘画,然后将图形复制到游戏项目的显示器上。 简言之: var image := TW3Image.Create(self); //create temp graphic and canvas to draw on var graph := TW3GraphicContext.Create(NIL); graph.Allocate(image.Width, image.Height); v

使用图形时,如何在smart mobile studio中创建屏幕外图像?我想通过绘画来创建图像,在画布上绘画,然后将图形复制到游戏项目的显示器上。

简言之:

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(''));