From 5607384617b5e3372f7e33020ebf6136612494b6 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 22 May 2008 13:45:04 +0000 Subject: [PATCH] stuff --- TODO | 38 +++++++++++++++++++++++++------------- include/vips/dispatch.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/TODO b/TODO index f49940a8..52975e92 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,28 @@ +- pluggable formats + + for each format, store: + + - format name , same as mime + "jpeg" + - priority ... keep formats sorted by this, magick is low (-1000?) + int priority = 0; + - i18n'd name for users to see + "JPEG" + - allowed suffixes + const char *tiff_suffs[] = { ".tif", ".tiff", NULL }; + - predicate (embedded options remove from filename) + gboolean (*is_a)(const char *filename) + - load header only + int (*header)(const char *filename, IMAGE *) + - load image + int (*load)(const char *filename, IMAGE *) + - save image + int (*save)(IMAGE *, const char *filename) + + can we have the vips loader as part of this? + + need to + - try libsrc/convolution$ grep -l offsets *.c @@ -5,19 +30,6 @@ could we do the don't calc offsets thing unless bpl; changes thing in more places? -- should check for gettext in configure? see - -https://sourceforge.net/tracker/index.php?func=detail&aid=1836080&group_id=100050&atid=626186 - - - hmm, not clear, we are using - - AM_GLIB_GNU_GETTEXT - - already, isn't that enough? - - do we need AM_GNU_GETTEXT too? check the gnome i18n howto - - docs include figures twice! yuk fixed? not sure, check again diff --git a/include/vips/dispatch.h b/include/vips/dispatch.h index 98971595..ca91bf47 100644 --- a/include/vips/dispatch.h +++ b/include/vips/dispatch.h @@ -143,6 +143,34 @@ typedef struct { im_function **table; /* Array of function descriptors */ } im_package; +/* Function protos for formats. + */ +typedef gboolean (*im_format_is_a)( const char * ); +typedef int (*im_format_header)( const char *, IMAGE * ); +typedef int (*im_format_load)( const char *, IMAGE * ); +typedef int (*im_forrmat_save)( IMAGE *, const char * ); + +/* A VIPS image format. + */ +typedef struct { + const char *name; /* Format name, same as mime */ + const char *name_user; /* I18n'd name for users */ + int priority; /* Keep formats sorted by this, default 0 */ + const char *suffs[]; /* Allowed suffixes */ + im_format_is_a is_a; /* Filename is in format */ + im_format_header header;/* Load header only from filename */ + im_format_load load; /* Load image from filename */ + im_format_save save; /* Save image to filename */ +} im_format; + +/* A set of VIPS formats forming a format package. + */ +typedef struct { + char *name; /* Package name (eg "magick") */ + int nfuncs; /* Number of formats in package */ + im_format **table; /* Array of formats */ +} im_format_package; + /* Externs for dispatch. */