OsSetPenColour
From OpenSimulator
(Difference between revisions)
m (Removed 'Template:' prefix from template includings and/or changed external-link into internal-link) |
|||
Line 2: | Line 2: | ||
{{deprecate|Dec. 10 2010|osSetPenColor}} | {{deprecate|Dec. 10 2010|osSetPenColor}} | ||
+ | {| width="100%" style="border: thin solid black" | ||
+ | | colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}''' | ||
+ | |- valign="top" | ||
+ | |'''Threat Level''' || <Threat Level goes here> | ||
− | + | |- valign="top" | |
− | + | |'''Function Syntax''' || <source lang="lsl"> | |
− | < | + | LSL: String osSetPenColour( String drawList, string color ) |
− | + | C#: String osSetPenColour( String drawList, string color ) | |
− | + | </source> | |
− | + | |- valign="top" | |
− | + | |'''Example(s)||<source lang="lsl"> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
// Example of osSetPenColour | // Example of osSetPenColour | ||
Line 78: | Line 78: | ||
</source> | </source> | ||
− | [[Category:OSSL]] | + | |} |
+ | |||
+ | Appends a [[Drawing commands#PenColour|PenColor]] drawing command to the string provided in '''drawList''' and returns the result. | ||
+ | |||
+ | This sets the pen's drawing color to either the specified [http://msdn.microsoft.com/en-us/library/aa358802.aspx 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. <tt>FFFF0000</tt> for red); for varying degrees of transparency, reduce the alpha value (e.g. <tt>800000FF</tt> for semi-transparent blue). | ||
+ | |||
+ | The color names and hexadecimal color representations are not case-sensitive. | ||
+ | |||
+ | [[Category:OSSL Functions]] | ||
[[Category:OSSL functions without threat level]] | [[Category:OSSL functions without threat level]] |
Revision as of 10:53, 11 June 2011
*** NOTE : *** As of Dec. 10 2010, this function has been renamed to osSetPenColor.
Versions of OpenSimulator released after this date will give the user a deprecation warning, but for the time being will function as before. However, the deprecated function may eventually be removed entirely, and should therefore be avoided, and the new version be used instead. |
OsSetPenColour | |
Threat Level | <Threat Level goes here> |
Function Syntax | LSL: String osSetPenColour( String drawList, string color ) C#: String osSetPenColour( String drawList, string color ) |
Example(s) | // Example of osSetPenColour string hexDigits = "0123456789abcdef"; list colorNames = [ "AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black", "BlanchedAlmond", "Blue", "BlueViolet", "Brown", "BurlyWood", "CadetBlue", "Chartreuse", "Chocolate", "Coral", "CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DarkBlue", "DarkCyan", "DarkGoldenrod", "DarkGrey", "DarkGreen", "DarkKhaki", "DarkMagenta", "DarkOliveGreen", "DarkOrange", "DarkOrchid", "DarkRed", "DarkSalmon", "DarkSeaGreen", "DarkSlateBlue", "DarkSlateGrey", "DarkTurquoise", "DarkViolet", "DeepPink", "DeepSkyBlue", "DimGrey", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro", "GhostWhite", "Gold", "Goldenrod", "Grey", "Green", "GreenYellow", "Honeydew", "HotPink", "IndianRed", "Indigo", "Ivory", "Khaki", "Lavender", "LavenderBlush", "LawnGreen", "LemonChiffon", "LightBlue", "LightCoral", "LightCyan", "LightGoldenrodYellow", "LightGreen", "LightGrey", "LightPink", "LightSalmon", "LightSeaGreen", "LightSkyBlue", "LightSlateGrey", "LightSteelBlue", "LightYellow", "Lime", "LimeGreen", "Linen", "Magenta", "Maroon", "MediumAquamarine", "MediumBlue", "MediumOrchid", "MediumPurple", "MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise", "MediumVioletRed", "MidnightBlue", "MintCream", "MistyRose", "Moccasin", "NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed", "Orchid", "PaleGoldenrod", "PaleGreen", "PaleTurquoise", "PaleVioletRed", "PapayaWhip", "PeachPuff", "Peru", "Pink", "Plum", "PowderBlue", "Purple", "Red", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown", "SeaGreen", "Seashell", "Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGrey", "Snow", "SpringGreen", "SteelBlue", "Tan", "Teal", "Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke", "Yellow", "YellowGreen" ]; default { state_entry() { string CommandList = ""; // Storage for our drawing commands integer i; CommandList = osSetPenSize( CommandList, 1 ); // Set the pen width to 1 pixel for (i = 0; i < 140; ++i) // draw each named color as a single horizontal line { // Set the pen to the next color name in our list CommandList = osSetPenColour( CommandList, llList2String( colorNames, i )); // Now draw a line in that color CommandList = osDrawLine( CommandList, 0, i, 255, i ); } // Now let's fill up the remainder with lines of random colors, leaving a gap of 20 lines. for (i = 161; i < 256; ++i) { string thisColor = "ff"; // give it an opaque alpha integer j; for (j = 0; j < 6; ++j) // then choose six random hex digits for the color { integer k = (integer) llFrand( 16.0 ); thisColor += llGetSubString( hexDigits, k, k ); } CommandList = osSetPenColour( CommandList, thisColor ); CommandList = osDrawLine( CommandList, 0, i, 255, i ); } // Now generate the texture and apply it to the prim osSetDynamicTextureData( "", "vector", CommandList, "width:256,height:256", 0 ); } } |
Appends a PenColor drawing command to the string provided in drawList and returns the result.
This 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 semi-transparent blue).
The color names and hexadecimal color representations are not case-sensitive.