@@ -20,12 +20,12 @@ print("Hello", "World", 42); // Output: Hello World 42
2020var data = dict({{"name", "Alice"}, {"age", 30}});
2121pprint(data); // Formatted output with indentation
2222
23- // Render media file with Draw tag
24- print(Draw , "photo.png"); // Renders image as braille
25- print(Draw , "video.mp4"); // Plays video in terminal
23+ // Render media file with Media tag
24+ print(Media , "photo.png"); // Renders image as braille
25+ print(Media , "video.mp4"); // Plays video in terminal
2626
2727// Render with RenderConfig
28- print(Draw , "photo.png", RenderConfig().set_mode(Mode::colored).set_max_width(120));
28+ print(Media , "photo.png", RenderConfig().set_mode(Mode::colored).set_max_width(120));
2929```
3030
3131---
@@ -48,27 +48,27 @@ pprint(nested); // Formatted output
4848
4949---
5050
51- ## Media Printing (Draw Tag)
51+ ## Media Printing (Media Tag)
5252
53- Use ` Draw ` tag to explicitly render media files:
53+ Use ` Media ` tag to explicitly render media files:
5454
55- | Function | Description |
56- | ------------------------------- | ---------------------------------- |
57- | ` print(Draw , filepath) ` | Render media with default settings |
58- | ` print(Draw , filepath, config) ` | Render media with RenderConfig |
55+ | Function | Description |
56+ | -------------------------------- | ---------------------------------- |
57+ | ` print(Media , filepath) ` | Render media with default settings |
58+ | ` print(Media , filepath, config) ` | Render media with RenderConfig |
5959
6060``` cpp
6161// Render image
62- print (Draw , "photo.png");
62+ print (Media , "photo.png");
6363
6464// Render video with audio
65- print(Draw , "video.mp4", RenderConfig().with_audio());
65+ print(Media , "video.mp4", RenderConfig().with_audio());
6666
6767// Render with colored mode
68- print(Draw , "image.jpg", RenderConfig().set_mode(Mode::colored));
68+ print(Media , "image.jpg", RenderConfig().set_mode(Mode::colored));
6969
7070// Render with all options
71- print(Draw , "video.mp4", RenderConfig()
71+ print(Media , "video.mp4", RenderConfig()
7272 .set_mode(Mode::colored_dot)
7373 .set_max_width(120)
7474 .with_audio()
@@ -77,6 +77,68 @@ print(Draw, "video.mp4", RenderConfig()
7777
7878---
7979
80+ ## Text-to-Braille Art (TextArt Tag)
81+
82+ Use `TextArt` tag to render text as braille art:
83+
84+ | Function | Description |
85+ | ------------------------------ | --------------------------------- |
86+ | `print(TextArt, text)` | Render text with default settings |
87+ | `print(TextArt, text, config)` | Render text with TextConfig |
88+
89+ ### TextConfig
90+
91+ Configuration for text-to-braille rendering:
92+
93+ | Field | Type | Default | Description |
94+ | ----------- | --------- | -------------- | ------------------------ |
95+ | `mode` | `Mode` | `Mode::bw_dot` | Rendering mode |
96+ | `fg_r` | `uint8_t` | `255` | Foreground red (0-255) |
97+ | `fg_g` | `uint8_t` | `255` | Foreground green (0-255) |
98+ | `fg_b` | `uint8_t` | `255` | Foreground blue (0-255) |
99+ | `max_width` | `int` | `0` | Max width (0=auto) |
100+
101+ ### Examples
102+
103+ ```cpp
104+ // Basic text rendering
105+ print(TextArt, "Hello World!");
106+
107+ // Multi-line text
108+ print(TextArt, "Line 1\nLine 2\nLine 3");
109+
110+ // Colored text (white)
111+ print(TextArt, "COLORED!", TextConfig{.mode = Mode::colored});
112+
113+ // Custom color - red
114+ print(TextArt, "RED TEXT", TextConfig{
115+ .mode = Mode::colored,
116+ .fg_r = 255,
117+ .fg_g = 0,
118+ .fg_b = 0
119+ });
120+
121+ // Cyan text
122+ print(TextArt, "CYAN!", TextConfig{
123+ .mode = Mode::colored,
124+ .fg_r = 0,
125+ .fg_g = 255,
126+ .fg_b = 255
127+ });
128+ ```
129+
130+ ### Supported Characters
131+
132+ The built-in 3×5 pixel font supports:
133+
134+ - Uppercase letters: A-Z
135+ - Lowercase letters: a-z
136+ - Numbers: 0-9
137+ - Symbols: ` ! " ' ( ) + , - . / : ; < = > ? @ `
138+ - Space character
139+
140+ ---
141+
80142## RenderConfig
81143
82144Configuration class for media rendering with builder pattern.
@@ -101,14 +163,17 @@ Configuration class for media rendering with builder pattern.
101163
102164## Mode Enum
103165
104- | Mode | Description | Resolution | Colors |
105- | --------------------- | --------------------- | ----------- | --------- |
106- | `Mode::bw_dot` | Braille patterns | 8× terminal | B&W |
107- | `Mode::bw` | Half-block characters | 2× terminal | B&W |
108- | `Mode::colored` | Half-block with color | 2× terminal | 24-bit |
109- | `Mode::colored_dot` | Braille with color | 8× terminal | 24-bit |
110- | `Mode::grayscale_dot` | Grayscale braille | 8× terminal | Grayscale |
111- | `Mode::flood_dot` | Flood-filled braille | 8× terminal | 24-bit |
166+ | Mode | Description | Resolution | Colors |
167+ | ------------------------- | ----------------------------------- | ----------- | --------- |
168+ | ` Mode::bw_dot ` | Braille patterns | 8× terminal | B&W |
169+ | ` Mode::bw ` | Half-block characters | 2× terminal | B&W |
170+ | ` Mode::colored ` | Half-block with color | 2× terminal | 24-bit |
171+ | ` Mode::colored_dot ` | Braille with color | 8× terminal | 24-bit |
172+ | ` Mode::grayscale_dot ` | Grayscale braille | 8× terminal | Grayscale |
173+ | ` Mode::bw_dithered ` | B&W braille with dithering | 8× terminal | B&W |
174+ | ` Mode::flood_dot ` | Flood-filled braille (grayscale) | 8× terminal | Grayscale |
175+ | ` Mode::flood_dot_colored ` | Flood-filled braille with color | 8× terminal | 24-bit |
176+ | ` Mode::colored_dithered ` | Colored braille with ordered dither | 8× terminal | 24-bit |
112177
113178---
114179
@@ -127,11 +192,27 @@ Configuration class for media rendering with builder pattern.
127192
128193## Dithering Enum
129194
130- | Dithering | Description |
131- | -------------------- | ------------------------------- |
132- | `Dithering::none` | No dithering (default) |
133- | `Dithering::ordered` | Ordered/Bayer dithering |
134- | `Dithering::floyd` | Floyd-Steinberg error diffusion |
195+ Controls dithering algorithm for ` Mode::bw_dithered ` and ` Mode::colored_dithered ` :
196+
197+ | Dithering | Description | Best For |
198+ | ---------------------------- | --------------------------------- | ------------------ |
199+ | ` Dithering::none ` | Simple threshold (no dithering) | Fast binary output |
200+ | ` Dithering::ordered ` | Ordered/Bayer dithering (default) | Video, animation |
201+ | ` Dithering::floyd_steinberg ` | Floyd-Steinberg error diffusion | Still images |
202+
203+ ** Usage example:**
204+
205+ ``` cpp
206+ // Use Floyd-Steinberg for best still image quality
207+ print (Media, "photo.png", RenderConfig()
208+ .set_mode(Mode::bw_dithered)
209+ .set_dithering(Dithering::floyd_steinberg));
210+
211+ // Use ordered dithering for video (faster, more stable)
212+ print(Media, "video.mp4", RenderConfig()
213+ .set_mode(Mode::colored_dithered)
214+ .set_dithering(Dithering::ordered));
215+ ```
135216
136217---
137218
@@ -141,13 +222,13 @@ Configuration class for media rendering with builder pattern.
141222
142223```cpp
143224// Basic image render
144- print(Draw , "photo.png");
225+ print(Media , "photo.png");
145226
146227// Colored rendering
147- print(Draw , "photo.png", RenderConfig().set_mode(Mode::colored));
228+ print(Media , "photo.png", RenderConfig().set_mode(Mode::colored));
148229
149230// High-quality with dithering
150- print(Draw , "photo.jpg", RenderConfig()
231+ print(Media , "photo.jpg", RenderConfig()
151232 .set_mode(Mode::grayscale_dot)
152233 .set_dithering(Dithering::floyd)
153234 .set_max_width(160));
@@ -157,21 +238,21 @@ print(Draw, "photo.jpg", RenderConfig()
157238
158239``` cpp
159240// Basic video
160- print (Draw , "video.mp4");
241+ print (Media , "video.mp4");
161242
162243// Video with audio
163- print(Draw , "video.mp4", RenderConfig().with_audio());
244+ print(Media , "video.mp4", RenderConfig().with_audio());
164245
165246// Interactive with controls
166- print(Draw , "movie.mp4", RenderConfig()
247+ print(Media , "movie.mp4", RenderConfig()
167248 .set_mode(Mode::colored)
168249 .with_audio()
169250 .interactive()
170251 .set_pause_key('p')
171252 .set_stop_key('s'));
172253
173254// Play video segment (1:00 to 2:00)
174- print(Draw , "movie.mp4", RenderConfig()
255+ print(Media , "movie.mp4", RenderConfig()
175256 .set_start_time(60)
176257 .set_end_time(120));
177258```
@@ -180,10 +261,10 @@ print(Draw, "movie.mp4", RenderConfig()
180261
181262```cpp
182263// Default webcam
183- print(Draw , "0", RenderConfig().set_type(Type::webcam));
264+ print(Media , "0", RenderConfig().set_type(Type::webcam));
184265
185266// Colored webcam
186- print(Draw , "0", RenderConfig()
267+ print(Media , "0", RenderConfig()
187268 .set_type(Type::webcam)
188269 .set_mode(Mode::colored)
189270 .set_max_width(120));
0 commit comments