예제 #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)
    ]