Пример #1
0
    def paint(self, image, col, row, color, dx, dy):
        x = col * self.grid.cell_size + dx
        y = row * self.grid.cell_size + dy
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        cell_size = self.grid.cell_size
        facet = self.facet

        image.polygon([(x + facet, y + facet),
                       (x + facet, y + cell_size - facet),
                       (x + cell_size - facet, y + cell_size - facet),
                       (x + cell_size - facet, y + facet)],
                      fill=color)

        c1 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.2)))
        image.polygon([(x, y), (x + facet, y + facet),
                       (x + cell_size - facet, y + facet), (x + cell_size, y)],
                      fill=c1)

        c2 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.1)))
        image.polygon([(x, y), (x + facet, y + facet),
                       (x + facet, y + cell_size - facet), (x, y + cell_size)],
                      fill=c2)

        c3 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.1)))
        image.polygon([(x, y + cell_size), (x + facet, y + cell_size - facet),
                       (x + cell_size - facet, y + cell_size - facet),
                       (x + cell_size, y + cell_size)],
                      fill=c3)

        c4 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.2)))
        image.polygon([(x + cell_size, y), (x + cell_size - facet, y + facet),
                       (x + cell_size - facet, y + cell_size - facet),
                       (x + cell_size, y + cell_size)],
                      fill=c4)
Пример #2
0
    def paint(self, image, col, row, color, dx, dy):
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        points = diamond_points(col, row, self.grid.cell_size)

        cx = points[0]['x']
        cy = points[1]['y']
        
        c1 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.2)))
        image.polygon(
            [
                (points[0]['x'] + dx, points[0]['y'] + dy),
                (cx + dx, cy + dy),
                (points[3]['x'] + dx, points[3]['y'] + dy),
            ],
            fill=c1
        )
        
        c2 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.1)))
        image.polygon(
            [
                (points[0]['x'] + dx, points[0]['y'] + dy),
                (cx + dx, cy + dy),
                (points[1]['x'] + dx, points[1]['y'] + dy)
            ],
            fill=c2
        )
        
        c3 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.1)))
        image.polygon(
            [
                (points[2]['x'] + dx, points[2]['y'] + dy),
                (cx + dx, cy + dy),
                (points[3]['x'] + dx, points[3]['y'] + dy),
            ],
            fill=c3
        )

        c4 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.2)))
        image.polygon(
            [
                (points[1]['x'] + dx, points[1]['y'] + dy),
                (cx + dx, cy + dy),
                (points[2]['x'] + dx, points[2]['y'] + dy),
            ],
            fill=c4
        )

        image.point([(points[0]['x'] + dx, points[0]['y'] + dy - 1)], c1)
Пример #3
0
    def paint(self, image, col, row, color, dx, dy):
        x = col * self.grid.cell_size + dx
        y = row * self.grid.cell_size + dy
        facet = self.grid.cell_size * self.frame_width

        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        if self.frame_light > 0:
            frame_color = clr.rgb256(*colorsys.hls_to_rgb(
                *clr.lighten_hls(hls, self.frame_light)))
        else:
            frame_color = clr.rgb256(*colorsys.hls_to_rgb(
                *clr.darken_hls(hls, -self.frame_light)))

        image.polygon([(x, y), (x, y + self.grid.cell_size),
                       (x + self.grid.cell_size, y + self.grid.cell_size),
                       (x + self.grid.cell_size, y)],
                      fill=frame_color)

        image.polygon([
            (x + facet, y + facet),
            (x + facet, y + self.grid.cell_size - facet),
            (x + self.grid.cell_size - facet, y + self.grid.cell_size - facet),
            (x + self.grid.cell_size - facet, y + facet)
        ],
                      fill=color)
