コード例 #1
0
        def draw(ctx, width, height, frame_no, frame_count):
            setup(ctx, width, height, width=300, background=Color(1))

            # Fill then stroke a rectangle
            ctx.save()
            ctx.translate(0, 0)
            Rectangle(ctx).of_corner_size((20, 20), 60, 60).fill(Color('red')).stroke(Color('blue'), 10)
            ctx.restore()

            # Stroke then fill a rectangle
            ctx.save()
            ctx.translate(100, 0)
            Rectangle(ctx).of_corner_size((20, 20), 60, 60).stroke(Color('blue'), 10).fill(Color('red'))
            ctx.restore()

            # Path with two rectangles
            ctx.save()
            ctx.translate(200, 0)
            Rectangle(ctx).of_corner_size((20, 20), 60, 60).add()
            Rectangle(ctx).of_corner_size((30, 30), 60, 60).as_sub_path().fill(Color('red')).stroke(Color('blue'), 5)
            ctx.restore()

            # Path from several lines
            ctx.save()
            ctx.translate(0, 100)
            Line(ctx).of_start_end((20, 20), (60, 30)).add()
            Line(ctx).of_end((60, 60)).extend_path().add()
            Line(ctx).of_end((30, 50)).extend_path().fill(Color('red')).stroke(Color('blue'), 5)
            ctx.restore()

            # Path from several lines, closed
            ctx.save()
            ctx.translate(100, 100)
            Line(ctx).of_start_end((20, 20), (60, 30)).add()
            Line(ctx).of_end((60, 60)).extend_path().add()
            Line(ctx).of_end((30, 50)).extend_path(close=True).fill(Color('red')).stroke(Color('blue'), 5)
            ctx.restore()

            # roundrect open
            ctx.save()
            ctx.translate(0, 200)
            Circle(ctx).of_center_radius((20, 20), 10).as_arc(math.pi, math.pi * 3 / 2).add()
            Circle(ctx).of_center_radius((60, 20), 10).as_arc(math.pi * 3 / 2, 0).extend_path().add()
            Circle(ctx).of_center_radius((60, 60), 10).as_arc(0, math.pi / 2).extend_path().add()
            Circle(ctx).of_center_radius((20, 60), 10).as_arc(math.pi / 2, math.pi).extend_path().fill(
                Color('red')).stroke(Color('blue'), 5)
            ctx.restore()

            # roundrect closed
            ctx.save()
            ctx.translate(100, 200)
            Circle(ctx).of_center_radius((20, 20), 10).as_arc(math.pi, math.pi * 3 / 2).add()
            Circle(ctx).of_center_radius((60, 20), 10).as_arc(math.pi * 3 / 2, 0).extend_path().add()
            Circle(ctx).of_center_radius((60, 60), 10).as_arc(0, math.pi / 2).extend_path().add()
            Circle(ctx).of_center_radius((20, 60), 10).as_arc(math.pi / 2, math.pi).extend_path(close=True).fill(
                Color('red')).stroke(Color('blue'), 5)
            ctx.restore()
コード例 #2
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_width, background=Color(0.8))

    black = Color(0)

    Rectangle(ctx).of_corner_size((50, 50), 350, 250).add()
    Rectangle(ctx).of_corner_size((100, 100), 250, 150).as_sub_path()\
        .fill(Color('red'), fill_rule=EVEN_ODD)\
        .stroke(Color('blue'), 5)
コード例 #3
0
def draw_delta(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color(1))

    col = Color("cadetblue")

    pos = [10, 10]
    w = 100
    h = 100

    Rectangle(ctx).of_corner_size(pos, w, h).fill(col.with_g_factor(0.8))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(col)
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(col.with_g_factor(1.2))

    pos = [10, 120]

    Rectangle(ctx).of_corner_size(pos, w, h).fill(col.with_l_factor(0.6))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(col)
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(col.with_l_factor(1.4))

    pos = [10, 230]

    Rectangle(ctx).of_corner_size(pos, w, h).fill(col.with_s_factor(0.6))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(col)
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(col.with_s_factor(1.4))
コード例 #4
0
        def draw(ctx, width, height, frame_no, frame_count):
            setup(ctx, width, height, width=5, background=Color(0.8))

            # The rectangle function is a convenience function that adds a rectangle as a new the path.
            # You can fill or stroke it as you wish.
            rectangle(ctx, (1, 1), 1, 1.2)
            ctx.set_source_rgba(*Color(1, 0, 0))
            ctx.fill()

            # Rectangle objects can be filled, stroked, filled and stroked.
            Rectangle(ctx).of_corner_size((3, 1), 1, 1.2).fill(Color(0, .5, 0))
            Rectangle(ctx).of_corner_size((1, 3), 1.2, 1).stroke(Color(0, .5, 0), 0.1)
            Rectangle(ctx).of_corner_size((3, 3), 1.2, 1).fill(Color(0, 0, 1)).stroke(Color(0), 0.2)
