#ifndef EZ3D_IMAGE_H #define EZ3D_IMAGE_H #include "ez3d.h" /* A decoded image, normalized to separate gray and alpha planes. * alpha is always present as an array (255 everywhere when the source * PNG has no alpha channel); has_alpha records whether it really did. */ typedef struct { int w, h; unsigned char *gray; /* w*h luminance samples, 0..255 */ unsigned char *alpha; /* w*h coverage samples, 0..255 */ int has_alpha; } ez3d_image_t; void ez3d_free_image(ez3d_image_t *img); /* Load a PNG (any input format: gray, gray+alpha, RGB, RGBA, palette...) * and normalize it to 8-bit gray + alpha planes. Returns 0 on success, * nonzero with a message on stderr otherwise. */ int ez3d_load_image(const char *path, ez3d_image_t *img); #endif /* EZ3D_IMAGE_H */