コード例 #1
0
ファイル: canvas.py プロジェクト: pcn/trtc
def Canvas(width, height, fill=tuples.Color(0.0, 0.0, 0.0)):
    """Canvas appears to be a 2-dimensional structure.

    For the pixels, we're going to refer to them by width (x), height (y)
    because it seems natural.  However when storing and accessing them,
    it makes sense to have them be height, width (y, x).
    """
    pixels = [[fill] * int(height) for count in range(int(width))]
    return _c(width, height, pixels)
コード例 #2
0
ファイル: tuples_steps.py プロジェクト: pcn/trtc
def step_impl(context, r, g, b):
    assert tuples.t_eq(tuples.hadamard_product(context.c1, context.c2),
                       tuples.Color(r, g, b))
コード例 #3
0
ファイル: tuples_steps.py プロジェクト: pcn/trtc
def step_impl(context, x, y, z):
    context.c2 = tuples.Color(x, y, z)
コード例 #4
0
ファイル: tuples_steps.py プロジェクト: pcn/trtc
def step_impl(context, sc, r, g, b):
    assert tuples.t_eq(tuples.t_mul(context.c1, sc), tuples.Color(r, g, b))
コード例 #5
0
ファイル: tuples_steps.py プロジェクト: pcn/trtc
def step_impl(context, r, g, b):
    assert tuples.t_eq(tuples.t_sub(context.c1, context.c2),
                       tuples.Color(r, g, b))
コード例 #6
0
ファイル: canvas_steps.py プロジェクト: pcn/trtc
def step_impl(context, r, g, b):
    context.c3 = tuples.Color(r, g, b)
コード例 #7
0
ファイル: canvas_steps.py プロジェクト: pcn/trtc
def step_impl(context, r, g, b):
    every_pixel = tuples.Color(r, g, b)
    assert False not in [
        tuples.t_eq(every_pixel, this_pixel)
        for this_pixel in itertools.chain(*context.c.pixels)
    ]