KnittingPatternToSVG
Module¶
This module provides functionality to convert knitting patterns to SVG.
-
class
knittingpattern.convert.KnittingPatternToSVG.
KnittingPatternToSVG
(knittingpattern, layout, instruction_to_svg, builder, zoom)[source]¶ Bases:
object
Converts a KnittingPattern to SVG.
This is inspired by the method object pattern, since building an SVG requires several steps.
-
__init__
(knittingpattern, layout, instruction_to_svg, builder, zoom)[source]¶ Parameters: - knittingpattern¶ (knittingpattern.KnittingPattern.KnittingPattern) – a knitting pattern
- layout¶ (knittingpattern.convert.Layout.GridLayout) –
- instruction_to_svg¶ – an
InstructionToSVG
:class:` ~knittingpattern.convert.InstructionToSVGCache.InstructionSVGCache`, both with instructions already loaded. - builder¶ (knittingpattern.convert.SVGBuilder.SVGBuilder) –
- zoom¶ (float) – the height and width of a knit instruction
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
knittingpattern.convert.KnittingPatternToSVG.
DEFINITION_HOLDER
= 'g'¶ Inside the svg, the instructions are put into definitions. The svg tag is renamed to the tag given in
DEFINITION_HOLDER
.