sketchkit.image2sketch.pydiffvg package

Module contents

A lightweight subset of the pydiffvg API used by SwiftSketch.

This stub implements just enough functionality for generating SVG content from cubic Bézier control points. It is not a full replacement for the original library but provides a pure Python fallback that keeps the runtime self contained.

class sketchkit.image2sketch.pydiffvg.Path(num_control_points: 'torch.Tensor', points: 'torch.Tensor', stroke_width: 'torch.Tensor', is_closed: 'bool')[source]

Bases: object

is_closed: bool
num_control_points: Tensor
points: Tensor
stroke_width: Tensor
class sketchkit.image2sketch.pydiffvg.RenderFunction[source]

Bases: object

static apply(width: int, height: int, samples_x: int, samples_y: int, seed: int, background, *scene_args)[source]
static serialize_scene(width: int, height: int, shapes: Sequence[Path], shape_groups: Sequence[ShapeGroup])[source]
class sketchkit.image2sketch.pydiffvg.ShapeGroup(shape_ids: 'torch.Tensor', fill_color: 'torch.Tensor | None', stroke_color: 'torch.Tensor')[source]

Bases: object

fill_color: Tensor | None
shape_ids: Tensor
stroke_color: Tensor
sketchkit.image2sketch.pydiffvg._build_svg(width: int, height: int, shapes: Sequence[Path], shape_groups: Sequence[ShapeGroup]) str[source]
sketchkit.image2sketch.pydiffvg._rgba_to_hex(color: Tensor) str[source]
sketchkit.image2sketch.pydiffvg.save_svg(path: str, width: int, height: int, shapes: Sequence[Path], shape_groups: Sequence[ShapeGroup]) None[source]