(click image to enlarge)

pixelWithAlpha = function(x,y,a) -- Pseudo Alpha channel. Only works with black background (for obvious reasons)
alphaStep = 255 / 4
if a > 255 - alphaStep then
term.setBackgroundColor(colors.white)
elseif a > 255 - alphaStep * 2 then
term.setBackgroundColor(colors.lightGray)
elseif a > 255 - alphaStep * 3 then
term.setBackgroundColor(colors.gray)
else
term.setBackgroundColor(colors.black)
return
end
term.setCursorPos(x,y)
term.write(" ")
end
aaLine = function(x0, y0, x1, y1)
dx = math.abs(x1-x0)
if x0<x1 then sx = 1 else sx = -1 end
dy = math.abs(y1-y0)
if y0<y1 then sy = 1 else sy = -1 end
err = dx-dy
if dx + dy == 0 then
ed = 1
else
ed = math.sqrt(dx*dx+dy*dy)
end
while true do
pixelWithAlpha(x0,y0, 255 - (255 * math.abs(err-dx+dy)/ed));
e2 = err
x2 = x0
if (2*e2 >= -dx) then
if (x0 == x1) then break end
if (e2+dy < ed) then pixelWithAlpha(x0,y0+sy, 255 - (255*(e2+dy)/ed)) end
err = err - dy;
x0 = x0 + sx;
end
if (2*e2 <= dy) then
if (y0 == y1) then break end
if (dx-e2 < ed) then pixelWithAlpha(x2+sx,y0, 255 - (255*(dx-e2)/ed)) end
err = err + dx;
y0 = y0 + sy;
end
end
end
term.setBackgroundColor(colors.black)
term.clear()
aaLine(0,0,10,19)
paintutils.drawLine(5,0,15,19,colors.white)
or
http://pastebin.com/BwbmMTmQ
Edited by Xenthera, 28 October 2014 - 05:11 PM.












