AYABPNGBuilder Module¶
Convert knitting patterns to png files.
These png files are used to be fed into the ayab-desktop software. They only contain which meshes will be knit with a contrast color. They just contain colors.
-
class
knittingpattern.convert.AYABPNGBuilder.AYABPNGBuilder(min_x, min_y, max_x, max_y, default_color='white')[source]¶ Bases:
objectConvert knitting patterns to png files that only contain the color information and
(x, y)coordinates.Througout this class the term color refers to either
- a valid html5 color name such as
"black","white" - colors of the form
"#RGB","#RRGGBB"and"#RRRGGGBBB"
-
__init__(min_x, min_y, max_x, max_y, default_color='white')[source]¶ Initialize the builder with the bounding box and a default color.
min_x <= x < max_xandmin_y <= y < max_yare the bounds of the instructions. Instructions outside the bounds are not rendered. Any Pixel that is not set has thedefault_color.Parameters:
-
__weakref__¶ list of weak references to the object (if defined)
-
default_color¶ Returns: the color of the pixels that are not set You can set this color by passing it to the
constructor.
-
set_color_in_grid(color_in_grid)[source]¶ Set the pixel at the position of the
color_in_gridto its color.Parameters: color_in_grid¶ – must have the following attributes:
coloris the color to set the pixel toxis the x position of the pixelyis the y position of the pixel
See also
-
set_colors_in_grid(some_colors_in_grid)[source]¶ Same as
set_color_in_grid()but with a collection of colors in grid.Parameters: some_colors_in_grid¶ (iterable) – a collection of colors in grid for set_color_in_grid()
- a valid html5 color name such as