ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
util/image.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <stddef.h>
13#include <stdint.h>
14#include "asciichat_errno.h"
15
26asciichat_error_t image_calc_pixel_count(size_t width, size_t height, size_t *out_pixel_count);
27
38asciichat_error_t image_calc_pixel_buffer_size(size_t pixel_count, size_t bytes_per_pixel, size_t *out_size);
39
50asciichat_error_t image_calc_rgb_size(size_t width, size_t height, size_t *out_size);
51
64asciichat_error_t image_calc_total_allocation(size_t width, size_t height, size_t struct_size, size_t bytes_per_pixel,
65 size_t *out_size);
66
78asciichat_error_t image_validate_dimensions(size_t width, size_t height);
79
⚠️‼️ Error and/or exit() when things go bad.
asciichat_error_t
Error and exit codes - unified status values (0-255)
Definition error_codes.h:46
asciichat_error_t image_validate_buffer_size(size_t requested_size)
Validate buffer size against maximum allocation limit.
Definition util/image.c:115
asciichat_error_t image_validate_dimensions(size_t width, size_t height)
Validate image dimensions (non-zero, within limits)
Definition util/image.c:100
asciichat_error_t image_calc_pixel_buffer_size(size_t pixel_count, size_t bytes_per_pixel, size_t *out_size)
Calculate pixel buffer size with overflow checking.
Definition util/image.c:31
asciichat_error_t image_calc_pixel_count(size_t width, size_t height, size_t *out_pixel_count)
Calculate pixel count with overflow checking.
Definition util/image.c:12
asciichat_error_t image_calc_rgb_size(size_t width, size_t height, size_t *out_size)
Calculate total RGB buffer size from dimensions.
Definition util/image.c:54
asciichat_error_t image_calc_total_allocation(size_t width, size_t height, size_t struct_size, size_t bytes_per_pixel, size_t *out_size)
Calculate combined size of image struct + pixel buffer.
Definition util/image.c:70