Пример #1
0
def gradient_hsv_custom(v):
    colors = random_creator(4)
    h, s, v = linear_interpolation(colors, v)
    return hsv2rgb(h, s, v)
Пример #2
0
def gradient_hsv_unknown(v):
    colors = ((hsv_angle(120), 1 / 2, 1), (hsv_angle(0), 1 / 2, 1))
    h, s, v = linear_interpolation(colors, v)
    return hsv2rgb(h, s, v)
Пример #3
0
def get_h_value(value, max_min_dif, minimum):
    return gr.linear_interpolation(colors_space,
                                   (value - minimum) / max_min_dif)[0]
Пример #4
0
def gradient_hsv_gbr(v):
    hsv_colors = ((hsv_angle(120), 1, 1), (hsv_angle(180), 1, 1), (hsv_angle(240), 1, 1),
                  (hsv_angle(300), 1, 1), (hsv_angle(360), 1, 1))
    h, s, v = linear_interpolation(hsv_colors, v)
    return hsv2rgb(h, s, v)
Пример #5
0
def antialiase(mapa):
    original_map_size = len(mapa)
    new_map_size = int(
        original_map_size * antialiasing_multiplier) - antialiasing_multiplier
    amapa = createHSVmatrix(new_map_size, new_map_size)
    ax = 0
    ay = 0
    for x in range(original_map_size - 1):
        for y in range(original_map_size - 1):
            amapa[ax][ay] = mapa[x][y]

            amapa[ax + 1][ay] = gr.linear_interpolation(
                (mapa[x][y], mapa[x + 1][y]), 0.25)
            amapa[ax + 2][ay] = gr.linear_interpolation(
                (mapa[x][y], mapa[x + 1][y]), 0.5)
            amapa[ax + 3][ay] = gr.linear_interpolation(
                (mapa[x][y], mapa[x + 1][y]), 0.75)

            amapa[ax][ay + 1] = gr.linear_interpolation(
                (mapa[x][y], mapa[x][y + 1]), 0.25)
            amapa[ax][ay + 2] = gr.linear_interpolation(
                (mapa[x][y], mapa[x][y + 1]), 0.5)
            amapa[ax][ay + 3] = gr.linear_interpolation(
                (mapa[x][y], mapa[x][y + 1]), 0.75)

            amapa[ax + 1][ay + 1] = gr.linear_interpolation(
                (mapa[x][y], mapa[x + 1][y + 1]), 0.25)
            amapa[ax + 2][ay + 2] = gr.linear_interpolation(
                (mapa[x][y], mapa[x + 1][y + 1]), 0.5)
            amapa[ax + 3][ay + 3] = gr.linear_interpolation(
                (mapa[x][y], mapa[x + 1][y + 1]), 0.75)

            amapa[ax + 3][ay + 1] = gr.linear_interpolation(
                (amapa[ax][ay + 3], amapa[ax + 3][ay + 3]), 1 / 3)
            amapa[ax + 3][ay + 2] = gr.linear_interpolation(
                (amapa[ax][ay + 3], amapa[ax + 3][ay + 3]), 2 / 3)

            amapa[ax + 1][ay + 3] = gr.linear_interpolation(
                (amapa[ax + 3][ay], amapa[ax + 3][ay + 3]), 1 / 3)
            amapa[ax + 2][ay + 3] = gr.linear_interpolation(
                (amapa[ax + 3][ay], amapa[ax + 3][ay + 3]), 2 / 3)

            amapa[ax + 2][ay + 1] = gr.linear_interpolation(
                (amapa[ax][ay + 1], amapa[ax + 2][ay + 3]), .5)
            amapa[ax + 1][ay + 2] = gr.linear_interpolation(
                (amapa[ax + 1][ay], amapa[ax + 3][ay + 2]), .5)

            ay += antialiasing_multiplier
        ax += antialiasing_multiplier
        ay = 0
    return amapa