Difference between revisions of "Draw API"

From HSYCO
Jump to navigation Jump to search
(Created page with "== Functions == === Arc === <source lang="java">arc(x, y, w, h, start, extent, type, border_color, fill_color)</source> - x: the x coordinate of the upper-left corner of the a...")
 
Line 2: Line 2:
 
=== Arc ===
 
=== Arc ===
 
<source lang="java">arc(x, y, w, h, start, extent, type, border_color, fill_color)</source>
 
<source lang="java">arc(x, y, w, h, start, extent, type, border_color, fill_color)</source>
- x: the x coordinate of the upper-left corner of the arc's framing rectangle
+
Draws an arc.
- y: the y coordinate of the upper-left corner of the arc's framing rectangle
+
==== Parameters ====
- w: the overall width of the full ellipse of which this arc is a partial section
+
*x: the x coordinate of the upper-left corner of the arc's framing rectangle
- h: the overall height of the full ellipse of which this arc is a partial section
+
*y: the y coordinate of the upper-left corner of the arc's framing rectangle
- start: the starting angle of the arc in degrees
+
*w: the overall width of the full ellipse of which this arc is a partial section
- extent: the angular extent of the arc in degrees
+
*h: the overall height of the full ellipse of which this arc is a partial section
- type: the closure type for the arc: "open", "chord" or "pie"
+
*start: the starting angle of the arc in degrees
- border_color: fill color can be set using an RGB comma separated numeric notation, with
+
*extent: the angular extent of the arc in degrees
primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),
+
*type: the closure type for the arc: "open", "chord" or "pie"
or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
+
*border_color: fill color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
- fill_color: fill color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),
+
*fill_color: fill color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
 
  
 
=== Fill ===
 
=== Fill ===
 
<source lang="java">fill(color)</source>
 
<source lang="java">fill(color)</source>
 
Fills the whole area with given color
 
Fills the whole area with given color
- color: color can be set using an RGB comma separated numeric notation, with
+
==== Parameters ====
primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),
+
*color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red) or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow. Set color to "transparent" to create a transparent background, before drawing other objects.
or using color names. The valid names are: black, blue, cyan, darkgray, gray,
 
lightgray, green, magenta, orange, pink, red, white, yellow.
 
Set color to "transparent" to create a transparent background, before drawing other objects.
 
  
 
=== Image ===
 
=== Image ===
 
<source lang="java">image(file, x, y)</source>
 
<source lang="java">image(file, x, y)</source>
- file: the full pathname, relative to the HSYCO home directory
+
==== Parameters ====
- x: the x coordinate of the location where the String should be rendered - y: the y coordinate of the location where the String should be rendered
+
*file: the full pathname, relative to the HSYCO home directory
 +
*x: the x coordinate of the location where the String should be rendered - y: the y coordinate of the location where the String should be rendered
  
 
=== Line ===
 
=== Line ===
 
<source lang="java">line(x1, y1, x2, y2, ...., color)</source>
 
<source lang="java">line(x1, y1, x2, y2, ...., color)</source>
 
Draws a sequence of connected lines - x1: X axis coordinate of first point
 
Draws a sequence of connected lines - x1: X axis coordinate of first point
- y1: Y axis coordinate of first point
+
==== Parameters ====
- x2: X axis coordinate of second point
+
*y1: Y axis coordinate of first point
- y2: Y axis coordinate of second point
+
*x2: X axis coordinate of second point
- xN: X axis coordinate of N-th point
+
*y2: Y axis coordinate of second point
- yN: Y axis coordinate of N-th point
+
*xN: X axis coordinate of N-th point
- color: color can be set using an RGB comma separated numeric notation, with
+
*yN: Y axis coordinate of N-th point
primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),
+
*color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
 
  
 
== Spline ==
 
== Spline ==
Line 45: Line 41:
 
draws a natural cubic spline interpolation of a sequence of points - x1: X axis coordinate of first point
 
draws a natural cubic spline interpolation of a sequence of points - x1: X axis coordinate of first point
  
- y1: Y axis coordinate of first point
+
* y1: Y axis coordinate of first point
- x2: X axis coordinate of second point
+
* x2: X axis coordinate of second point
- y2: Y axis coordinate of second point
+
* y2: Y axis coordinate of second point
- xN: X axis coordinate of N-th point
+
* xN: X axis coordinate of N-th point
- yN: Y axis coordinate of N-th point
+
* yN: Y axis coordinate of N-th point
- color: color can be set using an RGB comma separated numeric notation, with
+
* color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),
 
