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.c File Reference

Go to the source code of this file.

Functions

image_t * image_new (size_t width, size_t height)
 Create a new image with standard allocation.
void image_destroy (image_t *image)
 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.
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 105 of file video/rgba/image.c.

105 {
106 // Add bounds checking to prevent buffer overflow on invalid coordinates
107 if (!p || !p->pixels || x < 0 || x >= p->w || y < 0 || y >= p->h) {
108 return NULL;
109 }
110 return &p->pixels[x + y * p->w];
111}
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.