fixed vips7 CLI

"vips im_add a b c" works again
This commit is contained in:
John Cupitt 2011-05-24 13:50:17 +01:00
parent ef29872ce7
commit 26c0ce8fde
7 changed files with 36 additions and 15 deletions

5
TODO
View File

@ -16,6 +16,11 @@
- vips_object_get_argument_to_string(),
vips_object_get_argument_needs_string(),
vips_object_set_argument_from_string()
should all be vfuncs on object

View File

@ -113,7 +113,7 @@ input_image_init( im_object *obj, char *str )
{
IMAGE **im = (IMAGE **) obj;
return( !(*im = vips_image_new_from_file( str, "rd" )) );
return( !(*im = im_open( str, "rd" )) );
}
/* Input image type.
@ -123,7 +123,7 @@ im_type_desc im__input_image = {
0, /* No storage needed */
IM_TYPE_ARG, /* It requires a command-line arg */
(im_init_obj_fn) input_image_init,/* Init function */
(im_dest_obj_fn) vips_object_unref/* Destroy function */
(im_dest_obj_fn) im_close /* Destroy function */
};
/* Init function for output images.
@ -133,7 +133,7 @@ output_image_init( im_object *obj, char *str )
{
IMAGE **im = (IMAGE **) obj;
return( !(*im = vips_image_new_from_file( str, "w" )) );
return( !(*im = im_open( str, "w" )) );
}
/* Output image type.
@ -143,7 +143,7 @@ im_type_desc im__output_image = {
0, /* No storage to be allocated */
IM_TYPE_OUTPUT | IM_TYPE_ARG, /* Flags! */
(im_init_obj_fn) output_image_init,/* Init function */
(im_dest_obj_fn) vips_object_unref/* Destroy function */
(im_dest_obj_fn) im_close /* Destroy function */
};
/* Init function for RW images.
@ -153,7 +153,7 @@ rw_image_init( im_object *obj, char *str )
{
IMAGE **im = (IMAGE **) obj;
return( !(*im = vips_image_new_from_file( str, "rw" )) );
return( !(*im = im_open( str, "rw" )) );
}
/* RW image type.
@ -163,7 +163,7 @@ im_type_desc im__rw_image = {
0, /* No storage to be allocated */
IM_TYPE_ARG | IM_TYPE_RW, /* Read-write object, needs an arg */
(im_init_obj_fn) rw_image_init, /* Init function */
(im_dest_obj_fn) vips_object_unref/* Destroy function */
(im_dest_obj_fn) im_close /* Destroy function */
};
/* im_imagevec_object destroy function.
@ -178,7 +178,7 @@ imagevec_dest( im_object obj )
for( i = 0; i < iv->n; i++ )
if( iv->vec[i] ) {
g_object_unref( iv->vec[i] );
im_close( iv->vec[i] );
iv->vec[i] = NULL;
}
@ -215,8 +215,7 @@ input_imagevec_init( im_object *obj, char *str )
iv->vec[i] = NULL;
for( i = 0; i < nargs; i++ )
if( !(iv->vec[i] =
vips_image_new_from_file( strv[i], "rd" )) ) {
if( !(iv->vec[i] = im_open( strv[i], "rd" )) ) {
g_strfreev( strv );
return( -1 );
}

View File

@ -52,6 +52,22 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
VipsImage *
im_open( const char *filename, const char *mode )
{
VipsImage *image;
if( !(image = vips_image_new_from_file( filename, mode )) )
return( NULL );
/* We have to refsink since the im_open() result is used like a hard
* reference.
*/
g_object_ref_sink( image );
return( image );
}
/* Just for compatibility. New code should use vips_object_local() directly.
*/
VipsImage *
@ -60,7 +76,7 @@ im_open_local( VipsImage *parent,
{
VipsImage *image;
if( !(image = vips_image_new_from_file( filename, mode )) )
if( !(image = im_open( filename, mode )) )
return( NULL );
vips_object_local( parent, image );

View File

@ -153,7 +153,6 @@ extern "C" {
#define im_cp_desc vips_image_copy_fields
#define im_cp_descv vips_image_copy_fieldsv
#define im_cp_desc_array vips_image_copy_fields_array
#define im_open vips_image_new_from_file
#define im_image vips_image_new_from_memory
#define im_binfile vips_image_new_from_file_raw
#define im__open_temp vips_image_new_disc_temp
@ -198,6 +197,8 @@ extern "C" {
/* Compat functions.
*/
VipsImage *im_open( const char *filename, const char *mode );
VipsImage *im_open_local( VipsImage *parent,
const char *filename, const char *mode );
int im_open_local_array( VipsImage *parent,

View File

@ -31,8 +31,8 @@
*/
/*
*/
#define VIPS_DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -2029,7 +2029,7 @@ vips_image_wio_input( VipsImage *image )
/* Change to VIPS_IMAGE_SETBUF. First, make a memory
* buffer and copy into that.
*/
if( !(t1 = vips_image_new_from_file( "vips_image_wio_input", "t" )) )
if( !(t1 = vips_image_new_from_file( "wio_input", "t" )) )
return( -1 );
if( im_copy( image, t1 ) ) {
g_object_unref( t1 );

View File

@ -30,10 +30,10 @@
*/
/*
*/
#define DEBUG
#define VIPS_DEBUG
#define DEBUG_REF
*/
#ifdef HAVE_CONFIG_H
#include <config.h>

View File

@ -28,8 +28,8 @@
*/
/*
*/
#define VIPS_DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>