ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
frame_buffer.h
Go to the documentation of this file.
1
22
23#pragma once
24
25#include <stdbool.h>
26#include <stddef.h>
27#include <stdint.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
37
48frame_buffer_t *frame_buffer_create(int rows, int cols);
49
56
66
76void frame_buffer_append(frame_buffer_t *buf, const char *str, size_t len);
77
87void frame_buffer_printf(frame_buffer_t *buf, const char *fmt, ...);
88
95
104
114
123size_t frame_buffer_get_length(const frame_buffer_t *buf);
124
134const char *frame_buffer_get_content(const frame_buffer_t *buf);
135
146 const char *color);
147
149void frame_buffer_render_divider(frame_buffer_t *buf, int width, bool use_utf8,
150 bool use_colors);
151
162int frame_buffer_render_centered(frame_buffer_t *buf, const char *text,
163 int cols);
164
176
183
184#ifdef __cplusplus
185}
186#endif
unsigned int width
Definition fft.c:24
void frame_buffer_append(frame_buffer_t *buf, const char *str, size_t len)
Append raw bytes to the buffer.
int frame_buffer_render_centered(frame_buffer_t *buf, const char *text, int cols)
Render centered text (used by both splash and status screens).
void frame_buffer_cursor_home(frame_buffer_t *buf)
Append cursor home escape code (\033[H).
void frame_buffer_set_screen_output_fd(int fd)
Set output file descriptor for terminal screen (splash/status) rendering.
void frame_buffer_reset(frame_buffer_t *buf)
Clear buffer contents while keeping allocation.
void frame_buffer_destroy(frame_buffer_t *buf)
Destroy a frame buffer.
void frame_buffer_flush(frame_buffer_t *buf)
Flush the entire buffer to stdout in one atomic write.
void frame_buffer_render_divider(frame_buffer_t *buf, int width, bool use_utf8, bool use_colors)
size_t frame_buffer_get_length(const frame_buffer_t *buf)
Get the current content length of the frame buffer.
const char * frame_buffer_get_content(const frame_buffer_t *buf)
Get a pointer to the buffer content.
frame_buffer_t * frame_buffer_create(int rows, int cols)
Create a new frame buffer.
void frame_buffer_printf(frame_buffer_t *buf, const char *fmt,...)
Printf-style append to the buffer.
int frame_buffer_get_screen_output_fd(void)
Get current output file descriptor for terminal screens.
void frame_buffer_render_border(frame_buffer_t *buf, int cols, const char *color)
Render a horizontal border line (used by both splash and status screens).
void frame_buffer_clear_screen(frame_buffer_t *buf)
Append clear screen and home escape codes (\033[2J\033[H).
struct frame_buffer frame_buffer_t
Opaque frame buffer handle.
Growable byte buffer for assembling one complete terminal frame.
size_t len
Current content length.