OSSL TextureDrawing

General Capabilities
The OSSL Texture Drawing functions allow the scripter to dynamically generate a texture on the fly, from within the context of an script. (It can be written in LSL, C# or any other supported scripting language.)

The scripting language supports text and images, as well as three simple drawing primitives: line, rectangle and ellipse. Color and pen attributes are included. Font, size and style are supported for text. An image is specified as an URL.

A drawing script can be directly specified in the texture drawing language, or can be built by using helper functions in the scripting language. Examples of both approaches are shown below.

Several extra parameters are available for the texture rendering operation. These include the height and width of the texture, as well as the background color and alpha value. A statement terminator can also be specified.

LSL Helper Functions

C# Code Example

OS Dynamic Texture Language
Many of the OSSL drawing functions are convenience functions to help build the command line for the osSetDynamicTextureData data parameter. You may find it easier to build the string yourself using the drawing commands directly. Do this by declaring a string then appending sets of commands and parameters until it is ready. Each command is separated by a semi-colon ";". Additional parameters may be set for the image with the extraParams parameter.


 * osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer)


 * dynamicID: not used yet – send “”
 * contentType: use “vector” for drawing commands or use “image” for loadurl
 * data: the graphics commands in the string with the format of: “MoveTo 20, 20; FillRectangle 60, 60;”;
 * extraParams: width, height, alpha, bgcolour, altdatadelim
 * timer: set an update interval

Commands (data)

 * MoveTo int x, int y;
 * Places the brush at the x/y coordinate


 * LineTo int x,int y;
 * Draws line from present pen position to the x/y coordinate


 * Text string content;
 * Text to write to the image


 * Image float x, float y, string URL
 * The x/y placement coordinates and URL of an image to load


 * Rectangle float x, float y;
 * Draws a rectangle with the current pen from the current pen location to the x/y coordinates


 * FillRectangle float x, float y;
 * Draws a filled rectangle with the current brush from the current pen location to the x/y coordinates


 * Ellipse float x, float y;
 * Draws an ellipse with the current brush from the current brush location to the x/y coordinates


 * FontSize int size;
 * The size of the font for text


 * FontProp char;
 * [B|I|U|S|R]


 * B Bold
 * I Italic
 * U Underline
 * S Strikeout
 * R Regular


 * FontName string name;
 * The name of the font to use


 * PenSize float size;
 * Size of the drawing pen


 * PenColour string color; or PenColor string color;
 * Drawing color of the pen


 * PenCap string direction, string type;
 * Cap of a line, consists of 3 possible directions ("start","end","both") and 4 possible types ("flat","diamond","arrow","round")

Example

Extra Parameters (extraParams)

 * height
 * the height for the image in pixels


 * width
 * the width of the image in pixels


 * alpha
 * the opacity of the image
 * 0-255 to set the opacity for an image with an alpha channel
 * false for an image with no alpha channel


 * bgcolour
 * the background color of the image

Microsoft .net colors


 * altdatadelim
 * an alternative delimiter for each parameter - useful if you want to display text that contains semicolons, for example C# or LSL code.