Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ca-svg.H File Reference

Native SVG renderer for rectangular, hexagonal and triangular CAs. More...

#include <array>
#include <cmath>
#include <concepts>
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <limits>
#include <ostream>
#include <sstream>
#include <string>
#include <utility>
#include <ah-errors.H>
#include <tpl_array.H>
#include <ca-frame-stream.H>
#include <ca-io.H>
#include <tpl_ca_concepts.H>
#include <tpl_ca_hex_lattice.H>
#include <tpl_ca_triangular_lattice.H>
Include dependency graph for ca-svg.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::CA::SVG_Render_Options
 SVG rendering options. More...
 
struct  Aleph::CA::ca_svg_detail::Bounds
 
class  Aleph::CA::Svg_Frame_Sink< Palette >
 Path-pattern sink that writes one SVG file per accepted frame. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::CA
 
namespace  Aleph::CA::ca_svg_detail
 

Functions

std::string Aleph::CA::ca_svg_detail::rgb_hex (const RGB8 c)
 
void Aleph::CA::ca_svg_detail::write_svg_header (std::ostream &out, const Bounds &b, const SVG_Render_Options &opts)
 
void Aleph::CA::ca_svg_detail::write_style (std::ostream &out, const SVG_Render_Options &opts)
 
void Aleph::CA::ca_svg_detail::write_points (std::ostream &out, const Array< std::array< double, 2 > > &pts)
 
Array< std::array< double, 2 > > Aleph::CA::ca_svg_detail::hex_points (Hex_Axial a, const double radius)
 
Array< std::array< double, 2 > > Aleph::CA::ca_svg_detail::tri_points (Tri_Coord c, const double side)
 
template<typename Lattice , typename Palette >
requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<RGB8>; }
void Aleph::CA::render_lattice_svg (std::ostream &out, const Lattice &frame, Palette &&palette, const SVG_Render_Options &opts={}, const typename Lattice::state_type &dead_state=typename Lattice::state_type{})
 Render a supported rank-2 CA frame as SVG.
 
template<typename Lattice >
void Aleph::CA::render_lattice_svg (std::ostream &out, const Lattice &frame, const SVG_Render_Options &opts={}, const typename Lattice::state_type &dead_state=typename Lattice::state_type{})
 Render a frame as SVG using the default binary RGB mapper.
 
template<typename Lattice , typename Palette >
requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<RGB8>; }
std::string Aleph::CA::render_lattice_svg_string (const Lattice &frame, Palette &&palette, const SVG_Render_Options &opts={}, const typename Lattice::state_type &dead_state=typename Lattice::state_type{})
 Return a frame rendered as SVG.
 
template<typename Palette >
 Aleph::CA::Svg_Frame_Sink (std::filesystem::path, Palette, SVG_Render_Options={}, std::size_t=6) -> Svg_Frame_Sink< Palette >
 

Detailed Description

Native SVG renderer for rectangular, hexagonal and triangular CAs.

The backend emits dependency-free SVG suitable for reports, web pages and golden visual tests. Rectangular frames use <rect> elements; hexagonal and triangular lattice wrappers use true polygon geometry instead of a bitmap approximation.

Author
Leandro Rabindranath Leon

Definition in file ca-svg.H.