Beispiel #1
0
def draw_line():
    @ngjit
    def append(i, x, y, agg):
        agg[y, x] += 1

    expand_aggs_and_cols = Glyph._expand_aggs_and_cols(append, 1)
    return _build_draw_line(append, expand_aggs_and_cols)
Beispiel #2
0
def draw_line():
    @ngjit
    def append(i, x, y, agg):
        agg[y, x] += 1

    expand_aggs_and_cols = Glyph._expand_aggs_and_cols(append, 1)
    return _build_draw_segment(append, map_onto_pixel, expand_aggs_and_cols)
def extend_line():
    @ngjit
    def append(i, x, y, agg):
        agg[y, x] += 1

    mapper = ngjit(lambda x: x)
    map_onto_pixel = _build_map_onto_pixel_for_line(mapper, mapper)
    expand_aggs_and_cols = Glyph._expand_aggs_and_cols(append, 1)
    draw_line = _build_draw_segment(append, map_onto_pixel,
                                    expand_aggs_and_cols, False)
    return _build_extend_line_axis0(draw_line, expand_aggs_and_cols)[0]
Beispiel #4
0
@ngjit
def tri_append(x, y, agg, n):
    agg[y, x] += n


def new_agg():
    return np.zeros((5, 5), dtype='i4')


mapper = ngjit(lambda x: x)
map_onto_pixel_for_line = _build_map_onto_pixel_for_line(mapper, mapper)
map_onto_pixel_for_triangle = _build_map_onto_pixel_for_triangle(
    mapper, mapper)

# Line rasterization
expand_aggs_and_cols = Glyph._expand_aggs_and_cols(append, 1)
_draw_segment = _build_draw_segment(append, map_onto_pixel_for_line,
                                    expand_aggs_and_cols, False)
extend_line, _ = _build_extend_line_axis0(_draw_segment, expand_aggs_and_cols)

# Triangles rasterization
draw_triangle, draw_triangle_interp = _build_draw_triangle(tri_append)
extend_triangles = _build_extend_triangles(draw_triangle, draw_triangle_interp,
                                           map_onto_pixel_for_triangle)

# Trapezoid y rasterization
_draw_trapezoid = _build_draw_trapezoid_y(append, map_onto_pixel_for_line,
                                          expand_aggs_and_cols)

bounds = (-3, 1, -3, 1)
vt = (1., 3., 1., 3.)