etui/widgets/canvas
Types
pub type Canvas {
Canvas(
series: List(Series),
max_val: Int,
bg: style.Color,
period: Int,
)
}
Constructors
-
Canvas( series: List(Series), max_val: Int, bg: style.Color, period: Int, )Arguments
- max_val
-
0 = auto-compute max from all series data.
- period
-
Animation period in frames.
pub type Series {
Series(data: List(Int), fill: SeriesFill)
}
Constructors
-
Series(data: List(Int), fill: SeriesFill)
pub type SeriesFill {
SeriesSolid(c: style.Color)
SeriesGradient(stops: List(style.Color))
SeriesRainbow
SeriesAnimatedRainbow
}
Constructors
-
SeriesSolid(c: style.Color)Single solid color for all dots.
-
SeriesGradient(stops: List(style.Color))Left-to-right gradient across the canvas width (in pixels).
-
SeriesRainbowPer-column rainbow, static.
-
SeriesAnimatedRainbowRainbow that rotates hue over time.
Values
pub fn render(
buf: buffer.Buffer,
area: geometry.Rect,
c: Canvas,
frame: Int,
) -> buffer.Buffer
Render canvas into area. frame drives animated fills.
pub fn series_new(data: List(Int)) -> Series
pub fn with_bg(c: Canvas, bg: style.Color) -> Canvas
pub fn with_series_fill(s: Series, fill: SeriesFill) -> Series