1 2 #ifndef IIVIEW_MODULES_INCLUDED 3 #define IIVIEW_MODULES_INCLUDED 4 5 /* 6 7 modules.h 8 9 10 Infos: see modules.c 11 */ 12 13 /* 14 Small explanation of the module structure: 15 16 extension_count - number of file extensions which will be used 17 to identify an image to be in this module 18 extension - pointer to a list with extensions which will be used 19 to identify an image to be in this module (please 20 don't use same extensions for different modules!) 21 open - opens the image file and reads in all data, so 22 the methods getpixel, getwidth and getheight will 23 become accessible 24 close - closes the image file and frees all space used by 25 the module 26 getpixel - returns the RGB pixel value at specified position 27 in the image parameters are x,y and a boolean value 28 which requests a color-mode (1=color 2=b&w) 29 getwidth - width of the image 30 getheight - height of the image 31 getfilelist - gets the list of files and directories INSIDE THE 32 IMAGE (!); returns the number of entries; 33 don't forget to insert a '..' directory, so 34 we can browse the directories to the top 35 setdirectory - will set the directory INSIDE THE IMAGE; 36 returns 0, if the specified directory is a file or 37 the specified directory is NULL and the file doesn't 38 have internal directory structures 39 returns 1, if the directory could be set successfully 40 */ 41 42 #define UNUSED(p) (void)(p) 43 #define MODULES_COUNT 5 44 45 typedef struct { 46 int extension_count; 47 const char **extension; 48 int (*open)(const char *,const char *, unsigned int, unsigned int); 49 void (*close)(void); 50 unsigned int (*getpixel)(int,int,int); 51 int (*getwidth)(void); 52 int (*getheight)(void); 53 54 /* directory handler routines */ 55 int (*getfilelist)(const char *,const char *); 56 int (*setdirectory)(const char *,const char *); 57 58 } module_type; 59 60 extern module_type module[MODULES_COUNT]; 61 62 void modules_init(void); 63 int modules_knownextension(const char *); 64 int modules_extensionindex(const char *); 65 66 #endif 67 68