1
1
"""
2
- An agg http://antigrain.com/ backend
2
+ An agg_ backend.
3
3
4
- Features that are implemented
4
+ .. _agg: http://antigrain.com/
5
5
6
- * capstyles and join styles
7
- * dashes
8
- * linewidth
9
- * lines, rectangles, ellipses
10
- * clipping to a rectangle
11
- * output to RGBA and Pillow-supported image formats
12
- * alpha blending
13
- * DPI scaling properly - everything scales properly (dashes, linewidths, etc)
14
- * draw polygon
15
- * freetype2 w/ ft2font
6
+ Features that are implemented:
16
7
17
- TODO:
8
+ * capstyles and join styles
9
+ * dashes
10
+ * linewidth
11
+ * lines, rectangles, ellipses
12
+ * clipping to a rectangle
13
+ * output to RGBA and Pillow-supported image formats
14
+ * alpha blending
15
+ * DPI scaling properly - everything scales properly (dashes, linewidths, etc)
16
+ * draw polygon
17
+ * freetype2 w/ ft2font
18
18
19
- * integrate screen dpi w/ ppi and text
19
+ TODO:
20
20
21
+ * integrate screen dpi w/ ppi and text
21
22
"""
23
+
22
24
try :
23
25
import threading
24
26
except ImportError :
@@ -151,9 +153,7 @@ def draw_path(self, gc, path, transform, rgbFace=None):
151
153
"'agg.path.chunksize' rcparam)" )
152
154
153
155
def draw_mathtext (self , gc , x , y , s , prop , angle ):
154
- """
155
- Draw the math text using matplotlib.mathtext
156
- """
156
+ """Draw mathtext using :mod:`matplotlib.mathtext`."""
157
157
ox , oy , width , height , descent , font_image , used_characters = \
158
158
self .mathtext_parser .parse (s , self .dpi , prop )
159
159
@@ -358,16 +358,7 @@ def post_processing(image, dpi):
358
358
359
359
360
360
class FigureCanvasAgg (FigureCanvasBase ):
361
- """
362
- The canvas the figure renders into. Calls the draw and print fig
363
- methods, creates the renderers, etc...
364
-
365
- Attributes
366
- ----------
367
- figure : `matplotlib.figure.Figure`
368
- A high-level Figure instance
369
-
370
- """
361
+ # docstring inherited
371
362
372
363
def copy_from_bbox (self , bbox ):
373
364
renderer = self .get_renderer ()
@@ -378,9 +369,7 @@ def restore_region(self, region, bbox=None, xy=None):
378
369
return renderer .restore_region (region , bbox , xy )
379
370
380
371
def draw (self ):
381
- """
382
- Draw the figure using the renderer.
383
- """
372
+ # docstring inherited
384
373
self .renderer = self .get_renderer (cleared = True )
385
374
# Acquire a lock on the shared font cache.
386
375
with RendererAgg .lock , \
@@ -404,38 +393,29 @@ def get_renderer(self, cleared=False):
404
393
return self .renderer
405
394
406
395
def tostring_rgb (self ):
407
- """Get the image as an RGB byte string.
396
+ """
397
+ Get the image as RGB `bytes`.
408
398
409
399
`draw` must be called at least once before this function will work and
410
400
to update the renderer for any subsequent changes to the Figure.
411
-
412
- Returns
413
- -------
414
- bytes
415
401
"""
416
402
return self .renderer .tostring_rgb ()
417
403
418
404
def tostring_argb (self ):
419
- """Get the image as an ARGB byte string.
405
+ """
406
+ Get the image as ARGB `bytes`.
420
407
421
408
`draw` must be called at least once before this function will work and
422
409
to update the renderer for any subsequent changes to the Figure.
423
-
424
- Returns
425
- -------
426
- bytes
427
410
"""
428
411
return self .renderer .tostring_argb ()
429
412
430
413
def buffer_rgba (self ):
431
- """Get the image as a memoryview to the renderer's buffer.
414
+ """
415
+ Get the image as a `memoryview` to the renderer's buffer.
432
416
433
417
`draw` must be called at least once before this function will work and
434
418
to update the renderer for any subsequent changes to the Figure.
435
-
436
- Returns
437
- -------
438
- memoryview
439
419
"""
440
420
return self .renderer .buffer_rgba ()
441
421
0 commit comments