Polygon

class img_gen.Polygon(color: ColorKind, border: Border | None = None, sides: PolygonSides = PolygonSides.regular(3), rotation: float = 0.0)

An attribute to represent a [Polygon] rendered in the layer.

as_json_str()

Serialize the Polygon object to a JSON string.

as_yaml_str()

Serialize the Polygon object to a YAML string.

border

The border (if specified) ro render around the polygon.

color

The color used to fill the polygon.

static from_json_str(json_str)

Deserialize a Polygon object from a JSON string.

static from_yaml_str(yaml_str)

Deserialize a Polygon object from a YAML string.

rotation

The rotation applied to the rendered polygon.

Does not affect PolygonSides.Irregular.

sides

The polygon side definition.

Regular polygons use a side count, while irregular polygons use explicit vertex offsets.