コード例 #5
0
ファイル: rectangle.py プロジェクト: sthagen/generativepy
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, background=Color(0.4))

    color = Color(1, 0.5, 0)

    Rectangle(ctx).of_corner_size((100, 150), 250, 200).fill(color)
コード例 #6
0
ファイル: setup.py プロジェクト: martinmcbride/generativepy
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, width=5, background=Color(0.4))

    color = Color(1, 0.5, 0)

    Rectangle(ctx).of_corner_size((1, 1.5), 2.5, 2).fill(color)
コード例 #7
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color(0.8))

    Rectangle(ctx).of_corner_size((50, 50), 100, 300)\
                  .fill(Color('magenta'))

    Rectangle(ctx).of_corner_size((200, 50), 100, 300)\
                  .stroke(Color('blue'), 10)

    Rectangle(ctx).of_corner_size((350, 50), 100, 300)\
                  .stroke(Color('black'), 20)\
                  .fill(Color('yellow'))

    Rectangle(ctx).of_corner_size((500, 50), 100, 300)\
                  .fill(Color('yellow'))\
                  .stroke(Color('black'), 20)
コード例 #8
0
def draw_grey(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color('cornflowerblue'))

    pos = [10, 10]
    w = 100
    h = 100

    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0.25))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0.75))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(1))
    pos[0] += w
コード例 #9
0
    def draw(ctx, pixel_width, pixel_height, fn, frame_count):
        setup(ctx,
              pixel_width,
              pixel_height,
              width=OUTPUTWIDTH,
              height=OUTPUTHEIGHT,
              background=Color(0.5))

        Rectangle(ctx).of_corner_size(position[fn], 50,
                                      50).fill(Color("green"))
コード例 #10
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, background=Color(0.4))

    gradient = LinearGradient().of_points((150, 150), (350, 250))\
                               .with_stops([(0, Color('yellow')),
                                            (0.5, Color('blue')),
                                            (1, Color('red'))])\
                               .build()
    Rectangle(ctx).of_corner_size((150, 150), 200, 100).fill(gradient)
コード例 #11
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, background=Color(0.8))

    blue = Color('blue')
    red = Color('red')
    thickness = 2

    Rectangle(ctx).of_corner_size((10, 10), 200, 150).stroke(blue, thickness)

    with Transform(ctx).translate(0, 200):
        Rectangle(ctx).of_corner_size((10, 10), 200,
                                      150).stroke(red, thickness)

    with Transform(ctx) as t:
        Rectangle(ctx).of_corner_size((250, 100), 50, 150).fill(blue)
        t.translate(60, 10)
        Rectangle(ctx).of_corner_size((250, 100), 50, 150).fill(red)
        t.translate(60, 10)
        Rectangle(ctx).of_corner_size((250, 100), 50, 150).fill(red)
