The CANVAS element lets you draw your own shapes using the Kt::Graphics scripting API.
See the Widgets element.
Name | Value Type | Default Value | Description | Comment | V. | Exp. |
---|---|---|---|---|---|---|
render_script |
script |
empty |
inline script that draws onto the current Graphics context. |
You can access the current graphics context object in the script using the Kt::Graphics::GetCurrentContext() function. |
2.6 |
No |
requires |
list of ';' separated identifiers or wildcards |
Empty. |
List of objects expected by the script. |
Forces the KUIML engine to expose the listed objects to the scripting engine. for example: 'my_object.*;my_string' |
2.0 |
No |
script_handles_opacity |
false |
if true, the render script should handle the opacity of the widget. |
2.6 |
No |
Skin file:
<?xml version="1.0" encoding="utf-8" ?> <SKIN author="Blue Cat Audio" name="2D Canvas Script" background_color="#000000" margin="2"> <!-- Includes --> <SCRIPT src="demoCanvas.cxx"/> <!-- The Canvas --> <CANVAS id="shapes" requires="shapes.width;shapes.height" render_script="renderShapes(this.width,this.height)" width="300" height="300" opacity=".8"/> </SKIN>
Render script file (demoCanvas.cxx):