Пример #4
0
    def paint(self, image, col, row, color, dx, dy):
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        points = diamond_points(col, row, self.grid.cell_size)

        frame = self.grid.cell_size * 0.1
        points2 = [
            {
                'x': points[0]['x'],
                'y': points[0]['y'] + frame
            },
            {
                'x': points[1]['x'] - frame,
                'y': points[1]['y']
            },
            {
                'x': points[2]['x'],
                'y': points[2]['y'] - frame
            },
            {
                'x': points[3]['x'] + frame,
                'y': points[3]['y']
            }
        ]

        if self.frameLight > 0:
            c1 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, self.frameLight)))
        else:
            c1 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, -self.frameLight)))

        image.polygon(
            [
                (points[0]['x'] + dx, points[0]['y'] + dy),
                (points[1]['x'] + dx, points[1]['y'] + dy),
                (points[2]['x'] + dx, points[2]['y'] + dy),
                (points[3]['x'] + dx, points[3]['y'] + dy)
            ],
            fill=c1
        )

        image.polygon(
            [
                (points2[0]['x'] + dx, points2[0]['y'] + dy),
                (points2[1]['x'] + dx, points2[1]['y'] + dy),
                (points2[2]['x'] + dx, points2[2]['y'] + dy),
                (points2[3]['x'] + dx, points2[3]['y'] + dy)
            ],
            fill=color
        )

        image.point([(points[0]['x'] + dx, points[0]['y'] + dy - 1)], c1)
Пример #5
0
    def paint(self, image, col, row, color, dx, dy):
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        pp = iso_hex_points(col, row, self.grid.cell_size / 2)
        cx = pp[6]['x']
        cy = pp[6]['y']

        c0 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.2)))
        image.polygon([(pp[0]['x'] + dx, pp[0]['y'] + dy),
                       (pp[1]['x'] + dx, pp[1]['y'] + dy), (cx + dx, cy + dy)],
                      fill=c0)

        c1 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.1)))
        image.polygon([(pp[1]['x'] + dx, pp[1]['y'] + dy),
                       (pp[2]['x'] + dx, pp[2]['y'] + dy), (cx + dx, cy + dy)],
                      fill=c1)

        c2 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.1)))
        image.polygon([(pp[2]['x'] + dx, pp[2]['y'] + dy),
                       (pp[3]['x'] + dx, pp[3]['y'] + dy), (cx + dx, cy + dy)],
                      fill=c2)

        c3 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.2)))
        image.polygon([(pp[3]['x'] + dx, pp[3]['y'] + dy),
                       (pp[4]['x'] + dx, pp[4]['y'] + dy), (cx + dx, cy + dy)],
                      fill=c3)

        c4 = c2
        image.polygon([(pp[4]['x'] + dx, pp[4]['y'] + dy),
                       (pp[5]['x'] + dx, pp[5]['y'] + dy), (cx + dx, cy + dy)],
                      fill=c4)

        c5 = c1
        image.polygon([(pp[5]['x'] + dx, pp[5]['y'] + dy),
                       (pp[0]['x'] + dx, pp[0]['y'] + dy), (cx + dx, cy + dy)],
                      fill=c5)
