Difference between revisions of "Draw API"

From HSYCO
Jump to navigation Jump to search
Line 3: Line 3:
 
<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>
 
Draws an arc.
 
Draws an arc.
==== Parameters ====
+
'''Parameters:'''
 
*x: the x coordinate of the upper-left corner of the arc's framing rectangle
 
*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
 
*y: the y coordinate of the upper-left corner of the arc's framing rectangle
Line 17: Line 17:
 
<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
==== Parameters ====
+
'''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.
 
*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 ===
 
<source lang="java">image(file, x, y)</source>
 
<source lang="java">image(file, x, y)</source>
==== Parameters ====
+
'''Parameters:'''
 
*file: the full pathname, relative to the HSYCO home directory
 
*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
 
*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 29: Line 29:
 
<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
==== Parameters ====
+
'''Parameters:'''
 
*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
Line 40: Line 40:
 
<source lang="java">spline(x1, y1, x2, y2, ...., color)</source>
 
<source lang="java">spline(x1, y1, x2, y2, ...., color)</source>
 
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
==== Parameters ====
+
'''Parameters:'''
 
* 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
Line 50: Line 50:
 
=== 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 ====
+
'''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 63: 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>
==== Parameters ====
+
'''Parameters:'''
 
* text: quoted text
 
* 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.
 
* 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.
Line 73: Line 73:
 
<source lang="java">stroke(w)</source>
 
<source lang="java">stroke(w)</source>
 
Set the stroke width for all subsequent drawing commands.
 
Set the stroke width for all subsequent drawing commands.
==== Parameters ====
+
'''Parameters:'''
 
* w: the width of the stroke
 
* w: the width of the stroke

Revision as of 11:43, 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 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.

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