Ratatouille v0.5.1 Ratatouille.Renderer behaviour View Source
Logic to render a view tree.
This API is still under development.
Link to this section Summary
Functions
Renders a view tree to canvas, given a canvas and a root element (an element
with the :view
tag).
Validates the hierarchy of a view tree given the root element.
Link to this section Types
Link to this type
child_tag()
View Sourcechild_tag() :: :bar | :chart | :column | :label | :overlay | :panel | :row | :sparkline | :table | :table_cell | :table_row | :text | :tree | :tree_node
Link to this type
root_element()
View Sourceroot_element() :: %Ratatouille.Renderer.Element{ attributes: term(), children: [child_element()], tag: :view }
Link to this section Functions
Link to this function
render(canvas, root)
View Sourcerender(Ratatouille.Renderer.Canvas.t(), root_element()) :: {:ok, Ratatouille.Renderer.Canvas.t()} | {:error, term()}
Renders a view tree to canvas, given a canvas and a root element (an element
with the :view
tag).
The tree is rendered by recursively rendering each element in the hierarchy. The canvas serves as both the accumulator for rendered cells at each stage and as the box representing available space for rendering, which shrinks as this space is consumed.
Link to this function
render_tree(canvas, elements)
View Sourcerender_tree( Ratatouille.Renderer.Canvas.t(), Ratatouille.Renderer.Element.t() | [Ratatouille.Renderer.Element.t()] ) :: Ratatouille.Renderer.Canvas.t()
Link to this function
validate_tree(element)
View Sourcevalidate_tree(Ratatouille.Renderer.Element.t()) :: :ok | {:error, String.t()}
Validates the hierarchy of a view tree given the root element.
Used by the render/2 function to prevent strange errors that may otherwise occur when processing invalid view trees.
Link to this section Callbacks
Link to this callback
render(arg1, arg2, function)
View Sourcerender( Ratatouille.Renderer.Canvas.t(), Ratatouille.Renderer.Element.t(), (Ratatouille.Renderer.Canvas.t(), Ratatouille.Renderer.Element.t() -> Ratatouille.Renderer.Canvas.t()) ) :: Ratatouille.Renderer.Canvas.t()