Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
TerminalImageViewer.h File Reference
#include <cstddef>
#include <cstdint>
#include <ostream>
#include <span>
#include <vector>
#include "donner/css/Color.h"
Include dependency graph for TerminalImageViewer.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::svg::TerminalCapabilities
 Terminal detection results derived from environment probing. More...
struct  donner::svg::TerminalSize
 Terminal size in columns and rows. More...
struct  donner::svg::TerminalCellSize
 Terminal cell size in pixels. More...
struct  donner::svg::TerminalImageViewerConfig
 Rendering configuration for terminal output. More...
struct  donner::svg::TerminalImageView
 Image view describing an RGBA buffer. More...
struct  donner::svg::QuarterBlock
 Per-cell subpixel sampling for quarter-pixel mode. More...
struct  donner::svg::HalfBlock
 Per-cell subpixel sampling for half-pixel mode. More...
struct  donner::svg::TerminalCell
 Aggregated subpixel data for a terminal cell. More...
struct  donner::svg::TerminalImage
 Sampled representation of an image prepared for terminal rendering. More...
class  donner::svg::TerminalImageViewer
 Terminal image sampler for quarter- and half-pixel block glyphs. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.
namespace  donner::svg
 Donner SVG library, which can load, manipulate and render SVG files.

Enumerations

enum class  donner::svg::TerminalPixelMode {
  kQuarterPixel ,
  kHalfPixel
}
 Pixel granularity for terminal rendering.

Class Documentation

◆ donner::svg::TerminalCapabilities

struct donner::svg::TerminalCapabilities

Terminal detection results derived from environment probing.

Class Members
bool supportsITermInlineImages = false Terminal supports iTerm2 inline image protocol (iTerm2, VSCode, WezTerm, and others).
bool supportsTrueColor = false Terminal advertises 24-bit color support.

◆ donner::svg::TerminalSize

struct donner::svg::TerminalSize

Terminal size in columns and rows.

Class Members
int columns = 80 Terminal width in columns (default fallback).
int rows = 24 Terminal height in rows (default fallback).

◆ donner::svg::TerminalCellSize

struct donner::svg::TerminalCellSize

Terminal cell size in pixels.

Class Members
int heightPixels = 20 Cell height in pixels (default fallback).
int widthPixels = 10 Cell width in pixels (default fallback).

◆ donner::svg::TerminalImageViewerConfig

struct donner::svg::TerminalImageViewerConfig

Rendering configuration for terminal output.

Collaboration diagram for donner::svg::TerminalImageViewerConfig:
[legend]
Class Members
bool autoScale = false Automatically calculate scale based on terminal size. When true, the scale parameter is ignored and calculated dynamically.
bool enableITermInlineImages = false Use iTerm2 inline image protocol (supported by iTerm2, VSCode, WezTerm, and others).
string imageName Optional name for the image. When using iTerm inline images, this will be included in the protocol metadata. For text mode, this can be used as a caption.
int maxTerminalHeight = 80 Maximum terminal height to target when auto-scaling (rows).
int maxTerminalWidth = 200 Maximum terminal width to target when auto-scaling (columns).
TerminalPixelMode pixelMode = TerminalPixelMode::kQuarterPixel Pixel granularity.
double scale = 0.67 Overall scale factor for image size. Only used when autoScale=false.
bool useTrueColor = true Emit 24-bit ANSI sequences when true, fallback to 256-color when false.
double verticalScaleFactor = 0.5 Vertical scaling factor to compensate for terminal character aspect ratio (typically ~2:1 height/width). Default 0.5 accounts for typical terminal fonts.

◆ donner::svg::TerminalImageView

struct donner::svg::TerminalImageView

Image view describing an RGBA buffer.

Collaboration diagram for donner::svg::TerminalImageView:
[legend]
Class Members
span< const uint8_t > data Pixel data in RGBA order.
int height = 0 Height of the image in pixels.
size_t strideInPixels = 0 Number of pixels per row (not bytes).
int width = 0 Width of the image in pixels.

◆ donner::svg::QuarterBlock

struct donner::svg::QuarterBlock

Per-cell subpixel sampling for quarter-pixel mode.

Collaboration diagram for donner::svg::QuarterBlock:
[legend]
Class Members
RGBA bottomLeft
RGBA bottomRight
RGBA topLeft
RGBA topRight

◆ donner::svg::HalfBlock

struct donner::svg::HalfBlock

Per-cell subpixel sampling for half-pixel mode.

Collaboration diagram for donner::svg::HalfBlock:
[legend]
Class Members
RGBA lower
RGBA upper

◆ donner::svg::TerminalCell

struct donner::svg::TerminalCell

Aggregated subpixel data for a terminal cell.

Collaboration diagram for donner::svg::TerminalCell:
[legend]
Class Members
HalfBlock half
TerminalPixelMode mode
QuarterBlock quarter