コード例 #12
0
def draw_lerp(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color('cornflowerblue'))

    color1 = Color('red')
    color2 = Color('blue')

    pos = [10, 10]
    w = 100
    h = 100

    Rectangle(ctx).of_corner_size(pos, w, h).fill(color1.lerp(color2, 0))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(color1.lerp(color2, 0.25))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(color1.lerp(color2, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(color1.lerp(color2, 0.75))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(color1.lerp(color2, 1))
    pos[0] += w
コード例 #13
0
def draw_rgba(ctx, pixel_width, pixel_height, frame_no, frame_count):
    """
    Draw a rectangle on an RGBA background
    :param ctx:
    :param pixel_width:
    :param pixel_height:
    :param frame_no:
    :param frame_count:
    :return:
    """
    setup(ctx, pixel_width, pixel_height, width=4, background=Color(0.8, 0.5))
    Rectangle(ctx).of_corner_size((0.5, 1), 3, 1.5).fill(Color(0, .5, 0))
コード例 #14
0
ファイル: rotate.py プロジェクト: martinmcbride/generativepy
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, background=Color(0.8))

    blue = Color('blue')
    red = Color('red')
    green = Color('green')
    thickness = 4

    Rectangle(ctx).of_corner_size((100, 20), 100, 50).fill(blue)

    with Transform(ctx).rotate(math.pi/4):
        Rectangle(ctx).of_corner_size((100, 20), 100, 50).fill(red)

    with Transform(ctx) as t:
        Rectangle(ctx).of_corner_size((200, 150), 100, 100).stroke(blue, thickness)
        t.rotate(math.pi/6, (200, 150))
        Rectangle(ctx).of_corner_size((200, 150), 100, 100).stroke(red, thickness)
        t.rotate(math.pi/6, (200, 150))
        Rectangle(ctx).of_corner_size((200, 150), 100, 100).stroke(red, thickness)
        Circle(ctx).of_center_radius((200, 150), 5).fill(green)
コード例 #15
0
        def draw(ctx, width, height, frame_no, frame_count):
            setup(ctx, width, height, width=5, background=Color(0.8))

            Rectangle(ctx).of_corner_size((0.5, 1), 1,
                                          1.2).stroke(Color(0, .5, 0),
                                                      0.1,
                                                      dash=[0.25])
            Rectangle(ctx).of_corner_size((2, 1), 1,
                                          1.2).stroke(Color(0, .5, 0),
                                                      0.1,
                                                      dash=[0.25],
                                                      cap=BUTT)
            Rectangle(ctx).of_corner_size((3.5, 1), 1.2,
                                          1).stroke(Color(0, .5, 0),
                                                    0.1,
                                                    dash=[0.25],
                                                    cap=ROUND)
            Rectangle(ctx).of_corner_size((0.5, 3), 1,
                                          1.2).stroke(Color(0, .5, 0),
                                                      0.1,
                                                      join=ROUND)
            Rectangle(ctx).of_corner_size((2, 3), 1,
                                          1.2).stroke(Color(0, .5, 0),
                                                      0.1,
                                                      join=BEVEL)
            Rectangle(ctx).of_corner_size((3.5, 3), 1.2,
                                          1).stroke(Color(0, .5, 0),
                                                    0.1,
                                                    miter_limit=1)
コード例 #16
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_width, background=Color(0.8))

    x, y = 50, 100
    text = Text(ctx).of("Text size",
                        (x, y)).font("Times").size(100).fill(Color('blue'))
    width, height = text.get_size()
    Text(ctx).of('{} by {}'.format(width, height), (x+400, y))\
        .font("Times").size(40).fill(Color('black'))

    x, y = 50, 200
    text = Text(ctx).of("xyz",
                        (x, y)).font("Times").size(100).fill(Color('blue'))
    width, height = text.get_size()
    Text(ctx).of('{} by {}'.format(width, height), (x+400, y))\
        .font("Times").size(40).fill(Color('black'))

    x, y = 50, 300
    text = Text(ctx).of("Text extents",
                        (x, y)).font("Times").size(100).fill(Color('blue'))
    x_bearing, y_bearing, width, height, x_advance, y_advance = text.get_metrics(
    )
    Rectangle(ctx).of_corner_size((x + x_bearing, y + y_bearing), width,
                                  height).stroke(Color('red'))

    x, y = 50, 400
    text = Text(ctx).of("xyz",
                        (x, y)).font("Times").size(100).fill(Color('blue'))
    x_bearing, y_bearing, width, height, x_advance, y_advance = text.get_metrics(
    )
    Rectangle(ctx).of_corner_size((x + x_bearing, y + y_bearing), width,
                                  height).stroke(Color('red'))

    x, y = 300, 400
    text = Text(ctx).of("'''",
                        (x, y)).font("Times").size(100).fill(Color('blue'))
    x_bearing, y_bearing, width, height, x_advance, y_advance = text.get_metrics(
    )
    Rectangle(ctx).of_corner_size((x + x_bearing, y + y_bearing), width,
                                  height).stroke(Color('red'))