Пример #6
0
    def paint(self, image, col, row, color, dx, dy):
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        pp = triangle_points(col, row, self.grid.cell_size)

        c1 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.2)))
        image.polygon(
            [(pp[0]['x'] + dx, pp[0]['y'] + dy),
             (pp[1]['x'] + dx, pp[1]['y'] + dy),
             (pp[1]['x'] + (pp[3]['x'] - pp[1]['x']) / 2 + dx, pp[1]['y'] +
              (pp[3]['y'] - pp[1]['y']) / 2 + dy),
             (pp[0]['x'] + (pp[3]['x'] - pp[0]['x']) / 2 + dx, pp[0]['y'] +
              (pp[3]['y'] - pp[0]['y']) / 2 + dy)],
            fill=c1)

        c2 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.1)))
        image.polygon(
            [(pp[0]['x'] + dx, pp[0]['y'] + dy),
             (pp[2]['x'] + dx, pp[2]['y'] + dy),
             (pp[2]['x'] + (pp[3]['x'] - pp[2]['x']) / 2 + dx, pp[2]['y'] +
              (pp[3]['y'] - pp[2]['y']) / 2 + dy),
             (pp[0]['x'] + (pp[3]['x'] - pp[0]['x']) / 2 + dx, pp[0]['y'] +
              (pp[3]['y'] - pp[0]['y']) / 2 + dy)],
            fill=c2)

        c3 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.1)))
        image.polygon(
            [(pp[1]['x'] + dx, pp[1]['y'] + dy),
             (pp[2]['x'] + dx, pp[2]['y'] + dy),
             (pp[2]['x'] + (pp[3]['x'] - pp[2]['x']) / 2 + dx, pp[2]['y'] +
              (pp[3]['y'] - pp[2]['y']) / 2 + dy),
             (pp[1]['x'] + (pp[3]['x'] - pp[1]['x']) / 2 + dx, pp[1]['y'] +
              (pp[3]['y'] - pp[1]['y']) / 2 + dy)],
            fill=c3)

        image.polygon(
            [(pp[0]['x'] + (pp[3]['x'] - pp[0]['x']) / 2 + dx, pp[0]['y'] +
              (pp[3]['y'] - pp[0]['y']) / 2 + dy),
             (pp[1]['x'] + (pp[3]['x'] - pp[1]['x']) / 2 + dx, pp[1]['y'] +
              (pp[3]['y'] - pp[1]['y']) / 2 + dy),
             (pp[2]['x'] + (pp[3]['x'] - pp[2]['x']) / 2 + dx, pp[2]['y'] +
              (pp[3]['y'] - pp[2]['y']) / 2 + dy)],
            fill=color)
Пример #7
0
    def paint(self, image, col, row, color, dx, dy):
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        pp = triangle_points(col, row, self.grid.cell_size)

        if self.frameLight > 0:
            c1 = clr.rgb256(*colorsys.hls_to_rgb(
                *clr.lighten_hls(hls, self.frameLight)))
        else:
            c1 = clr.rgb256(*colorsys.hls_to_rgb(
                *clr.darken_hls(hls, -self.frameLight)))
        image.polygon([(pp[0]['x'] + dx, pp[0]['y'] + dy),
                       (pp[1]['x'] + dx, pp[1]['y'] + dy),
                       (pp[2]['x'] + dx, pp[2]['y'] + dy)],
                      fill=c1)

        image.polygon(
            [(pp[0]['x'] + (pp[3]['x'] - pp[0]['x']) / 3 + dx, pp[0]['y'] +
              (pp[3]['y'] - pp[0]['y']) / 3 + dy),
             (pp[1]['x'] + (pp[3]['x'] - pp[1]['x']) / 3 + dx, pp[1]['y'] +
              (pp[3]['y'] - pp[1]['y']) / 3 + dy),
             (pp[2]['x'] + (pp[3]['x'] - pp[2]['x']) / 3 + dx, pp[2]['y'] +
              (pp[3]['y'] - pp[2]['y']) / 3 + dy)],
            fill=color)
