Gnocl Cookbook‎ > ‎

Drawing polylines on a gnocl::pixBuf

The is no single command in the Cairo 2d drawing library to produce polylines. Here's one to do it from Tcl side.



proc polyLine {w coords} {
    set i 1
    foreach {x y} $coords {
        if {$i} {
            set x1 $x ; set y1 $y
            set i 0
        } else {
            gnocl::draw line $w -from [list $x1 $y1] -to [list $x $y]
            set x1 $x ; set y1 $y
        }
    }
}

polyLine $pb2 [list 0 100 100 0 200 100 150 200]


Comments