Expand description
Layout-to-renderer pipe for Cotis.
cotis-pipes implements cotis::pipes::LayoutRenderPipe — the conversion layer between
cotis-layout output and
cotis-defaults render commands. Each frame,
layout produces a stream of RenderCommandOutput
values; this crate decodes them into a caller-chosen RenderTList
command stream for the renderer.
§Frame pipeline
cotis-layout → cotis-pipes → renderer
RenderCommandOutput RenderTList<…> CotisRenderer::drawCotisLayoutManagerruns layout and yieldsRenderCommandOutputper frame.CotisLayoutToRenderListPipeForGenericswalks yourRenderTListtype and emits draw commands (Rectangle,Text,Border,Image,ClipStart,ClipEnd, plus any custom types you register).- The renderer consumes the flattened
RenderTListstream.
When layout output already matches what the renderer expects, pass [()] as the identity
LayoutRenderPipe instead (see
CotisApp::new).
§Quick start
Define a RenderTList type
alias for your command stream, then wire the pipe into CotisApp:
use cotis::cotis_app::CotisApp;
use cotis_layout::preamble::CotisLayoutManager;
use cotis_pipes::cotis_layout_pipes::CotisLayoutToRenderListPipeForGenerics;
use cotis_defaults::render_commands::render_t_list::RenderTList;
use cotis_defaults::render_commands::{ClipStart, ClipEnd, Rectangle, Border, Text};
use cotis_utils::math::Dimensions;
type StandardRenderCmds = RenderTList<
ClipStart<'static, ()>,
RenderTList<
ClipEnd,
RenderTList<
Rectangle<'static, ()>,
RenderTList<Border<'static, ()>, RenderTList<Text<'static, ()>, ()>>,
>,
>,
>;
let dimensions = Dimensions::new(800.0, 600.0);
let manager = CotisLayoutManager::new(dimensions);
// let app = CotisApp::new(renderer, manager, CotisLayoutToRenderListPipeForGenerics);See cotis-layout examples
— especially support.rs for a complete StandardRenderCmds alias and
circle_example.rs for extending the pipeline with custom drawables.
§Extending with custom drawables
Append your type to the tail of a RenderTList and implement
FromRenderCommandOutput. Return Some(cmd)
to emit a draw command or None to skip. See
cotis_layout_pipes for decode rules and the extension model.
§Modules
cotis_layout_pipes— pipe implementation, decode traits, and built-in command decoders.
Modules§
- cotis_
layout_ pipes - Decodes
RenderCommandOutputintoRenderTListcommand streams.