main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
// Clear object to white
g.clear color Color.white
Contains drawing operations.
Clears the canvas object with a color.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
// Clear object to white
g.clear color Color.white
Draws a bitmap. The optional alpha value specifies the opaqueness of the drawn bitmap.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
Bitmap bmp = new Bitmap from file "example.png"
// Draw bitmap to upper left corner
g.draw bitmap bmp to 0,0
Fills a rectangle with bitmap. The bitmap is tiled if it does not cover the whole targetRect area.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
Bitmap bmp = new Bitmap from file "example.png"
// Draw bitmap to rectangle starting at upper left corner with size 100x100.
g.draw bitmap bmp to 0, 0 size 100, 100
Draws a part of bitmap. The sourceRect specifies the area to draw. This area will be clipped to the bmp's boundaries.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
Bitmap bmp = new Bitmap from file "example.png"
// Draw 50x50 area of bitmap to upper left corner.
g.draw bitmap bmp to 0, 0 source 0, 0 size 50, 50
Draws a string.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
// Draw string "Test data" with default font to upper left corner
g.draw string "Test data" to 0,0
Draws a string.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
Font f = system.load bitmap font from file "bitmapFont.png"
// Draw string "Test" to upper left corner with blue color and loaded font.
g.draw string "Test data" range 0 size 4 to 0,0 color Color.blue font f
Draws a filled rectangle.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
// Draw green rectangle of size 50x50 to position 100,100
g.draw rectangle 100,100 size 50,50 color Color.green
Draws a line from fromPos to toPos.
main
system.run application new MyApplication
class MyApplication extends Application
draw to <canvas g>
Size screenSize = screen.get size
// Draw orange line from top left corner to bottom right corner.
g.draw line from 0,0 to screenSize.get width, screenSize.get height color Color.Orange