drawLine

.drawLine( x1, y1, x2, y2 )

Draws a 1 pixel wide line from x1 by y1, to x2 by y2, on this Image.

// an example of drawing a diagonal line
// from 10x10 to 100x100
img = new Image( 110, 110 )
img.drawLine( 10, 10, 100, 100 )

// draw img to the screen
drawImage( img, 0, 0 )

.drawLine( x1, y1, x2, y2, width )

Width this you can specify a line 'width', in pixels, which is used when the line is drawn.

// an example of drawing a diagonal line
// from 10x10 to 100x100
img = new Image( 110, 110 )
img.drawLine( 10, 10, 100, 100, 5 )

// draw img to the screen
drawImage( img, 0, 0 )