public sub AngleLine(ByVal lX,ByVal lY,ByVal lRadius,ByVal sinAngle) ' Draw a line at an angle ' Angles start from the top vertical and work clockwise ' Work out the destination defined by length and angle Dim lX2 Dim lY2
' Bresenham line algorithm, this is pretty quick, only uses point to point to avoid the ' mid-point problem public sub Line(ByVal lX1,ByVal lY1,ByVal lX2,ByVal lY2) Dim lDX Dim lDY Dim lXIncrement Dim lYIncrement Dim lDPr Dim lDPru Dim lP
lDX = Abs(lX2 - lX1) lDY = Abs(lY2 - lY1)
if lX1 > lX2 then lXIncrement = -1 else lXIncrement = 1 end if
if lY1 > lY2 then lYIncrement = -1 else lYIncrement = 1 end if
if lDX >= lDY then lDPr = ShiftLeft(lDY,1) lDPru = lDPr - ShiftLeft(lDX,1) lP = lDPr - lDX
while lDX >= 0 Pixel(lX1,lY1) = ForegroundColourIndex if lP > 0 then lX1 = lX1 + lXIncrement lY1 = lY1 + lYIncrement lP = lP + lDPru