Пример #8
0
    def paint(self, image, col, row, color, dx, dy):
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        pp = iso_hex_points(col, row, self.grid.cell_size / 2)
        cx = pp[6]['x']
        cy = pp[6]['y']

        if self.frame_light > 0:
            c0 = clr.rgb256(*colorsys.hls_to_rgb(
                *clr.lighten_hls(hls, self.frame_light)))
        else:
            c0 = clr.rgb256(*colorsys.hls_to_rgb(
                *clr.darken_hls(hls, -self.frame_light)))

        image.polygon([(pp[0]['x'] + dx, pp[0]['y'] + dy),
                       (pp[1]['x'] + dx, pp[1]['y'] + dy),
                       (pp[2]['x'] + dx, pp[2]['y'] + dy),
                       (pp[3]['x'] + dx, pp[3]['y'] + dy),
                       (pp[4]['x'] + dx, pp[4]['y'] + dy),
                       (pp[5]['x'] + dx, pp[5]['y'] + dy)],
                      fill=c0)

        image.polygon(
            [(pp[0]['x'] + dx + (cx - pp[0]['x']) / 4, pp[0]['y'] + dy +
              (cy - pp[0]['y']) / 4),
             (pp[1]['x'] + dx + (cx - pp[1]['x']) / 4, pp[1]['y'] + dy +
              (cy - pp[1]['y']) / 4),
             (pp[2]['x'] + dx + (cx - pp[2]['x']) / 4, pp[2]['y'] + dy +
              (cy - pp[2]['y']) / 4),
             (pp[3]['x'] + dx + (cx - pp[3]['x']) / 4, pp[3]['y'] + dy +
              (cy - pp[3]['y']) / 4),
             (pp[4]['x'] + dx + (cx - pp[4]['x']) / 4, pp[4]['y'] + dy +
              (cy - pp[4]['y']) / 4),
             (pp[5]['x'] + dx + (cx - pp[5]['x']) / 4, pp[5]['y'] + dy +
              (cy - pp[5]['y']) / 4)],
            fill=color)
Пример #9
0
    def paint(self, image, col, row, color, dx, dy):
        rgb = clr.hex_to_rgb(color)
        hls = colorsys.rgb_to_hls(*rgb)
        points = diamond_points(col, row, self.grid.cell_size)

        facet = self.grid.cell_size / 4

        points2 = [
            {
                'x': points[0]['x'],
                'y': points[0]['y'] + facet
            },
            {
                'x': points[1]['x'] - facet,
                'y': points[1]['y']
            },
            {
                'x': points[2]['x'],
                'y': points[2]['y'] - facet
            },
            {
                'x': points[3]['x'] + facet,
                'y': points[3]['y']
            }
        ]

        c1 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.2)))
        image.polygon(
            [
                (points[0]['x'] + dx, points[0]['y'] + dy),
                (points2[0]['x'] + dx, points2[0]['y'] + dy),
                (points2[3]['x'] + dx, points2[3]['y'] + dy),
                (points[3]['x'] + dx, points[3]['y'] + dy),
            ],
            fill=c1
        )

        c2 = clr.rgb256(*colorsys.hls_to_rgb(*clr.lighten_hls(hls, 0.1)))
        image.polygon(
            [
                (points[0]['x'] + dx, points[0]['y'] + dy),
                (points2[0]['x'] + dx, points2[0]['y'] + dy),
                (points2[1]['x'] + dx, points2[1]['y'] + dy),
                (points[1]['x'] + dx, points[1]['y'] + dy),
            ],
            fill=c2
        )
        
        c3 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.1)))
        image.polygon(
            [
                (points[2]['x'] + dx, points[2]['y'] + dy),
                (points2[2]['x'] + dx, points2[2]['y'] + dy),
                (points2[3]['x'] + dx, points2[3]['y'] + dy),
                (points[3]['x'] + dx, points[3]['y'] + dy),
            ],
            fill=c3
        )

        c4 = clr.rgb256(*colorsys.hls_to_rgb(*clr.darken_hls(hls, 0.2)))
        image.polygon(
            [
                (points[1]['x'] + dx, points[1]['y'] + dy),
                (points2[1]['x'] + dx, points2[1]['y'] + dy),
                (points2[2]['x'] + dx, points2[2]['y'] + dy),
                (points[2]['x'] + dx, points[2]['y'] + dy),
            ],
            fill=c4
        )

        image.polygon(
            [
                (points2[0]['x'] + dx, points2[0]['y'] + dy),
                (points2[1]['x'] + dx, points2[1]['y'] + dy),
                (points2[2]['x'] + dx, points2[2]['y'] + dy),
                (points2[3]['x'] + dx, points2[3]['y'] + dy),
            ],
            fill=color
        )

        image.point([(points[0]['x'] + dx, points[0]['y'] + dy - 1)], c1)