This is the basic class of the canvas module, which serves to collect various graphical and text elements you want to write eventually to an (E)PS file.
| attrs=[], texrunner=None) |
Paths can be drawn on the canvas using one of the following methods:
| path, attrs) |
| path, attrs=[]) |
| path, attrs=[]) |
Arbitrary allowed elements like other canvas instances can be inserted in the canvas using
| item, attrs=[]) |
Text output on the canvas is possible using
| x, y, text, attrs=[]) |
The canvas class provides access to the total geometrical size of its element:
| ) |
A canvas also allows one to set its TeX runner:
| texrunner) |
The contents of the canvas can be written using the following two convenience methods, which wrap the canvas into a single page document.
| file, *args, **kwargs) |
| file, *args, **kwargs) |
| file, *args, **kwargs) |
| filename, *args, **kwargs) |
| filename="-", device=None, resolution=100, gscommand="gs", gsoptions="", textalphabits=4, graphicsalphabits=4, **kwargs) |
"png16", "png16m", "png256", "png48",
"pngalpha", "pnggray", "pngmono",
"jpeg", and "jpeggray" might be available among
others. See the output of gs -help and the ghostscript
documentation for more information. When filename is specified
but the device is not set, "png16m" is used when the filename
ends in .eps and "jpeg" is used when the filename
ends in .jpg.
resolution specifies the resolution in dpi (dots per inch).
gscmd is the command to be used to invoke ghostscript.
gsoptions are an option string passed to the ghostscript
interpreter. textalphabits are graphicsalphabits are
conventient parameters to set the TextAlphaBits and
GraphicsAlphaBits options of ghostscript. You can skip
the addition of those option by set their value to None.
kwargs are passed to the writeEPSfile method (not counting the file parameter), which is used to generate the input for ghostscript. By that you gain access to the document.page constructor arguments.
For more information about the possible arguments of the document.page constructor, we refer to Sect. 2.7.