#ifndef PNM_IMAGE_H #define PNM_IMAGE_H /**************************************************************************** * Image structures */ typedef struct { int width,height; /* dimensions */ int stride; /* width of image in memory */ float *data; /* data in latin reading order */ } image_t; typedef struct { int width,height; /* here, stride = width */ float *c1; /* R */ float *c2; /* G */ float *c3; /* B */ } color_image_t; image_t *image_new(int width, int height); image_t *image_cpy(image_t *src); void image_delete(image_t *image); color_image_t *color_image_new(int width, int height); color_image_t *color_image_cpy(color_image_t *src); void color_image_delete(color_image_t *image); color_image_t *load_ppm(const char *fname); typedef enum { CHANNEL_R, CHANNEL_G, CHANNEL_B } ColorChannel; image_t *color_image_channel(const color_image_t *cim, ColorChannel channel); #endif