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

Animated GIF sink for cellular-automata trajectories. More...

#include <algorithm>
#include <concepts>
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <limits>
#include <ostream>
#include <string>
#include <utility>
#include <ah-errors.H>
#include <tpl_array.H>
#include <ca-io.H>
#include <tpl_ca_concepts.H>
Include dependency graph for ca-gif.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::CA::GIF_Write_Options
 Options for animated GIF output. More...
 
struct  Aleph::CA::ca_gif_detail::Frame
 
class  Aleph::CA::ca_gif_detail::Bit_Writer
 
class  Aleph::CA::Gif_Frame_Sink< Mapper >
 Sink that buffers frames and writes an animated GIF on flush. More...
 

Namespaces

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

Functions

void Aleph::CA::ca_gif_detail::put_le16 (std::ostream &out, const std::uint16_t value)
 
std::uint32_t Aleph::CA::ca_gif_detail::dist2 (const RGB8 a, const RGB8 b) noexcept
 
std::uint8_t Aleph::CA::ca_gif_detail::palette_index (Array< RGB8 > &palette, const RGB8 c)
 
std::uint8_t Aleph::CA::ca_gif_detail::lookup_palette_index (const Array< RGB8 > &palette, const RGB8 c) noexcept
 Read-only lookup variant: assumes the palette is already finalised (every colour either present or to be approximated by nearest match) and never mutates it.
 
unsigned Aleph::CA::ca_gif_detail::ceil_log2 (std::size_t n)
 
Array< std::uint8_t > Aleph::CA::ca_gif_detail::lzw_bytes (const Array< std::uint8_t > &indices, const unsigned min_code_size)
 
void Aleph::CA::ca_gif_detail::write_subblocks (std::ostream &out, const Array< std::uint8_t > &bytes)
 
Array< RGB8 > Aleph::CA::ca_gif_detail::build_palette (const Array< Frame > &frames)
 
void Aleph::CA::write_gif (std::ostream &out, const Array< ca_gif_detail::Frame > &frames, const GIF_Write_Options &opts={})
 Write a sequence of RGB frames as an animated GIF.
 
template<typename Mapper >
 Aleph::CA::Gif_Frame_Sink (std::filesystem::path, Mapper, GIF_Write_Options={}) -> Gif_Frame_Sink< Mapper >
 

Detailed Description

Animated GIF sink for cellular-automata trajectories.

The implementation is self-contained: frames are quantised to a global palette of at most 256 colours and encoded with baseline GIF LZW codes. This keeps the backend header-only and dependency-free.

Author
Leandro Rabindranath Leon

Definition in file ca-gif.H.