def main():
# make the canvas
sur = cairo.ImageSurface(cairo.FORMAT_ARGB32, SIZE, SIZE)
ctx = cairo.Context(sur)
# scale canvas so that x and y ranges from 0 to 1.
ctx.scale(SIZE, SIZE)
# set the background color of the canvas
ctx.set_source_rgba(*BACK)
ctx.rectangle(0.0, 0.0, 1.0, 1.0)
ctx.fill()
ctx.set_line_width(LINEWIDTH)
circles = []
add_new_circles(NEW_COUNT, circles)
for i in xrange(STEPS):
increase_radius(circles)
ok_count = test(circles)
if ok_count < 1:
add_new_circles(NEW_COUNT, circles)
print(i, 'adding new circles, total count: ' + str(len(circles)))
show(ctx, circles)
sur.write_to_png(RES)
评论列表
文章目录