polyline. Drawing broken lines through joints coordinates

^image.polyline(color)[table with junctions coordinates]

The method draws a line according to joints coordinates specified in the table. It is used to create broken lines.

Example
$coordinates[^table::create{x   y
10   0
10   100
20   100
20   50
50   50
50   40
20   40
20   10
60   10
65   15
65   0
10   0
}]
$square[^image::
create(100;100;0xFFFFFF)]

$square.
line-style[***   ]
$square.line-width(2)

^square.polyline(0xFF00FF)[$coordinates]

$file_withgif[^square.
gif[]]
^file_withgif.
save[binary;letter_F.gif]

$letter_F[^image::
load[letter_F.gif]]
^letter_F.
html[]

Browser will display letter F drawn by a dotted line against white background. In current directory, a file
letter.gif will be created. This example uses objects of class image of two different types. The table specifies coordinates of broken line. Then, against the background created by constructor create a line is drawn through specified coordinates. Created object of class image is encoded into GIF format. Resulted object of class file is saved to disk. Afterwards, a new object of class image, based on saved file, is created. Method html will output this object to browser window.


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 02.03.2011