An abstract base class to handle drawing/rendering operations. The following methods must be implemented in the backend for full functionality (though just implementing `draw_path` alone would give a highly capable backend): * `draw_path` * `draw_image` * `draw_gouraud
| 132 | |
| 133 | |
| 134 | class RendererBase: |
| 135 | """ |
| 136 | An abstract base class to handle drawing/rendering operations. |
| 137 | |
| 138 | The following methods must be implemented in the backend for full |
| 139 | functionality (though just implementing `draw_path` alone would give a |
| 140 | highly capable backend): |
| 141 | |
| 142 | * `draw_path` |
| 143 | * `draw_image` |
| 144 | * `draw_gouraud_triangles` |
| 145 | |
| 146 | The following methods *should* be implemented in the backend for |
| 147 | optimization reasons: |
| 148 | |
| 149 | * `draw_text` |
| 150 | * `draw_markers` |
| 151 | * `draw_path_collection` |
| 152 | * `draw_quad_mesh` |
| 153 | """ |
| 154 | def __init__(self): |
| 155 | super().__init__() |
| 156 | self._texmanager = None |
| 157 | self._text2path = text.TextToPath() |
| 158 | self._raster_depth = 0 |
| 159 | self._rasterizing = False |
| 160 | |
| 161 | def open_group(self, s, gid=None): |
| 162 | """ |
| 163 | Open a grouping element with label *s* and *gid* (if set) as id. |
| 164 | |
| 165 | Only used by the SVG renderer. |
| 166 | """ |
| 167 | |
| 168 | def close_group(self, s): |
| 169 | """ |
| 170 | Close a grouping element with label *s*. |
| 171 | |
| 172 | Only used by the SVG renderer. |
| 173 | """ |
| 174 | |
| 175 | def draw_path(self, gc, path, transform, rgbFace=None): |
| 176 | """Draw a `~.path.Path` instance using the given affine transform.""" |
| 177 | raise NotImplementedError |
| 178 | |
| 179 | def draw_markers(self, gc, marker_path, marker_trans, path, |
| 180 | trans, rgbFace=None): |
| 181 | """ |
| 182 | Draw a marker at each of *path*'s vertices (excluding control points). |
| 183 | |
| 184 | The base (fallback) implementation makes multiple calls to `draw_path`. |
| 185 | Backends may want to override this method in order to draw the marker |
| 186 | only once and reuse it multiple times. |
| 187 | |
| 188 | Parameters |
| 189 | ---------- |
| 190 | gc : `.GraphicsContextBase` |
| 191 | The graphics context. |