OsDrawLine

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Page created.)
 
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:Quicklinks}}
+
{{osslfunc
[[Technical Reference | Technical Reference]] -> [[Technical Reference/terms | Terms]] -> [[Status | Status Page]] -> [[OSSL_Implemented| OSSL Implemented Functions]] -> [[Dynamic textures]] -> [[OsDrawLine | osDrawLine]]
+
|threat_level=None
 
+
|function_syntax=string osDrawLine(string drawList, integer startX, integer startY, integer endX, integer endY)<br />
 
+
string osDrawLine(string drawList, integer endX, integer endY)
LSL: '''[[string]] osDrawLine( [[string]] drawList, [[integer]] startX, [[integer]] startY, [[integer]] endX, [[integer]] endY )'''<br />
+
|ossl_example=<source lang="lsl">
:'''[[string]] osDrawLine( [[string]] drawList, [[integer]] endX, [[integer]] endY )'''
+
LSL: '''[[string]] osDrawLine( [[string]] drawList, [[int]] startX, [[int]] startY, [[int]] endX, [[int]] endY )'''<br />
+
:'''[[string]] osDrawLine( [[string]] drawList, [[int]] endX, [[int]] endY )'''
+
 
+
 
+
Depending on the form, appends a [[Drawing_commands#LineTo|LineTo]] drawing command, or [[Drawing_commands#MoveTo|MoveTo]] and [[Drawing_commands#LineTo|LineTo]] commands, to the string provided in '''drawList''' and returns the result.
+
 
+
In the longer form, draws a line using the current pen size and color from to the coordinates indicated by '''startX''' and '''startY''' to the coordinates indicated by '''endX''' and '''endY'''.
+
 
+
In the shorter form, draws a line using the current pen size and color from the pen's current position to the coordinates indicated by '''endX''' and '''endY'''.
+
 
+
After the line is drawn, the pen's X and Y coordinates are set to '''endX''' and '''endY''', respectively.
+
 
+
Example:
+
<source lang="lsl">
+
 
// Example of osDrawLine
 
// Example of osDrawLine
 
default
 
default
Line 26: Line 11:
 
         string CommandList = ""; // Storage for our drawing commands
 
         string CommandList = ""; // Storage for our drawing commands
  
         CommandList += osSetPenSize( CommandList, 3 );              // Set the pen width to 3 pixels
+
         CommandList = osSetPenSize( CommandList, 3 );              // Set the pen width to 3 pixels
         CommandList += osSetPenColour( CommandList, "Red" );        // Set the pen color to red
+
         CommandList = osSetPenColor( CommandList, "Red" );        // Set the pen color to red
         CommandList += osDrawLine( CommandList, 10, 10, 128, 246 ); // Draw the first line (long form)
+
         CommandList = osDrawLine( CommandList, 10, 10, 128, 246 ); // Draw the first line (long form)
         CommandList += osSetPenColour( CommandList, "Green" );      // Set the pen color to green
+
         CommandList = osSetPenColor( CommandList, "Green" );      // Set the pen color to green
         CommandList += osDrawLine( CommandList, 246, 10);          // Draw the second line (short form)
+
         CommandList = osDrawLine( CommandList, 246, 10);          // Draw the second line (short form)
  
 
         // Now draw the lines
 
         // Now draw the lines
Line 37: Line 22:
 
}
 
}
 
</source>
 
</source>
 +
|description=Depending on the form, appends a [[Drawing commands#LineTo|LineTo]] drawing command, or [[Drawing commands#MoveTo|MoveTo]] and [[Drawing commands#LineTo|LineTo]] commands, to the string provided in '''drawList''' and returns the result.
 +
 +
In the longer form, draws a line using the current pen size and color from to the coordinates indicated by '''startX''' and '''startY''' to the coordinates indicated by '''endX''' and '''endY'''.
 +
 +
In the shorter form, draws a line using the current pen size and color from the pen's current position to the coordinates indicated by '''endX''' and '''endY'''.
 +
 +
After the line is drawn, the pen's X and Y coordinates are set to '''endX''' and '''endY''', respectively.
 +
|
 +
}}

Latest revision as of 13:35, 14 November 2018

string osDrawLine(string drawList, integer startX, integer startY, integer endX, integer endY)

string osDrawLine(string drawList, integer endX, integer endY)

Depending on the form, appends a LineTo drawing command, or MoveTo and LineTo commands, to the string provided in drawList and returns the result.

In the longer form, draws a line using the current pen size and color from to the coordinates indicated by startX and startY to the coordinates indicated by endX and endY.

In the shorter form, draws a line using the current pen size and color from the pen's current position to the coordinates indicated by endX and endY.

After the line is drawn, the pen's X and Y coordinates are set to endX and endY, respectively.

Threat Level None
Permissions No permissions specified
Extra Delay No function delay specified
Example(s)
// Example of osDrawLine
default
{
    state_entry()
    {
        string CommandList = ""; // Storage for our drawing commands
 
        CommandList = osSetPenSize( CommandList, 3 );              // Set the pen width to 3 pixels
        CommandList = osSetPenColor( CommandList, "Red" );        // Set the pen color to red
        CommandList = osDrawLine( CommandList, 10, 10, 128, 246 ); // Draw the first line (long form)
        CommandList = osSetPenColor( CommandList, "Green" );      // Set the pen color to green
        CommandList = osDrawLine( CommandList, 246, 10);           // Draw the second line (short form)
 
        // Now draw the lines
        osSetDynamicTextureData( "", "vector", CommandList, "width:256,height:256", 0 );
    }
}
Personal tools
General
About This Wiki