sketchkit.renderer3d package

Submodules

sketchkit.renderer3d.cairo_renderer module

sketchkit.renderer3d.diffvg_renderer module

class sketchkit.renderer3d.diffvg_renderer.DiffVGRenderOptions(canvas_size: tuple[int, int] = (512, 512), background_color: tuple[int, int, int] = (255, 255, 255), stroke_color: tuple[int, int, int] | None = None, stroke_width: float | None = None, device: str = 'cpu')[source]

Bases: Render3DOptions

device: str = 'cpu'
class sketchkit.renderer3d.diffvg_renderer.DiffVGRenderer(render_options: DiffVGRenderOptions | None = None)[source]

Bases: Renderer3D

Project and render 3D sketch curves with selectable renderer backend.

_abc_impl = <_abc._abc_data object>
static _diffvg_color(colors: ndarray | None, idx: int) Tensor[source]
_render_batch(sketch3d: Sketch3D, cameras: list[Camera], options: DiffVGRenderOptions) list[Image][source]

Render each camera view to a PIL image using the configured backend.

_render_view_diffvg(projected: ndarray, colors: ndarray | None, stroke_width: float | ndarray, background_color: tuple[int, int, int] = (255, 255, 255), seed: int = 0) Image[source]

sketchkit.renderer3d.renderer3d module

class sketchkit.renderer3d.renderer3d.Render3DOptions(canvas_size: tuple[int, int] = (512, 512), background_color: tuple[int, int, int] = (255, 255, 255), stroke_color: tuple[int, int, int] | None = None, stroke_width: float | None = None)[source]

Bases: object

background_color: tuple[int, int, int] = (255, 255, 255)
canvas_size: tuple[int, int] = (512, 512)
stroke_color: tuple[int, int, int] | None = None
stroke_width: float | None = None
class sketchkit.renderer3d.renderer3d.Renderer3D[source]

Bases: ABC

_abc_impl = <_abc._abc_data object>
_get_sketch_colors(sketch: Sketch3D) ndarray | None[source]
_get_sketch_widths(sketch: Sketch3D) ndarray | None[source]
static _normalize_colors(colors: ndarray | Tensor | list | None) ndarray | None[source]
abstractmethod _render_batch(*args, **kwargs) list[Image][source]
_resolve_stroke_colors(sketch: Sketch3D, options: Render3DOptions, num_curves: int) ndarray[source]

Resolve stroke colors from options or sketch, returning normalized [0,1] float array.

_resolve_stroke_widths(sketch: Sketch3D, options: Render3DOptions, num_curves: int) ndarray | float[source]

Resolve stroke widths from options or sketch.

_sketch_from_projected(projected: ndarray, colors: ndarray | None, stroke_width: float | ndarray) Sketch[source]
project_curves_ndc(curves: Tensor, cameras: list[Camera] | Camera | None = None) Tensor[source]
render(sketch3d: Sketch3D, cameras: list[Camera], render_options: Render3DOptions | dict | None = None) list[Image][source]

Overridden render method to support both legacy batch rendering and new Renderer3D interface.

render_options = Render3DOptions(canvas_size=(512, 512), background_color=(255, 255, 255), stroke_color=None, stroke_width=None)

Module contents