def render_path(self, pathid): path = self.pathd[pathid] if path.antialiased: renderer = self.renderer scanline = self.scanline render_scanlines = agg.render_scanlines_rgba else: renderer = self.rendererbin scanline = self.scanlinebin render_scanlines = agg.render_scanlines_bin_rgba affine = self.adisplay * path.affine #print 'display affine:\n', self.adisplay #print 'path affine:\n', path.affine #print 'product affine:\n', affine aggaffine = agg.trans_affine(*affine.vec6) transpath = agg.conv_transform_path(path.agg_path, aggaffine) if path.facecolor is not None: #print 'render path', path.facecolor, path.agg_facecolor self.rasterizer.add_path(transpath) renderer.color_rgba8(path.agg_facecolor) render_scanlines(self.rasterizer, scanline, renderer) if path.color is not None: stroke = agg.conv_stroke_transpath(transpath) stroke.width(path.linewidth) self.rasterizer.add_path(stroke) renderer.color_rgba8(path.agg_color) render_scanlines(self.rasterizer, scanline, renderer)
def render_path(self, pathid): path = self.pathd[pathid] if path.antialiased: renderer = self.renderer scanline = self.scanline render_scanlines = agg.render_scanlines_rgba else: renderer = self.rendererbin scanline = self.scanlinebin render_scanlines = agg.render_scanlines_bin_rgba affine = self.adisplay * path.affine # print 'display affine:\n', self.adisplay # print 'path affine:\n', path.affine # print 'product affine:\n', affine aggaffine = agg.trans_affine(*affine.vec6) transpath = agg.conv_transform_path(path.agg_path, aggaffine) if path.facecolor is not None: # print 'render path', path.facecolor, path.agg_facecolor self.rasterizer.add_path(transpath) renderer.color_rgba8(path.agg_facecolor) render_scanlines(self.rasterizer, scanline, renderer) if path.color is not None: stroke = agg.conv_stroke_transpath(transpath) stroke.width(path.linewidth) self.rasterizer.add_path(stroke) renderer.color_rgba8(path.agg_color) render_scanlines(self.rasterizer, scanline, renderer)
## Transforming a path path = agg.path_storage() path.move_to(0,0) path.line_to(1,0) path.line_to(1,1) path.line_to(0,1) path.close_polygon() rotation = agg.trans_affine_rotation(pi/4) scaling = agg.trans_affine_scaling(30,30) translation = agg.trans_affine_translation(300,300) trans = rotation*scaling*translation transpath = agg.conv_transform_path(path, trans) stroke = agg.conv_stroke_transpath(transpath) stroke.width(2.0) rasterizer.add_path(stroke) renderer.color_rgba8( black ) agg.render_scanlines_rgba(rasterizer, scanline, renderer); ## Converting a transformed path to a curve path = agg.path_storage() path.move_to(0,0) path.curve3(1,0) path.curve3(1,1) path.curve3(0,1) path.close_polygon() rotation = agg.trans_affine_rotation(pi/4) scaling = agg.trans_affine_scaling(30,30)