Merge remote-tracking branch 'origin/7.40'

This commit is contained in:
John Cupitt 2014-08-18 17:41:17 +01:00
commit a70da5b2d9
14 changed files with 108 additions and 107 deletions

View File

@ -6,6 +6,7 @@
12/8/14 started 7.40.6 12/8/14 started 7.40.6
- more doc fixes - more doc fixes
- fix similarity rotate+scale, thanks Topochicho - fix similarity rotate+scale, thanks Topochicho
- fix 16-bit PNG save, thanks John
25/7/14 started 7.40.5 25/7/14 started 7.40.5
- fix a race in im_maxpos_avg() - fix a race in im_maxpos_avg()

4
TODO
View File

@ -1,9 +1,5 @@
- can we pick the vipsthumbnail int shrink factor more intelligently? - can we pick the vipsthumbnail int shrink factor more intelligently?
- did we include the exif patch in the latest windows build? check on laptop
we don't seem to have this fix in the repository!
- vips_object_unref_outputs() needs docs ... bindings will need it - vips_object_unref_outputs() needs docs ... bindings will need it
- rewrite im_conv() etc. as vips_conv() - rewrite im_conv() etc. as vips_conv()

View File

@ -1198,45 +1198,3 @@ im_run_command( char *name, int argc, char **argv )
return( 0 ); return( 0 );
} }
/**
* 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 )
{
return( IM_VERSION_STRING );
}
/**
* 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 )
{
switch( flag ) {
case 0:
return( IM_MAJOR_VERSION );
case 1:
return( IM_MINOR_VERSION );
case 2:
return( IM_MICRO_VERSION );
default:
vips_error( "im_version", "%s", _( "flag not 0, 1, 2" ) );
return( -1 );
}
}

View File

@ -242,12 +242,7 @@ im_open( const char *filename, const char *mode )
{ {
VipsImage *image; VipsImage *image;
/* Pass in a nonsense name for argv0 ... this init path is only here vips_check_init();
* for old programs which are missing an vips_init() call. We need
* i18n set up before we can translate.
*/
if( vips_init( "giant_banana" ) )
vips_error_clear();
/* We have to go via the old VipsFormat system so we can support the /* We have to go via the old VipsFormat system so we can support the
* "filename:option" syntax. * "filename:option" syntax.
@ -427,7 +422,7 @@ im_init( const char *filename )
int int
im_init_world( const char *argv0 ) im_init_world( const char *argv0 )
{ {
return( vips_init( argv0 ) ); return( vips__init( argv0 ) );
} }
/* Prettyprint various header fields. Just for vips7 compat, use /* Prettyprint various header fields. Just for vips7 compat, use

View File

@ -8,6 +8,8 @@
* - auto rshift down to 8 bits during save * - auto rshift down to 8 bits during save
* 19/1/14 * 19/1/14
* - pack and unpack rad to scrgb * - pack and unpack rad to scrgb
* 18/8/14
* - fix conversion to 16-bit RGB, thanks John
*/ */
/* /*
@ -1228,14 +1230,27 @@ vips_foreign_convert_saveable( VipsForeignSave *save )
in = out; in = out;
} }
} }
else if( in->Bands == 3 && else if( in->Bands >= 3 &&
vips_colourspace_issupported( in ) ) { vips_colourspace_issupported( in ) &&
/* Interpret the Type field for colorimetric images. (class->saveable == VIPS_SAVEABLE_RGB ||
class->saveable == VIPS_SAVEABLE_RGBA ||
class->saveable == VIPS_SAVEABLE_RGB_CMYK) ) {
/* Use vips_colourspace() to make an RGB image from LAB or
* whatever this thing is.
*/ */
VipsImage *out; VipsImage *out;
VipsInterpretation interpretation;
if( vips_colourspace( in, &out, /* Do we make RGB or RGB16? We don't want to squash a 16-bit
VIPS_INTERPRETATION_sRGB, NULL ) ) { * RGB down to 8 bits if the saver supports 16.
*/
if( vips_band_format_is8bit(
class->format_table[in->BandFmt] ) )
interpretation = VIPS_INTERPRETATION_sRGB;
else
interpretation = VIPS_INTERPRETATION_RGB16;
if( vips_colourspace( in, &out, interpretation, NULL ) ) {
g_object_unref( in ); g_object_unref( in );
return( -1 ); return( -1 );
} }

View File

@ -52,6 +52,8 @@ typedef struct _VipsMeta {
GValue value; /* copy of value */ GValue value; /* copy of value */
} VipsMeta; } VipsMeta;
void vips_check_init( void );
void vips__meta_init_types( void ); void vips__meta_init_types( void );
void vips__meta_destroy( VipsImage *im ); void vips__meta_destroy( VipsImage *im );
int vips__meta_cp( VipsImage *, const VipsImage * ); int vips__meta_cp( VipsImage *, const VipsImage * );

