I've written this from various sources around the web, and hopefully this can become a standard library included in computercraft. (here's to hoping)
You are allowed, and even encouraged to modify, tidy up and/or optimize the source. Post the changes here and i'll update this thread
http://pastebin.com/sA0A9wzL

Methods:
--//line args:(x1,y1,x2,y1)
--//rect args:(x,y,width,height)
--//circle args:(x,y,radius)
--//ellipse args:(x,y,width,height)
--//arc args:(x,y,radius,startAngle,endAngle,segments --filled only)
--//triangle args:(x1,y1,x2,y2,x3,y3)
To use it, i'd personally use
g = dofile("graphicsUtils") – or whatever you saved it as
g.methodName()
drawMethod draw the outline of specified shape ex: drawCircle(args)
fillMethod draw the filled version of specified shape ex: fillCircle(args)
demo source: http://pastebin.com/QxLJsbu9
TODO:
- Bezier curves
- Line width
- Polygons