Difference between revisions of "Drawing Pictures"
From CodeStuff
| Line 1: | Line 1: | ||
| − | You can draw on the canvas very easily. | + | You can draw on the canvas very easily. This page walks you through drawing with some of the functions available. |
| + | |||
| + | The full list of functions you can use can be seen at [[API]] | ||
| + | |||
;setColour(colour) | ;setColour(colour) | ||
: sets the colour of the next thing to be drawn. Colour names that your browser should know can be found at http://en.wikipedia.org/wiki/X11_color_names#Color_name_charts | : sets the colour of the next thing to be drawn. Colour names that your browser should know can be found at http://en.wikipedia.org/wiki/X11_color_names#Color_name_charts | ||
Revision as of 00:22, 26 April 2012
You can draw on the canvas very easily. This page walks you through drawing with some of the functions available.
The full list of functions you can use can be seen at API
- setColour(colour)
- sets the colour of the next thing to be drawn. Colour names that your browser should know can be found at http://en.wikipedia.org/wiki/X11_color_names#Color_name_charts
examples
setColour("red");
setColour("green");
setColour("#FF0080");
- drawLine(x1,y1,x2,y2)
- draws a straight line from x1,y1 to x2,y2
examples
drawLine(50,10,300,240); drawLine(40,30,10,10); drawLine(ax,bx,ax+10,bx+32);
- drawCircle(centerX,centerY,radius);
- draws a circle centered at centerX,centerY with a size of radius.
examples
drawCircle(30,150,10); drawCircle(400,150,100);
- fillCircle(centerX,centerY,radius);
- identical to drawCircle except the circle is filled with color rather than just an outline.
- drawRectangle(left,top,width,height);
- draws a rectangle with the top-left corner at left,top and a size of width and height.
examples
drawRectangle(300,15,20,10); drawRectangle(0,0,300,200);
- fillRectangle(left,top,width,height);
- identical to drawRectangle except the rectangle is filled width color rather than just an outline.