vm
¶
The vm module contains concrete implementation of VirtualMachine using
Shapely library.
ShapelyResult
¶
Bases: Result
The ShapelyResult class is a wrapper around items returned
ShapelyVirtualMachine class as a result of executing rendering instruction.
save
¶
save(
destination: str | Path | BinaryIO,
file_format: str,
color: Style = Style.presets.COPPER_ALPHA,
**kwargs: Any
) -> None
Save result to a file or buffer in file_format.
Parameters:
-
destination(str | Path | BinaryIO) –strandPathobjects are interpreted as file paths and opened with truncation.BinaryIO-like (files, BytesIO) objects are written to directly. -
file_format(str) –Format to save the image in. Supported formats vary depending on the VirtualMachine used. You can expect though that vector images will support SVG and raster images will support PNG and JPEG formats. Other formats are possible, please check the documentation of the VirtualMachine you are using.
-
color(Style, default:COPPER_ALPHA) –Color to use for SVG, background is ignored as it is always rendered as empty space, so only foreground applies, by default Style.presets.COPPER_ALPHA
-
kwargs(Any, default:{}) –Additional keyword arguments to pass to save implementation.
save_svg
¶
save_svg(
destination: str | Path | BinaryIO,
color: Style = Style.presets.COPPER_ALPHA,
**kwargs: Any
) -> None
Save result to a file or buffer in SVG format.
Parameters:
-
destination(str | Path | BinaryIO) –strandPathobjects are interpreted as file paths and opened with truncation.BinaryIO-like (files, StringIO) objects are written to directly. -
color(Style, default:COPPER_ALPHA) –Color to use for SVG, background is ignored as it is always rendered as empty space, so only foreground applies, by default Style.presets.COPPER_ALPHA
-
kwargs(Any, default:{}) –Additional keyword arguments to pass to implementation. In particular,
encodingcan be used to specify encoding of the data, default isutf-8.
ShapelyEagerLayer
¶
Bases: EagerLayer
ShapelyEagerLayer class represents drawing space of known fixed size.
It is specifically used by ShapelyEagerLayer class.
ShapelyDeferredLayer
¶
Bases: DeferredLayer
ShapelyDeferredLayer class represents drawing space of size unknown at time of
creation of layer.
It is specifically used by ShapelyDeferredLayer class.
ShapelyVirtualMachine
¶
Bases: VirtualMachine
The ShapelyVirtualMachine class is a concrete implementation of
VirtualMachine which uses Shapely library for rendering commands.