View File

@ -164,7 +164,7 @@ extern "C" {
/* We can't use _ here since this will be compiled by our clients and they may /* We can't use _ here since this will be compiled by our clients and they may
* not have _(). * not have _().
*/ */
#define vips_init( ARGV0 ) \ #define VIPS_INIT( ARGV0 ) \
(sizeof( VipsObject ) != vips__get_sizeof_vipsobject() ? ( \ (sizeof( VipsObject ) != vips__get_sizeof_vipsobject() ? ( \
vips_info( "vips_init", "ABI mismatch" ), \ vips_info( "vips_init", "ABI mismatch" ), \
vips_info( "vips_init", \ vips_info( "vips_init", \
@ -178,7 +178,6 @@ extern "C" {
vips__init( ARGV0 )) vips__init( ARGV0 ))
const char *vips_get_argv0( void ); const char *vips_get_argv0( void );
void vips_check_init( void );
void vips_shutdown( void ); void vips_shutdown( void );
void vips_thread_shutdown( void ); void vips_thread_shutdown( void );
GOptionGroup *vips_get_option_group( void ); GOptionGroup *vips_get_option_group( void );

View File

@ -266,6 +266,10 @@ vips_image_new_mode( const char *filename, const char *mode );
int im_init_world( const char *argv0 ); int im_init_world( const char *argv0 );
/* We used to have this in lowercase.
*/
#define vips_init(X) VIPS_INIT(X)
VipsImage *im_open( const char *filename, const char *mode ); VipsImage *im_open( const char *filename, const char *mode );
VipsImage *im_open_local( VipsImage *parent, VipsImage *im_open_local( VipsImage *parent,

View File

@ -1061,12 +1061,9 @@ vips_image_class_init( VipsImageClass *class )
VIPS_DEBUG_MSG( "vips_image_class_init:\n" ); VIPS_DEBUG_MSG( "vips_image_class_init:\n" );
/* Pass in a nonsense name for argv0 ... this init world is only here /* We must have threads set up before we can process.
* for old programs which are missing a vips_init() call. We must
* have threads set up before we can process.
*/ */
if( vips_init( "vips" ) ) vips_check_init();
vips_error_clear();
gobject_class->finalize = vips_image_finalize; gobject_class->finalize = vips_image_finalize;
gobject_class->dispose = vips_image_dispose; gobject_class->dispose = vips_image_dispose;

View File

@ -117,52 +117,41 @@ vips_get_argv0( void )
} }
/** /**
* vips_init: * VIPS_INIT:
* @argv0: name of application * @argv0: name of application
* *
* vips_init() starts up the world of VIPS. You should call this on * VIPS_INIT() starts up the world of VIPS. You should call this on
* program startup before using any other VIPS operations. If you do not call * program startup before using any other VIPS operations. If you do not call
* vips_init(), VIPS will call it for you when you use your first VIPS * VIPS_INIT(), VIPS will call it for you when you use your first VIPS
* operation, but * operation, but it may not be able to get hold of @argv0 and VIPS may
* it may not be able to get hold of @argv0 and VIPS may therefore be unable * therefore be unable to find its data files. It is much better to call
* to find its data files. It is much better to call this function yourself. * this macro yourself.
* *
* vips_init() is a macro, since it tries to check binary compatibility * VIPS_INIT() is a macro, since it tries to check binary compatibility
* between the caller and the library. * between the caller and the library.
* *
* vips_init() does approximately the following: * VIPS_INIT() does approximately the following:
* *
* <itemizedlist> * + checks that the libvips your program is expecting is
* <listitem> * binary-compatible with the vips library you're running against
* <para>checks that the libvips your program is expecting is *
* binary-compatible with the vips library you're running against</para> * + initialises any libraries that VIPS is using, including GObject
* </listitem> * and the threading system, if neccessary
* <listitem> *
* <para>initialises any libraries that VIPS is using, including GObject * + guesses where the VIPS data files are and sets up
* and the threading system, if neccessary</para>
* </listitem>
* <listitem>
* <para>guesses where the VIPS data files are and sets up
* internationalisation --- see vips_guess_prefix() * internationalisation --- see vips_guess_prefix()
* </para> *
* </listitem> * + creates the main vips types, including #VipsImage and friends
* <listitem> *
* <para>creates the main vips types, including VipsImage and friends * + loads any plugins from $libdir/vips-x.y/, where x and y are the
* </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. * major and minor version numbers for this VIPS.
* </para>
* </listitem>
* </itemizedlist>
* *
* Example: * Example:
* *
* |[ * |[
* int main (int argc, char **argv) * int main (int argc, char **argv)
* { * {
* if (vips_init (argv[0])) * if (VIPS_INIT (argv[0]))
* vips_error_exit ("unable to start VIPS"); * vips_error_exit ("unable to start VIPS");
* *
* vips_shutdown (); * vips_shutdown ();
@ -360,7 +349,7 @@ vips_check_init( void )
* for old programs which are missing an vips_init() call. We need * for old programs which are missing an vips_init() call. We need
* i18n set up before we can translate. * i18n set up before we can translate.
*/ */
if( vips_init( "giant_banana" ) ) if( vips__init( "vips" ) )
vips_error_clear(); vips_error_clear();
} }
@ -404,9 +393,11 @@ vips_leak( void )
* by vips_g_thread_new(). * by vips_g_thread_new().
* *
* You will need to call it from threads created in * You will need to call it from threads created in
* other ways. If you do not call it, vips will generate an error message. * other ways or there will be memory leaks. If you do not call it, vips
* will generate a warning message.
* *
* May be called many times. * It may be called many times, and you can continue using vips after
* calling it. Calling it too often will reduce performance.
*/ */
void void
vips_thread_shutdown( void ) vips_thread_shutdown( void )
@ -572,14 +563,14 @@ static GOptionEntry option_entries[] = {
/** /**
* vips_get_option_group: (skip) * vips_get_option_group: (skip)
* *
* vips_get_option_group() returns a GOptionGroup containing various VIPS * vips_get_option_group() returns a %GOptionGroup containing various VIPS
* command-line options. It can be used with GOption to help * command-line options. It can be used with %GOption to help
* parse argc/argv. * parse argc/argv.
* *
* See also: vips_version(), vips_guess_prefix(), * See also: vips_version(), vips_guess_prefix(),
* vips_guess_libdir(), vips_init(). * vips_guess_libdir(), vips_init().
* *
* Returns: a GOptionGroup for VIPS, see GOption * Returns: a %GOptionGroup for VIPS, see %GOption
*/ */
GOptionGroup * GOptionGroup *
vips_get_option_group( void ) vips_get_option_group( void )
@ -913,3 +904,45 @@ vips_guess_libdir( const char *argv0, const char *env_name )
return( libdir ); return( libdir );
} }
/**
* vips_version_string:
*
* Get the VIPS version as a static string, including a build date and time.
* Do not free.
*
* Returns: (transfer none): a static version string
*/
const char *
vips_version_string( void )
{
return( VIPS_VERSION_STRING );
}
/**
* vips_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
vips_version( int flag )
{
switch( flag ) {
case 0:
return( VIPS_MAJOR_VERSION );
case 1:
return( VIPS_MINOR_VERSION );
case 2:
return( VIPS_MICRO_VERSION );
default:
vips_error( "vips_version", "%s", _( "flag not 0, 1, 2" ) );
return( -1 );
}
}

View File

@ -43,6 +43,7 @@
#include <math.h> #include <math.h>
#include <vips/vips.h> #include <vips/vips.h>
#include <vips/internal.h>
#include <vips/debug.h> #include <vips/debug.h>
#include <gobject/gvaluecollector.h> #include <gobject/gvaluecollector.h>

View File

@ -56,7 +56,7 @@ VIPS_NAMESPACE_START
*/ */
bool init( const char *argv0 ) bool init( const char *argv0 )
{ {
return( vips_init( argv0 ) == 0 ); return( vips__init( argv0 ) == 0 );
} }
void shutdown() void shutdown()

View File

@ -183,7 +183,7 @@ main( int argc, char *argv[] )
int i; int i;
int result; int result;
if( vips_init( argv[0] ) ) if( vips__init( argv[0] ) )
vips_error_exit( "unable to start VIPS" ); vips_error_exit( "unable to start VIPS" );
textdomain( GETTEXT_PACKAGE ); textdomain( GETTEXT_PACKAGE );
setlocale( LC_ALL, "" ); setlocale( LC_ALL, "" );

View File

@ -718,7 +718,7 @@ main( int argc, char **argv )
GError *error = NULL; GError *error = NULL;
int i; int i;
if( vips_init( argv[0] ) ) if( vips__init( argv[0] ) )
vips_error_exit( "unable to start VIPS" ); vips_error_exit( "unable to start VIPS" );
textdomain( GETTEXT_PACKAGE ); textdomain( GETTEXT_PACKAGE );
setlocale( LC_ALL, "" ); setlocale( LC_ALL, "" );