ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
image.h File Reference

Go to the source code of this file.

Data Structures

struct  rgb_pixel_t
struct  rgb_pixel_simd_t
 rgb pixel is intentionally a small, concrete record. Fields such as r, g, b give callers the identity and current value they need. It is normally borrowed from, or owned by, the surrounding subsystem—not independently managed. More...
struct  image_t
 SIMD-friendly storage for one RGB pixel. r, g, and b hold the color channels and padding keeps the layout aligned for vector loads; it is normally embedded in renderer buffers, not individually allocated. More...

Macros

#define IMAGE_MAX_WIDTH   3840
 An owned RGB image with dimensions and row-major pixel storage.
#define IMAGE_MAX_HEIGHT   2160
 Maximum image height (4K resolution).
#define IMAGE_MAX_PIXELS_SIZE   (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT * sizeof(rgb_pixel_t))
 Maximum pixel data size in bytes.

Functions

image_t * image_new (size_t width, size_t height)
 Create a new image with standard allocation.
void image_destroy (image_t *p)
 Destroy an image allocated with image_new().
void image_clear (image_t *p)
 Clear image (set all pixels to black).
image_t * image_new_copy (const image_t *source)
 Create a copy of an existing image.
char * image_print (const image_t *p, const char *palette)
 Print image as ASCII art (monochrome).
char * image_print_color (const image_t *p, const char *palette)
 Print image as ASCII art with color.
char * image_print_with_capabilities (const image_t *image, const terminal_capabilities_t *caps, const char *palette)
 Convert image to ASCII art with terminal capabilities.
char * image_print_256color (const image_t *image, const char *palette)
 Print image using 256-color ANSI mode.
char * image_print_16color (const image_t *image, const char *palette)
 Print image using 16-color ANSI mode.
char * image_print_16color_dithered (const image_t *image, const char *palette)
 Print image using 16-color ANSI mode with dithering.
char * image_print_16color_dithered_with_background (const image_t *image, bool use_background, const char *palette)
 Print image using 16-color ANSI mode with dithering and background colors.
void quantize_color (int *r, int *g, int *b, int levels)
 Quantize color to specified number of levels.
void precalc_rgb_palettes (const float red, const float green, const float blue)
 Precalculate RGB palettes with color adjustment.
void image_resize (const image_t *source, image_t *dest)
 Resize image using nearest-neighbor interpolation.
void image_resize_interpolation (const image_t *source, image_t *dest)
 Resize image using bilinear interpolation.
char * rgb_to_ansi_fg (int r, int g, int b)
 Convert RGB to ANSI foreground color code.
char * rgb_to_ansi_bg (int r, int g, int b)
 Convert RGB to ANSI background color code.
void rgb_to_ansi_8bit (int r, int g, int b, int *fg_code, int *bg_code)
 Convert RGB to 8-bit ANSI color codes.