def job(fname, lstyle): g = np.zeros((120, 160)) mkCircle(g, (80, 60), 50, lstyle) saveG(fname, g) fname = "%s-large.%s" % (fname[0:fname.find(".")], fname[fname.find(".")+1:]) saveG(fname, enLarge(g, 5))
(75, 25), (25, 30), (155, 40), (30, 50) ] points2 = [ (10, 60), (70, 70), (110, 10), (145, 10), (150, 110), (125, 90), (100, 100), (75, 90), (5, 100), (50, 80), (15, 70) ] points3 = [ (110, 60), (125, 30), (140, 60) ] fillPolygonEdge2(g, points, points2, points3) saveG("polygon_edge.png", g) saveG("polygon_edge_large.png", enLarge(g, 5))
# -*- coding: utf-8 -*- from __future__ import print_function from pygraph import line from pygraph import util g = util.mkGraph((80, 60)) ends = [(20, 10), (20, -10), (10, 20), (10, -20), (-10, 20), (-10, -20), (-20, 10), (-20, -10)] tends = [(x[0] + 40, x[1] + 30) for x in ends] for end in tends: line.mkLine(g, (40, 30), end) line.mkLine(g, (10, 20), (60, 50)) util.saveG("line.png", util.enLarge(g))
print tri print tri0 print tri1 print tri2 print tri3 print tri4 fillPolygonEdge2(g, tri0) fillPolygonEdge2(g, tri1) fillPolygonEdge2(g, tri10) fillPolygonEdge2(g, tri2) fillPolygonEdge2(g, tri20) fillPolygonEdge2(g, tri3) fillPolygonEdge2(g, tri30) fillPolygonEdge2(g, tri4) fillPolygonEdge2(g, tri40) dashed = DashedLineStyle() solid = SolidLineStyle() for x in [0, 30, 90, 150, 179]: mkLine(g, (x, 0), (x, 120), lstyle=dashed) for x in [60, 120]: mkLine(g, (x, 0), (x, 120), lstyle=solid) for y in [0, 30, 90, 119]: mkLine(g, (0, y), (180, y), lstyle=dashed) mkLine(g, (0, 60), (180, 60), lstyle=solid) printGGui(enLarge(g, 10), cmap="Greys")
# circle import script_circle_gui # lineStyle from pygraph.circle import mkCircle from pygraph.linestyle import * g = mkGraph((400, 300)) mkCircle(g, (100, 75), 70, SolidLineStyle()) mkCircle(g, (300, 75), 70, DashedLineStyle()) mkCircle(g, (100, 225), 70, DottedLineStyle()) printGGui(enLarge(g, 10), cmap="Greys") # scanline fill g = mkGraph((160, 120)) points = [ (10, 40), (20, 10), (30, 10), (40, 20), (50, 5), (60, 10), (75, 25), (25, 30), (155, 40), (30, 50)
# -*- coding: utf-8 -*- from __future__ import print_function from pygraph.line2 import mkLine from pygraph import util g = util.mkGraph((80, 60)) ends = [ (20, 10), (20, -10), (10, 20), (10, -20), (-10, 20), (-10, -20), (-20, 10), (-20, -10) ] tends = [(x[0] + 40, x[1] + 30) for x in ends] for end in tends: mkLine(g, (40, 30), end) mkLine(g, (10, 20), (60, 50)) util.saveG("line2.png", util.enLarge(g))