Ratatouille v0.2.0 Ratatouille.Renderer 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_element() View Source
Link to this type
child_tag()
View Source
child_tag()
View Source
child_tag() ::
:bar
| :chart
| :column
| :label
| :panel
| :row
| :sparkline
| :table
| :table_cell
| :table_row
| :text
| :tree
| :tree_node
child_tag() :: :bar | :chart | :column | :label | :panel | :row | :sparkline | :table | :table_cell | :table_row | :text | :tree | :tree_node
Link to this type
root_element()
View Source
root_element()
View Source
root_element() :: %Ratatouille.Renderer.Element{
attributes: term(),
children: [child_element()],
tag: :view
}
root_element() :: %Ratatouille.Renderer.Element{ attributes: term(), children: [child_element()], tag: :view }
Link to this section Functions
Link to this function
render(canvas, root)
View Source
render(canvas, root)
View Source
render(Ratatouille.Renderer.Canvas.t(), root_element()) ::
{:ok, Ratatouille.Renderer.Canvas.t()} | {:error, term()}
render(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 Source
Link to this function
validate_tree(element) View Source
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.