def ex2(): # Create a Blank Image img = Image(320, 240) # Fill Image with Color img.fill( (255, 255, 255) ) many_points = [] many_points.extend([ ((0, 0, 54), (0, 10, 54)), ((0, 0, 54), (16, 0, 54)), ((16, 0, 54), (16, 10, 54)) ]) many_points.extend([ ((16, 10, 54), (8, 16, 54)), ((8, 16, 54), (0, 10, 54)), ((8, 16, 54), (8, 16, 30)) ]) many_points.extend([ ((8, 16, 30), (16, 10, 30)), ((16, 10, 30), (16, 0, 30)), ((16, 0, 30), (16, 0, 54)) ]) many_points.extend([ ((16, 10, 54), (16, 10, 30)), ((8, 16, 30), (0, 10, 30)), ((0, 10, 30), (0, 10, 54)) ]) many_points.extend([ ((0, 0, 54), (0, 0, 30)), ((0, 0, 30), (0, 10, 30)), ((0, 0, 30), (16, 0, 30)) ]) lines = DView(0, 0, (36, 25, 74), (0, 0, -25), many_points, (160,120), 10).run() lines2 = DView(45, -45, (36, 25, 74), (0, 0, -25), many_points, (160,120), 10).run() lines3 = DView(90, 0, (36, 25, 74), (0, 0, -25), many_points, (160,120), 10).run() lines4 = DView(-45, 0, (8, 8, 54), (0, 0, -25), many_points, (160,120), 10).run() #print(lines) for line in lines4: # Draw Lines on Image img.blit( line ) # Create/Write Image img.save('house5.ppm')
def ex1(): points = [(35, 40, 70), (20, 30, 50)] outlines = DView(45, 90, (20, 20, 75), (0, 0, -20), points, (160,120), 80).run() #print(outlines[0]) # Create a Blank Image img = Image(320, 240) # Fill Image with Color img.fill( (245, 245, 245) ) # Create Line Objects #line1 = Line( 60, 120, 160, 120, (255, 0, 0) ) line1 = outlines[0] print(line1) # Draw Lines on Image img.blit( line1 ) # Create/Write Image img.save('test.ppm')