ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
image.c File Reference

Go to the source code of this file.

Functions

asciichat_error_t image_render_test_pattern (image_t *image, unsigned int *frame_counter)
 Render animated color bars and grid lines into an existing image.
 
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()
 
image_t * image_new_from_pool (size_t width, size_t height)
 Create a new image from buffer pool.
 
void image_destroy_to_pool (image_t *image)
 Destroy an image allocated from buffer pool.
 
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.
 
rgb_pixel_t * image_pixel (image_t *p, const int x, const int y)
 
void image_resize (const image_t *s, image_t *d)
 Resize image using nearest-neighbor interpolation.
 
void image_resize_interpolation (const image_t *source, image_t *dest)
 Resize image using bilinear interpolation.
 
void precalc_rgb_palettes (const float red, const float green, const float blue)
 Precalculate RGB palettes with color adjustment.
 

Function Documentation

◆ image_pixel()

rgb_pixel_t * image_pixel ( image_t *  p,
const int  x,
const int  y 
)
inline

Definition at line 301 of file video/rgba/image.c.

301 {
302 // Add bounds checking to prevent buffer overflow on invalid coordinates
303 if (!p || !p->pixels || x < 0 || x >= p->w || y < 0 || y >= p->h) {
304 return NULL;
305 }
306 return &p->pixels[x + y * p->w];
307}
int w
Image width in pixels (must be > 0)
int h
Image height in pixels (must be > 0)
rgb_pixel_t * pixels
Pixel data array (width * height RGB pixels, row-major order)

References image_t::h, image_t::pixels, and image_t::w.