def line(x0: float, y0: float, x1: float, y1: float) -> vp.LineCollection: """ Generate a single line. The line starts at (X0, Y0) and ends at (X1, Y1). All arguments understand supported units. """ return vp.LineCollection([vp.line(x0, y0, x1, y1)])
def test_text_block_render(assert_image_similarity, font_name, align, line_spacing, justify): doc = vp.Document() doc.add( vp.text_block( LOREM, 500, font_name, size=18, align=align, line_spacing=line_spacing, justify=justify, )) doc[1].append(vp.line(500, -20, 500, 500)) renderer = ImageRenderer((1024, 1024)) renderer.engine.document = doc renderer.engine.show_rulers = True renderer.engine.unit_type = UnitType.PIXELS renderer.engine.origin = (-20, -20) renderer.engine.scale = 1.8 assert_image_similarity(renderer.render())
def render_item(self, i, n): if i % 2 == 0: return vp.LineCollection( [vp.line(0, -self.dr / 2, 0, self.dr / 2)]) else: return vp.LineCollection([DOT])
def render_item(self, i, n): return vp.LineCollection([vp.line(0, -self.dr / 2, 0, self.dr / 2)])
def render_item(self, i, n): u = self.unit_length return vp.LineCollection( [vp.line(-u / 3, 0, u / 3, 0), vp.line(0, -u / 3, 0, u / 3)])