etui/widgets/scene

Types

pub type Scene {
  Scene(shapes: List(Shape), bg: style.Color)
}

Constructors

pub type SceneFill {
  SceneSolid(c: style.Color)
  SceneGradient(stops: List(style.Color))
  SceneRainbow
  SceneAnimatedRainbow
}

Constructors

pub type Shape {
  CircleOutline(cx: Int, cy: Int, r: Int, fill: SceneFill)
  Disc(cx: Int, cy: Int, r: Int, fill: SceneFill)
  Planet(
    cx: Int,
    cy: Int,
    orbit_r: Int,
    dot_r: Int,
    fill: SceneFill,
    period: Int,
  )
  Mandelbrot(max_iter: Int)
}

Constructors

  • CircleOutline(cx: Int, cy: Int, r: Int, fill: SceneFill)

    Circle outline at braille-pixel coords (cx, cy) with radius r.

  • Disc(cx: Int, cy: Int, r: Int, fill: SceneFill)

    Filled disc at braille-pixel coords (cx, cy) with radius r.

  • Planet(
      cx: Int,
      cy: Int,
      orbit_r: Int,
      dot_r: Int,
      fill: SceneFill,
      period: Int,
    )

    Planet: disc orbiting (cx, cy) at orbit_r, animated by frame/period.

  • Mandelbrot(max_iter: Int)

    Mandelbrot set (fills entire canvas area).

Values

pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  scene: Scene,
  frame: Int,
) -> buffer.Buffer

Render scene into area. frame drives animated shapes.

pub fn scene_new(shapes: List(Shape)) -> Scene
pub fn with_bg(s: Scene, bg: style.Color) -> Scene
Search Document