OSSL TextureDrawing

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 45: Line 45:
 
  }
 
  }
 
</source>
 
</source>
 +
 +
==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 an 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
 +
:*timer set an update interval
 +
 +
===Commands===
 +
;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;
 +
:Drawing color of the pen
 +
 +
===Extra Parameters===
 +
;height
 +
:the height for the image in pixels
 +
 +
;width
 +
:the width of the image in pixels
 +
 +
;alpha
 +
:the opacity of the image
 +
:''0-255'' for an image with an alpha channel
 +
:''false;; for an image with no alpha channel
 +
 +
;bgcolour
 +
:the background color of the image
 +
 +
[[http://msdn.microsoft.com/en-us/library/aa358802.aspx .net colors]]

Revision as of 03:50, 10 March 2009

string osMovePen(string drawList, int x, int y);
 string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
 string osDrawLine(string drawList, int endX, int endY);
 string osDrawText(string drawList, string text);
 string osDrawEllipse(string drawList, int width, int height);
 string osDrawRectangle(string drawList, int width, int height);
 string osDrawFilledRectangle(string drawList, int width, int height);
 string osSetFontSize(string drawList, int fontSize);
 string osSetPenSize(string drawList, int penSize);
 string osSetPenColour(string drawList, string colour);
 string osDrawImage(string drawList, int width, int height, string imageUrl);

Code

//cs
 public void default_event_state_entry()
 {
    string drawList = "";
 
    drawList = osDrawLine (drawList, 10,20,240,20);
    drawList = osMovePen (drawList, 50,100); 
    drawList = osDrawImage(drawList, 100,100,"http://opensimulator.org/images/d/de/Opensim_Wright_Plaza.jpg" );
    drawList = osSetPenSize (drawList, 1); 
    drawList = osMovePen (drawList, 50,70);
    drawList = osDrawEllipse (drawList, 20,20);
    drawList = osMovePen(drawList, 90,70); 
    drawList = osDrawRectangle (drawList, 20,20 );
    drawList = osMovePen (drawList,130,70); 
    drawList = osDrawFilledRectangle(drawList, 20,20);
    drawList = osSetFontSize (drawList, 12 );
    drawList = osMovePen (drawList,15,32); 
 
    string regionName = llGetRegionName();
    drawList = osDrawText (drawList, "Hello and welcome to " + regionName );
 
    drawList = osSetFontSize (drawList, 7); 
    drawList = osSetPenColour (drawList, "blue");
    drawList = osMovePen (drawList, 70,220);
    drawList = osDrawText (drawList, "The End");
    osSetDynamicTextureData("", "vector", drawList, "", 0);
 }

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 an 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
  • timer set an update interval

Commands

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;
Drawing color of the pen

Extra Parameters

height
the height for the image in pixels
width
the width of the image in pixels
alpha
the opacity of the image
0-255 for an image with an alpha channel
false;; for an image with no alpha channel
bgcolour
the background color of the image

[.net colors]

Personal tools
General
About This Wiki