or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
 
  
 
== Rectangle ==
 
== Rectangle ==
 
<source lang="java">rectangle(x, y, w, h, border_color, fill_color)</source>
 
<source lang="java">rectangle(x, y, w, h, border_color, fill_color)</source>
 +
==== Parameters ====
 
- x: the x coordinate of the upper-left corner of the rectangle
 
- x: the x coordinate of the upper-left corner of the rectangle
 
- y: the y coordinate of the upper-left corner of the rectangle
 
- y: the y coordinate of the upper-left corner of the rectangle
Line 68: Line 63:
 
=== String ===
 
=== String ===
 
<source lang="java">string(text, x, y, font, style, size, color)</source>
 
<source lang="java">string(text, x, y, font, style, size, color)</source>
- text: quoted text
+
==== Parameters ====
- x: the x coordinate of the location where the String should be rendered - y: the y coordinate of the location where the String should be rendered - font: font name, like “arial”, “helvetica”, “courier” etc.
+
* text: quoted text
- style: “bold”, “italic”, or “bolditalic”
+
* x: the x coordinate of the location where the String should be rendered - y: the y coordinate of the location where the String should be rendered - font: font name, like “arial”, “helvetica”, “courier” etc.
- color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),
+
* style: “bold”, “italic”, or “bolditalic”
 +
* color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),
 
or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
 
or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
  
 
=== Stroke ===
 
=== Stroke ===
 
<source lang="java">stroke(w)</source>
 
<source lang="java">stroke(w)</source>
Set the stroke width for all subsequent drawing commands - w: the width of the stroke
+
Set the stroke width for all subsequent drawing commands.
 +
==== Parameters ====
 +
* w: the width of the stroke

Revision as of 12:40, 27 February 2014

Functions

Arc

arc(x, y, w, h, start, extent, type, border_color, fill_color)

Draws an arc.

Parameters

  • x: the x coordinate of the upper-left corner of the arc's framing rectangle
  • y: the y coordinate of the upper-left corner of the arc's framing rectangle
  • w: the overall width of the full ellipse of which this arc is a partial section
  • h: the overall height of the full ellipse of which this arc is a partial section
  • start: the starting angle of the arc in degrees
  • extent: the angular extent of the arc in degrees
  • type: the closure type for the arc: "open", "chord" or "pie"
  • border_color: fill color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.
  • fill_color: fill color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.

Fill

fill(color)

Fills the whole area with given color

Parameters

  • color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red) or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow. Set color to "transparent" to create a transparent background, before drawing other objects.

Image

image(file, x, y)

Parameters

  • file: the full pathname, relative to the HSYCO home directory
  • x: the x coordinate of the location where the String should be rendered - y: the y coordinate of the location where the String should be rendered

Line

line(x1, y1, x2, y2, ...., color)

Draws a sequence of connected lines - x1: X axis coordinate of first point

Parameters

  • y1: Y axis coordinate of first point
  • x2: X axis coordinate of second point
  • y2: Y axis coordinate of second point
  • xN: X axis coordinate of N-th point
  • yN: Y axis coordinate of N-th point
  • color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.

Spline

spline(x1, y1, x2, y2, ...., color)

draws a natural cubic spline interpolation of a sequence of points - x1: X axis coordinate of first point

  • y1: Y axis coordinate of first point
  • x2: X axis coordinate of second point
  • y2: Y axis coordinate of second point
  • xN: X axis coordinate of N-th point
  • yN: Y axis coordinate of N-th point
  • color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.

Rectangle

rectangle(x, y, w, h, border_color, fill_color)

Parameters

- x: the x coordinate of the upper-left corner of the rectangle - y: the y coordinate of the upper-left corner of the rectangle - w: the width of the rectangle - h: the height of the rectangle - border_color: fill color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow. - fill_color: fill color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red), or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.

String

string(text, x, y, font, style, size, color)

Parameters

  • text: quoted text
  • x: the x coordinate of the location where the String should be rendered - y: the y coordinate of the location where the String should be rendered - font: font name, like “arial”, “helvetica”, “courier” etc.
  • style: “bold”, “italic”, or “bolditalic”
  • color: color can be set using an RGB comma separated numeric notation, with primary color numbers from 0 to 255 (for example, “color:255,0,0” is red),

or using color names. The valid names are: black, blue, cyan, darkgray, gray, lightgray, green, magenta, orange, pink, red, white, yellow.

Stroke

stroke(w)

Set the stroke width for all subsequent drawing commands.

Parameters

  • w: the width of the stroke