コード例 #17
0
def draw_map(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color(0.5))

    w = 2
    h = 100

    pos = [10, 10]
    colormap = make_colormap(256, [Color('red'), Color('blue')])
    for i in range(256):
        Rectangle(ctx).of_corner_size(pos, w, h).fill(colormap[i])
        pos[0] += 2

    pos = [10, 120]
    colormap = make_colormap(
        256, [Color('red'), Color('blue'),
              Color('yellow')])
    for i in range(256):
        Rectangle(ctx).of_corner_size(pos, w, h).fill(colormap[i])
        pos[0] += 2

    pos = [10, 230]
    colormap = make_colormap(
        256, [Color('red'), Color('blue'),
              Color('yellow')], [3, 1])
    for i in range(256):
        Rectangle(ctx).of_corner_size(pos, w, h).fill(colormap[i])
        pos[0] += 2

    pos = [10, 340]
    colormap = make_colormap(
        256, [Color('red'),
              Color('blue'),
              Color('yellow'),
              Color('green')], [3, 0, 1])
    for i in range(256):
        Rectangle(ctx).of_corner_size(pos, w, h).fill(colormap[i])
        pos[0] += 2
コード例 #18
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, background=Color(0.8))

    blue = Color('blue')
    red = Color('red')
    green = Color('green')
    thickness = 8

    Rectangle(ctx).of_corner_size((50, 40), 100, 30).fill(blue)

    with Transform(ctx).scale(1.5, 2):
        Rectangle(ctx).of_corner_size((50, 40), 100, 30).fill(red)

    with Transform(ctx) as t:
        Circle(ctx).of_center_radius((220, 260), 5).fill(green)
        Rectangle(ctx).of_corner_size((20, 160), 400,
                                      200).stroke(blue, thickness)
        t.scale(0.5, 0.5, (220, 260))
        Rectangle(ctx).of_corner_size((20, 160), 400,
                                      200).stroke(red, thickness)
        t.scale(0.5, 0.5, (220, 260))
        Rectangle(ctx).of_corner_size((20, 160), 400,
                                      200).stroke(red, thickness)
コード例 #19
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, background=Color(0.4))

    gradient = LinearGradient().of_points(
        (150, 150), (350, 250)).with_start_end(Color('yellow'),
                                               Color('red')).build()
    Rectangle(ctx).of_corner_size((0, 0), 500, 400).fill(gradient)

    Line(ctx).of_start_end((150, 150), (350, 250)).stroke(Color(0), 2, [5, 5])
    Line(ctx).of_start_end((150, 150),
                           (250, -50)).as_line().stroke(Color(0), 2, [5, 5])
    Line(ctx).of_start_end((350, 250),
                           (450, 50)).as_line().stroke(Color(0), 2, [5, 5])
    Circle(ctx).of_center_radius((150, 150), 5).fill(Color(0))
    Circle(ctx).of_center_radius((350, 250), 5).fill(Color(0))
