1 /* 2 * image.h 3 * 4 * Written by: Ullrich Hafner 5 * 6 * This file is part of FIASCO (Fractal Image And Sequence COdec) 7 * Copyright (C) 1994-2000 Ullrich Hafner 8 */ 9 10 /* 11 * $Date: 2000/10/22 10:43:56 $ 12 * $Author: hafner $ 13 * $Revision: 5.3 $ 14 * $State: Exp $ 15 */ 16 17 #ifndef _IMAGE_H 18 #define _IMAGE_H 19 20 #include <stdio.h> 21 #include "types.h" 22 #include "fiasco.h" 23 #include "pnm.h" 24 25 typedef enum {FORMAT_4_4_4, FORMAT_4_2_0} format_e; 26 27 typedef struct image 28 /* 29 * Image data 30 */ 31 { 32 char id [8]; /* NUL-terminated "IFIASCO" */ 33 unsigned reference_count; 34 unsigned width; /* Width of the image */ 35 unsigned height; /* Height of the image */ 36 bool_t color; /* Color or grayscale image */ 37 format_e format; /* Pixel format 4:4:4 or 4:2:0 */ 38 word_t *pixels [3]; /* Pixels in short format */ 39 } image_t; 40 41 image_t * 42 cast_image (fiasco_image_t *image); 43 image_t * 44 alloc_image (unsigned width, unsigned height, bool_t color, format_e format); 45 image_t * 46 clone_image (image_t *image); 47 void 48 free_image (image_t *image); 49 FILE * 50 read_pnmheader (const char *image_name, unsigned *width, unsigned *height, 51 bool_t *color); 52 53 image_t * 54 read_image_stream(FILE * const ifP, 55 unsigned int const width, 56 unsigned int const height, 57 xelval const maxval, 58 int const format); 59 60 image_t * 61 read_image_file(const char * const filename); 62 63 void 64 write_image (const char *image_name, const image_t *image); 65 bool_t 66 same_image_type (const image_t *img1, const image_t *img2); 67 68 #endif /* not _IMAGE_H */ 69 70