+
+ # Split the line up if there's anything>16383, because
+ # that would overflow the 4 bits allowed for length
+ mstep=[dx.abs/16383,dy.abs/16383,1].max.ceil
+ xstep=dx/mstep
+ ystep=dy/mstep
+ d=''
+ for i in (1..mstep)
+ d+=drawSection(x,y,x+xstep,y+ystep)
+ x+=xstep
+ y+=ystep
+ end
+ d
+ end
+
+ def drawSection(x1,y1,x2,y2)
+ d='11' # TypeFlag, EdgeFlag
+ dx=x2-x1
+ dy=y2-y1