Skip to main content

render_koi

Function render_koi 

Source
pub fn render_koi(
    koi_development: &KoiDevelopment,
    koi_body: KoiBody,
) -> KoiFrame
Expand description

Render the koi in a centered, fixed swimming pose, colored from its languages on the caller’s chosen body. Contribution totals set its size and how far its colors have come in. The account seed places patches in body coordinates, so growth does not reroll the pattern. Streak marks follow the development’s streaks as of its observation date. Identical inputs produce identical pixels without I/O, clock reads, or input mutation.

Examples found in repository?
examples/generate-library.rs (line 316)
308fn render_sample(
309    output_directory: &Path,
310    koi_development: &KoiDevelopment,
311    koi_body: KoiBody,
312    file_stem: &str,
313    heading: &str,
314    index_markdown: &mut String,
315) -> Result<KoiFrame, Box<dyn Error>> {
316    let koi_frame = render_koi(koi_development, koi_body);
317    let file_name = format!("{file_stem}.png");
318    write_artifact(output_directory, &file_name, &encode_png(&koi_frame)?)?;
319    let svg_name = format!("{file_stem}.svg");
320    write_artifact(
321        output_directory,
322        &svg_name,
323        encode_svg(&koi_frame).as_bytes(),
324    )?;
325    index_markdown.push_str(&format!(
326        "### {heading}\n\n![{file_stem}]({file_name})\n\n[SVG]({svg_name})\n\n"
327    ));
328    Ok(koi_frame)
329}