예제 #1
0
 def test_rotate(self):
     init()
     with transform(angle=0.1):
         box(0.5)
     write_to_png("/tmp/rotate.png")
     a = get_npimage()
     self.assertIsInstance(a, np.ndarray)
예제 #2
0
 def test_loop(self):
     init(background_color="#000000", face_color="#880000")
     with transform(x=1.2, saturation=0.1, lightness=-0.2, hue=10) as t:
         for i in range(12):
             box()
             t()
     write_to_png("/tmp/loop.png")
예제 #3
0
    def test_color(self):
        init(face_color="#123456", background_color="#aaaaaa")
        circle(0.5)
        with transform(x=1, alpha=1, hue=10):
            circle(0.5)
        with transform(x=1, y=1, scale=0.6, alpha=-0.3, hue=0):
            circle(0.5)
        with transform(x=-1,
                       y=1,
                       scale=0.6,
                       alpha=0.7,
                       hue=10,
                       saturation=-1,
                       lightness=1):
            circle(0.5)
        with transform(x=-1,
                       y=-1,
                       scale=0.6,
                       alpha=0.7,
                       hue=-10,
                       saturation=-1,
                       lightness=-1):
            circle(0.5)

        write_to_png("/tmp/color.png")
예제 #4
0
 def test_main(self):
     init(face_color="#123456", background_color="#aaaaaa")
     circle(1)
     a = get_npimage()
     print(a.shape)
     report()
     write_to_png("/tmp/test.png")
예제 #5
0
def main():
    cf.init(canvas_size=(600, 600),
            face_color="#48d341",
            background_color="#000000",
            max_depth=1000)
    PICS()
    cf.write_to_png("/tmp/pics.png")
예제 #6
0
 def test_primitives(self):
     init(face_color="#123456", background_color="#aaaaaa")
     line(1, 1)
     triangle(0.5)
     a = get_npimage()
     print(a.shape)
     report()
     write_to_png("/tmp/primitives.png")
예제 #7
0
    def test_scale_limit(self):
        @check_limits
        def element():
            circle(1)
            with transform(x=1, scale=0.2):
                element()

        init()
        element()
        write_to_png("/tmp/scale.png")

        @check_limits
        def element_non_recursive():
            pass
        init()
        for i in range(MAX_ELEMENTS + 1):
            element_non_recursive()
예제 #8
0
def main():
    init(canvas_size=(600, 600), background_color="#ffffff", face_color="#0a0707", max_depth=420)
    trunk()
    write_to_png("/tmp/graphite.png")