Drawing commands

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 +
{{Template:Quicklinks}}
 +
 +
[[Technical Reference | Technical Reference]] -> [[Technical Reference/terms | Terms]] -> [[Status | Status Page]] -> [[OSSL_Implemented| OSSL Implemented Functions]] -> [[Dynamic textures]] -> [[Drawing commands]]
 +
 
==Graphics Primitive Drawing Commands==
 
==Graphics Primitive Drawing Commands==
  

Revision as of 16:50, 2 September 2009

Technical Reference -> Terms -> Status Page -> OSSL Implemented Functions -> Dynamic textures -> Drawing commands

Contents

Graphics Primitive Drawing Commands

Ellipse

Ellipse float width, float height;
Draws an ellipse with the current pen size and color.
The ellipse is drawn with the specified width and height (in pixels), centered on a point which is (width/2) pixels to the right of the pen's current X position, and (height/2) pixels below the pen's current Y position. After the ellipse is drawn, the width and height values are added to the pen's X and Y position, respectively.
Although the parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "Ellipse 100,100;";


Polygon

Polygon string xpoints, string ypoints;
Draws an unfilled polygon, using current pen size and color.
The polygon is drawn following a sequence of x and y points given to the method (in the order that they are given), finally closing in the first one. Although the parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "Polygon 50,50,100,100,50,150,50;"; // This creates a triangle using points (50,50)(100,100)(150,50)


FillPolygon

FillPolygon string xpoints, string ypoints;
Draws a filled polygon, using current pen size and color.
The polygon is drawn following a sequence of x and y points (in pixels) given to the method (in the order that they are given), finally closing in the first. Although the parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "FillPolygon 50,50,100,100,50,150,50;"; // This creates a triangle using points (50,50)(100,100)(150,50)


Rectangle

Rectangle float width, float height;
Draws an unfilled rectangle, using the current pen size and color.
The rectangle is drawn at the specified width and height (in pixels), with the upper left corner of the rectangle placed at the pen's current position. After the rectangle is drawn, the width and height values are added to the pen's X and Y position, respectively.
Although the parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "Rectangle 150,75;";


FillRectangle

FillRectangle float width, float height;
Draws a rectangle, bordered and filled with the current pen size and color.
The rectangle is drawn at the specified width and height (in pixels), with the upper left corner of the rectangle placed at the pen's current position. After the rectangle is drawn, the width and height values are added to the pen's X and Y position, respectively.
Although the parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "FillRectangle 150,75;";


Image

Image float height, float width, string URL;
Retrieves an image specified by the URL parameter and draws it at the specified height and width, with the upper left corner of the image placed at the pen's current position. After the image is drawn, the width and height values are added to the pen's X and Y position, respectively.
If the URL points to an invalid location, an image type not supported by libgdi, or a non-image MIME type, nothing is drawn. If either or both of the width or height parameters are zero or negative, nothing is drawn, but the image is still retrieved.
Although the width and height parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "Image 293,62,<nowiki>http://opensimulator.org/skins/osmonobook/images/headerLogo.png</nowiki>;";


LineTo

LineTo float x, float y;
Draws a line from the pen's current location to the specified coordinates, using the pen's current color and width.
After the line is drawn, the specified coordinates become the pen's new current location.
Although the parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "LineTo 640,480;";


MoveTo

MoveTo float x, float y;
Updates the pen's current position to the coordinates provided in the parameters. Nothing is drawn.
Although the parameters accept floating-point values, anything after a decimal point will be ignored.

Example:

CommandList += "MoveTo 570,23;";


PenColour

PenColour string NewColor;
Sets the pen's drawing color to either the specified named .NET color or to a 32-bit color value (formatted as eight hexadecimal digits in the format aarrggbb, representing the eight-bit alpha, red, green and blue channels).
For full opacity, use an alpha value of ff (e.g. ffff0000 for red); for varying degrees of transparency, reduce the alpha value (e.g. 800000ff for half-transparent blue).
The color names and hexadecimal color representations are not case-sensitive.

Example:

CommandList += "PenColour MidnightBlue;";
CommandList += "PenColour ff191970;";


PenSize

PenSize float width;
Sets the pen size to a square of width pixels by width pixels. If width is an odd number, the pen will be exactly centered on the coordinates provided in the various drawing commands; if it is an even number, it will be centered slightly higher and to the left of the actual coordinates.
Although the parameter accepts a floating-point value, anything following a decimal point will be ignored.

Example:

CommandList += "PenSize 5;";


PenCap

PenCap string direction, string type;
ATTENTION: THIS METHOD WORKS ONLY ON .NET, MONO DOES NOT HAVE CAPS CORRECTLY IMPLEMENTED ON LIBGDI+
Sets the pens cap start, end or both to a cap style.
Possible values for direction are (case-insensitive): "start", "end", "both"
Possible values for type are (case-insensitive): "arrow","diamond","round","flat"(default)

Example:

CommandList += "PenCap start,arrow;"; //Draws an arrow at the end of the next line drawn (with LineTo)
Personal tools
General
About This Wiki