stuff
This commit is contained in:
parent
624708dbdc
commit
096dee8327
8
TODO
8
TODO
@ -1,10 +1,10 @@
|
||||
- added protos to the end of image.h, need gtkdoc comments on them
|
||||
- im_close(), im_local() etc. need docs still
|
||||
|
||||
im_setbox.c -> deprecated, plus the associated struct
|
||||
- more stuff from util.c? too much to do it all now
|
||||
|
||||
im_open_local() -> image.h ? also _array()
|
||||
- im_prepare(), im_render()?
|
||||
|
||||
what else in util.h needs docs?
|
||||
- memory.c
|
||||
|
||||
- constant images:
|
||||
|
||||
|
@ -270,11 +270,70 @@ int im_version( int flag );
|
||||
const char *im_guess_prefix( const char *, const char * );
|
||||
const char *im_guess_libdir( const char *, const char * );
|
||||
|
||||
void im_progress_set( int progress );
|
||||
|
||||
VipsImage *im_open( const char *filename, const char *mode );
|
||||
int im_close( VipsImage *im );
|
||||
|
||||
void *im_local( IMAGE *im,
|
||||
im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c );
|
||||
int im_local_array( IMAGE *im, void **out, int n,
|
||||
im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c );
|
||||
|
||||
/**
|
||||
* im_open_local:
|
||||
* @IM: image to open local to
|
||||
* @NAME: filename to open
|
||||
* @MODE: mode to open with
|
||||
*
|
||||
* Just like im_open(), but the #IMAGE will be closed for you automatically
|
||||
* when @IM is closed.
|
||||
*
|
||||
* Returns: a new #IMAGE, or NULL on error
|
||||
*
|
||||
* See also: im_open(), im_close(), im_local().
|
||||
*/
|
||||
#define im_open_local( IM, NAME, MODE ) \
|
||||
((IMAGE *) im_local( (IM), \
|
||||
(im_construct_fn) im_open, (im_callback_fn) im_close, \
|
||||
(void *) (NAME), (void *) (MODE), NULL ))
|
||||
|
||||
|
||||
/**
|
||||
* im_open_local_array:
|
||||
* @IM: image to open local to
|
||||
* @OUT: array to fill with #IMAGE
|
||||
* @N: array size
|
||||
* @NAME: filename to open
|
||||
* @MODE: mode to open with
|
||||
*
|
||||
* Just like im_open(), but opens an array of images. Handy for creating a set
|
||||
* of temporary images for a function.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* |[
|
||||
* IMAGE *t[5];
|
||||
*
|
||||
* if( im_open_local_array( out, t, 5, "some-temps", "p" ) ||
|
||||
* im_add( a, b, t[0] ) ||
|
||||
* im_invert( t[0], t[1] ) ||
|
||||
* im_add( t[1], t[0], t[2] ) ||
|
||||
* im_costra( t[2], out ) )
|
||||
* return( -1 );
|
||||
* ]|
|
||||
*
|
||||
* Returns: 0 on sucess, or -1 on error
|
||||
*
|
||||
* See also: im_open(), im_open_local(), im_local_array().
|
||||
*/
|
||||
|
||||
/* Strange double cast stops bogus warnings from gcc 4.1
|
||||
*/
|
||||
|
||||
#define im_open_local_array( IM, OUT, N, NAME, MODE ) \
|
||||
(im_local_array( (IM), (void **)((void*)(OUT)), (N),\
|
||||
(im_construct_fn) im_open, (im_callback_fn) im_close, \
|
||||
(void *) (NAME), (void *) (MODE), NULL ))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
@ -165,20 +165,6 @@ extern "C" {
|
||||
|
||||
#define IM_CLIP_NONE( V, SEQ ) {}
|
||||
|
||||
/* Now implemented as macros.
|
||||
*/
|
||||
#define im_open_local( IM, NAME, MODE ) \
|
||||
((IMAGE *) im_local( (IM), \
|
||||
(im_construct_fn) im_open, (im_callback_fn) im_close, \
|
||||
(void *) (NAME), (void *) (MODE), NULL ))
|
||||
|
||||
/* Strange double cast stops bogus warnings from gcc 4.1
|
||||
*/
|
||||
#define im_open_local_array( IM, OUT, N, NAME, MODE ) \
|
||||
(im_local_array( (IM), (void **)((void*)(OUT)), (N),\
|
||||
(im_construct_fn) im_open, (im_callback_fn) im_close, \
|
||||
(void *) (NAME), (void *) (MODE), NULL ))
|
||||
|
||||
/* Basic function types.
|
||||
*/
|
||||
typedef void *(*im_construct_fn)( void *, void *, void * );
|
||||
@ -233,11 +219,6 @@ int im_filename_suffix_match( const char *path, const char *suffixes[] );
|
||||
char *im_getnextoption( char **in );
|
||||
char *im_getsuboption( const char *buf );
|
||||
|
||||
void *im_local( IMAGE *im,
|
||||
im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c );
|
||||
int im_local_array( IMAGE *im, void **out, int n,
|
||||
im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c );
|
||||
|
||||
gint64 im_file_length( int fd );
|
||||
int im__write( int fd, const void *buf, size_t count );
|
||||
|
||||
|
@ -354,7 +354,24 @@ guess_prefix( const char *argv0, const char *name )
|
||||
return( IM_PREFIX );
|
||||
}
|
||||
|
||||
/* Guess a value for the install PREFIX.
|
||||
/**
|
||||
* im_guess_prefix:
|
||||
* @argv0: program name (typically argv[0])
|
||||
* @env_name: save prefix in this environment variable
|
||||
*
|
||||
* im_guess_prefix() tries to guess the install directory. You should pass
|
||||
* in the value of argv[0] (the name your program was run as) as a clue to
|
||||
* help it out, plus the name of the environment variable you let the user
|
||||
* override your package install area with (eg. "VIPSHOME").
|
||||
*
|
||||
* On success, im_guess_prefix() returns the prefix it discovered, and as a
|
||||
* side effect, sets the environment variable (if it's not set).
|
||||
*
|
||||
* Don't free the return string!
|
||||
*
|
||||
* Returns: the install prefix as a static string, do not free
|
||||
*
|
||||
* See also: im_guess_libdir().
|
||||
*/
|
||||
const char *
|
||||
im_guess_prefix( const char *argv0, const char *env_name )
|
||||
@ -399,6 +416,26 @@ im_guess_prefix( const char *argv0, const char *env_name )
|
||||
return( prefix );
|
||||
}
|
||||
|
||||
/**
|
||||
* im_guess_libdir:
|
||||
* @argv0: program name (typically argv[0])
|
||||
* @env_name: save prefix in this environment variable
|
||||
*
|
||||
* im_guess_libdir() tries to guess the install directory (usually the
|
||||
* configure libdir, or $prefix/lib). You should pass
|
||||
* in the value of argv[0] (the name your program was run as) as a clue to
|
||||
* help it out, plus the name of the environment variable you let the user
|
||||
* override your package install area with (eg. "VIPSHOME").
|
||||
*
|
||||
* On success, im_guess_libdir() returns the libdir it discovered, and as a
|
||||
* side effect, sets the prefix environment variable (if it's not set).
|
||||
*
|
||||
* Don't free the return string!
|
||||
*
|
||||
* Returns: the libdir as a static string, do not free
|
||||
*
|
||||
* See also: im_guess_prefix().
|
||||
*/
|
||||
const char *
|
||||
im_guess_libdir( const char *argv0, const char *env_name )
|
||||
{
|
||||
|
@ -19,6 +19,8 @@
|
||||
* - progress feedback option
|
||||
* 5/8/08
|
||||
* - load plugins from libdir/vips-x.x
|
||||
* 5/10/09
|
||||
* - gtkdoc comments
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -73,6 +75,53 @@
|
||||
*/
|
||||
GMutex *im__global_lock = NULL;
|
||||
|
||||
/**
|
||||
* im_init_world:
|
||||
* @argv0: name of application
|
||||
*
|
||||
* im_init_world() starts up the world of VIPS. You should call this on
|
||||
* program startup before using any other VIPS operations. If you do not call
|
||||
* im_init_world(), VIPS will call it for you when you use your first VIPS
|
||||
* operation, but
|
||||
* it may not be able to get hold of @argv0 and VIPS may therefore be unable
|
||||
* to find its data files. It is much better to call this function yourself.
|
||||
*
|
||||
* im_init_world() does approximately the following:
|
||||
*
|
||||
* <itemizedlist>
|
||||
* <listitem>
|
||||
* <para>initialises any libraries that VIPS is using, including GObject
|
||||
* and the threading system, if neccessary</para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>guesses where the VIPS data files are and sets up
|
||||
* internationalisation --- see im_guess_prefix()
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>loads any plugins from $libdir/vips-x.y, where x and y are the
|
||||
* major and minor version numbers for this VIPS.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* </itemizedlist>
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* |[
|
||||
* int main( int argc, char **argv )
|
||||
* {
|
||||
* if( im_init_world( argv[0] ) )
|
||||
* error_exit( "unable to start VIPS" );
|
||||
*
|
||||
* return( 0 );
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* Returns: 0 on success, -1 otherwise
|
||||
*
|
||||
* See also: im_get_option_group(), im_version(), im_guess_prefix(),
|
||||
* im_guess_libdir().
|
||||
*/
|
||||
int
|
||||
im_init_world( const char *argv0 )
|
||||
{
|
||||
@ -222,7 +271,17 @@ static GOptionEntry option_entries[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/* The cmd-line options we support.
|
||||
/**
|
||||
* im_get_option_group:
|
||||
*
|
||||
* im_get_option_group() returns a GOptionGroup containing various VIPS
|
||||
* command-line options. It can be used with GOption to help
|
||||
* parse argc/argv.
|
||||
*
|
||||
* Returns: a GOptionGroup for VIPS, see GOption
|
||||
*
|
||||
* See also: im_version(), im_guess_prefix(),
|
||||
* im_guess_libdir(), im_init_world().
|
||||
*/
|
||||
GOptionGroup *
|
||||
im_get_option_group( void )
|
||||
|
@ -334,6 +334,73 @@ evalend_cb( Progress *progress )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* im_open:
|
||||
* @filename: file to open
|
||||
* @mode: mode to open with
|
||||
*
|
||||
* im_open() examines the mode string, and creates an appropriate #IMAGE.
|
||||
*
|
||||
* <itemizedlist>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* <emphasis>"r"</emphasis>
|
||||
* opens the named file for reading. If the file is not in the native
|
||||
* VIPS format for your machine, im_open() automatically converts the
|
||||
* file for you in memory.
|
||||
*
|
||||
* For some large files (eg. TIFF) this may
|
||||
* not be what you want: you should call the appropriate converter
|
||||
* yourself, and arrange for the conversion to take place on disc.
|
||||
* See #VipsFormat.
|
||||
*
|
||||
* im_open() can read files in most formats.
|
||||
*
|
||||
* Note that <emphasis>"r"</emphasis> mode works in at least two stages.
|
||||
* It should return quickly and let you check header fields. It will
|
||||
* only actually read in pixels when you first access them.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* <emphasis>"w"</emphasis>
|
||||
* opens the named file for writing. It looks at the file name
|
||||
* suffix to determine the type to write -- for example:
|
||||
*
|
||||
* |[
|
||||
* im_open( "fred.tif", "w" )
|
||||
* ]|
|
||||
*
|
||||
* will write in TIFF format.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* <emphasis>"t"</emphasis>
|
||||
* creates a temporary memory buffer image.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* <emphasis>"p"</emphasis>
|
||||
* creates a "glue" descriptor you can use to join two image
|
||||
* processing operations together.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* <emphasis>"rw"</emphasis>
|
||||
* opens the named file for reading and writing. This will only work for
|
||||
* VIPS files in a format native to your machine. It is only for
|
||||
* paintbox-type applications.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* </itemizedlist>
|
||||
*
|
||||
* Returns: the image descriptor on success and NULL on error.
|
||||
*
|
||||
* See also: im_close(), #VipsFormat
|
||||
*/
|
||||
IMAGE *
|
||||
im_open( const char *filename, const char *mode )
|
||||
{
|
||||
|
@ -1061,7 +1061,13 @@ im_run_command( char *name, int argc, char **argv )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Return the version string from configure.in
|
||||
/**
|
||||
* im_version_string:
|
||||
*
|
||||
* Get the VIPS version as a static string, including a build date and time.
|
||||
* Do not free.
|
||||
*
|
||||
* Returns: a static version string
|
||||
*/
|
||||
const char *
|
||||
im_version_string( void )
|
||||
@ -1069,7 +1075,14 @@ im_version_string( void )
|
||||
return( IM_VERSION_STRING );
|
||||
}
|
||||
|
||||
/* Return major/minor/micro release numbers.
|
||||
/**
|
||||
* im_version:
|
||||
* @flag: which field of the version to get
|
||||
*
|
||||
* Get the major, minor or micro library version, with @flag values 0, 1 and
|
||||
* 2.
|
||||
*
|
||||
* Returns: library version number
|
||||
*/
|
||||
int
|
||||
im_version( int flag )
|
||||
|
Loading…
Reference in New Issue
Block a user