Skip to contents

Base class that defines the rendering interface. All backends (ragg, SVG, grid) must implement these methods. Handles coordinate system setup, camera integration, and mobject dispatch.

Public fields

width

Canvas width in pixels

height

Canvas height in pixels

background_color

Background color

camera

Camera object for coordinate transforms

backend_name

Name of this backend

Methods


Method new()

Initialize renderer

Usage

AbstractRenderer$new(
  width = 1280,
  height = 720,
  background_color = "#000000",
  camera = NULL
)

Arguments

width

Width in pixels

height

Height in pixels

background_color

Background color

camera

Optional Camera object


Method begin_frame()

Begin a new frame (open device/canvas)

Usage

AbstractRenderer$begin_frame(output_path = NULL)

Arguments

output_path

Path to save the frame


Method end_frame()

End the current frame (close device/finalize)

Usage

AbstractRenderer$end_frame()


Method draw_path()

Draw a filled + stroked polygon path

Usage

AbstractRenderer$draw_path(
  x,
  y,
  fill_color = NULL,
  fill_opacity = 0,
  stroke_color = "#FFFFFF",
  stroke_opacity = 1,
  stroke_width = 2
)

Arguments

x

X coordinates

y

Y coordinates

fill_color

Fill color (NULL = no fill)

fill_opacity

Fill opacity

stroke_color

Stroke color

stroke_opacity

Stroke opacity

stroke_width

Stroke width


Method draw_text()

Draw text at a position

Usage

AbstractRenderer$draw_text(
  text,
  x,
  y,
  color = "#FFFFFF",
  font_size = 24,
  font_family = "sans",
  opacity = 1
)

Arguments

text

Text string

x

X coordinate

y

Y coordinate

color

Text color

font_size

Font size

font_family

Font family

opacity

Opacity


Method draw_raster()

Draw a raster image

Usage

AbstractRenderer$draw_raster(raster, xleft, ybottom, xright, ytop, opacity = 1)

Arguments

raster

Raster data

xleft

Left x

ybottom

Bottom y

xright

Right x

ytop

Top y

opacity

Opacity


Method render_frame()

Render a complete frame with all mobjects

Usage

AbstractRenderer$render_frame(scene, time, output_path)

Arguments

scene

Scene object

time

Current time

output_path

Output file path


Method render_mobjects()

Render live mobjects (for Manim-style play())

Usage

AbstractRenderer$render_mobjects(mobjects, output_path = NULL)

Arguments

mobjects

List of MObject instances

output_path

Output file path


Method draw_state()

Draw a state dict (from get_object_states_at_time)

Usage

AbstractRenderer$draw_state(state)

Arguments

state

Object state list


Method draw_mobject()

Draw a live MObject

Usage

AbstractRenderer$draw_mobject(mob)

Arguments

mob

An MObject instance


Method draw_vmobject_live()

Draw a live VMobject (recursive with submobjects)

Usage

AbstractRenderer$draw_vmobject_live(mob)

Arguments

mob

VMobject instance


Method draw_vmobject_state()

Draw VMobject from state dict

Usage

AbstractRenderer$draw_vmobject_state(state)

Arguments

state

State list


Method draw_text_state()

Draw text from state dict

Usage

AbstractRenderer$draw_text_state(state)

Arguments

state

State list


Method draw_latex_state()

Draw LaTeX from state dict

Usage

AbstractRenderer$draw_latex_state(state)

Arguments

state

State list


Method draw_shape_state()

Draw shape from state dict (legacy)

Usage

AbstractRenderer$draw_shape_state(state)

Arguments

state

State list


Method draw_image_state()

Draw image from state dict

Usage

AbstractRenderer$draw_image_state(state)

Arguments

state

State list


Method clone()

The objects of this class are cloneable with this method.

Usage

AbstractRenderer$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.