コード例 #20
0
        def draw(ctx, width, height, frame_no, frame_count):
            setup(ctx, width, height, width=10, background=Color(0.8))

            gradient = LinearGradient().of_points(
                (0, 1), (0, 3)).with_start_end(Color(0), Color('red')).build()
            Square(ctx).of_corner_size((1, 1), 2).fill(gradient)

            gradient = LinearGradient().of_points(
                (3, 1), (6.2, 2.5)).with_start_end(Color(1),
                                                   Color('green')).build()
            Rectangle(ctx).of_corner_size((4, 1), 2.2, 1.5).fill(gradient)

            gradient = LinearGradient().of_points(
                (7, 1), (9, 1)).with_start_end(Color('blue'),
                                               Color('yellow')).build()
            Circle(ctx).of_center_radius((8, 2), 1.5).fill(gradient)

            gradient = LinearGradient().of_points((0, 4), (0, 6)).with_stops(
                ((0, Color(0)), (0.5, Color('red')), (1.0,
                                                      Color('blue')))).build()
            Square(ctx).of_corner_size((1, 4), 2).fill(gradient)

            gradient = LinearGradient().of_points((4, 4), (6, 6)).with_stops(
                ((0, Color(0)), (0.5, Color('red')), (0.8, Color('green')),
                 (1.0, Color('blue')))).build()
            Square(ctx).of_corner_size((4, 4), 2).fill(gradient)

            gradient = LinearGradient().of_points((7, 4), (7, 6)).with_stops(
                ((0, Color(0)), (0.5, Color('red')), (0.5, Color('blue')),
                 (1.0, Color('blue')))).build()
            Square(ctx).of_corner_size((7, 4), 2).fill(gradient)

            gradient = LinearGradient().of_points((0, 7), (0, 9)).with_stops(
                ((0, Color(0)), (0.5, Color('red')), (1.0,
                                                      Color('blue')))).build()
            Square(ctx).of_corner_size((1.1, 7.1), 1.8).stroke(gradient, .2)

            gradient = LinearGradient().of_points((4, 7), (6, 9)).with_stops(
                ((0, Color(0)), (0.5, Color('red')), (0.8, Color('green')),
                 (1.0, Color('blue')))).build()
            Square(ctx).of_corner_size((4.1, 7.1), 1.8).stroke(gradient, .2)

            gradient = LinearGradient().of_points((7, 7), (7, 9)).with_stops(
                ((0, Color(0)), (0.5, Color('red')), (0.5, Color('blue')),
                 (1.0, Color('blue')))).build()
            Square(ctx).of_corner_size((7.1, 7.1), 1.8).stroke(gradient, .2)
コード例 #21
0
def draw_rgb(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color("cornflowerblue"))

    pos = [10, 10]
    w = 100
    h = 100

    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0, 0, 0))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0.5, 0, 0))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(1, 0, 0))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0.5, 1, 0))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0.5, 0, 1))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0, 1, .5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color(0.5, 0.5, 0.5))
    pos[0] += w
コード例 #22
0
def draw_css(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color('cornflowerblue'))

    pos = [10, 10]
    w = 100
    h = 100

    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color("salmon"))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color("gold"))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color("seagreen"))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color("cadetblue"))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color("slateblue"))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color("darkorchid"))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color("hotpink"))
    pos[0] += w
コード例 #23
0
def draw(ctx, pixel_width, pixel_height, frame_no, frame_count):

    setup(ctx, pixel_width, pixel_height, background=Color(0.8))

    red = Color('red')
    green = Color('green')
    blue = Color('blue')
    thickness = 2

    Line(ctx).of_start_end((150, 150), (50, 50)).stroke(red, thickness)
    Line(ctx).of_start_end((300, 150),
                           (200, 50)).as_ray().stroke(red, thickness)
    Line(ctx).of_start_end((450, 150),
                           (350, 50)).as_line().stroke(red, thickness)

    Triangle(ctx).of_corners((50, 200), (150, 200),
                             (125, 300)).stroke(green, thickness)
    Square(ctx).of_corner_size((200, 200), 100).stroke(green, thickness)
    Rectangle(ctx).of_corner_size((350, 200), 100, 75).stroke(green, thickness)

    Polygon(ctx).of_points([(50, 350), (250, 400), (250, 500),
                            (50, 375)]).stroke(blue, thickness)
    Polygon(ctx).of_points([(300, 350), (500, 400), (500, 500),
                            (300, 375)]).open().stroke(blue, thickness)
コード例 #24
0
def draw_hsl(ctx, pixel_width, pixel_height, frame_no, frame_count):
    setup(ctx, pixel_width, pixel_height, background=Color('cornflowerblue'))

    pos = [10, 10]
    w = 70
    h = 100

    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.1, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.2, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.3, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.4, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.5, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.6, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.7, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.8, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.9, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(1.0, 0.5, 0.5))
    pos[0] += w

    pos = [10, 120]
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.0, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.1, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.2, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.3, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.4, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.6, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.7, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.8, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 0.9, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.0, 1.0, 0.5))
    pos[0] += w

    pos = [10, 230]
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.0))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.1))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.2))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.3))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.4))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.5))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.6))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.7))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.8))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 0.9))
    pos[0] += w
    Rectangle(ctx).of_corner_size(pos, w, h).fill(Color.of_hsl(0.66, 0.5, 1.0))
    pos[0] += w