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 draw_line = _build_draw_line(append) extend_line = _build_extend_line_axis0(draw_line, map_onto_pixel_for_line) # 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) bounds = (-3, 1, -3, 1) vt = (1., 3., 1., 3.) def test_draw_line(): x0, y0 = (0, 0) x1, y1 = (3, 3) out = np.array([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
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 draw_line = _build_draw_line(append) extend_line = _build_extend_line_axis0(draw_line, map_onto_pixel_for_line) # 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) bounds = (-3, 1, -3, 1) vt = (1., 3., 1., 3.) def test_draw_line(): x0, y0 = (0, 0) x1, y1 = (3, 3) out = np.array([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 0]]) agg = new_agg() draw_line(x0, y0, x1, y1, 0, True, False, agg)