add support for VipsInterpolate to the C++ API

quick and ugly hack, this will be replaced in vips8

necessary to get affinei and affinei_all in Python
This commit is contained in:
John Cupitt 2012-08-06 16:06:17 +01:00
parent dab22df75b
commit 3276c636f7
5 changed files with 21 additions and 5 deletions

2
TODO
View File

@ -1,6 +1,8 @@
- C++/Python need an im_affinei_all, perhaps with a char* for the
interpolator?
test new affinei C++ stuff, esp freeing
blocking bugs
=============

View File

@ -870,9 +870,11 @@ im_type_desc im__output_gvalue = {
};
/* Init function for input interpolate.
*
* This is used as a helper function by the C++ interface, so amke it public.
*/
static int
input_interpolate_init( im_object *obj, char *str )
int
vips__input_interpolate_init( im_object *obj, char *str )
{
GType type = g_type_from_name( "VipsInterpolate" );
VipsObjectClass *class = VIPS_OBJECT_CLASS( g_type_class_ref( type ) );
@ -903,7 +905,7 @@ im_type_desc im__input_interpolate = {
IM_TYPE_INTERPOLATE,
0, /* No storage required */
IM_TYPE_ARG, /* It requires a command-line arg */
input_interpolate_init, /* Init function */
vips__input_interpolate_init, /* Init function */
input_interpolate_dest /* Destroy function */
};

View File

@ -304,6 +304,8 @@ guint64 vips__parse_size( const char *size_string );
IMAGE *vips__deprecated_open_read( const char *filename, gboolean sequential );
IMAGE *vips__deprecated_open_write( const char *filename );
int vips__input_interpolate_init( im_object *obj, char *str );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -484,6 +484,8 @@ Vargv::~Vargv()
io->vec = NULL;
}
}
else if( strcmp( ty->type, IM_TYPE_INTERPOLATE ) == 0 )
g_object_unref( base[i] );
}
}

View File

@ -332,7 +332,8 @@ vips2cpp( im_type_desc *ty )
IM_TYPE_DISPLAY,
IM_TYPE_IMAGEVEC,
IM_TYPE_DOUBLEVEC,
IM_TYPE_INTVEC
IM_TYPE_INTVEC,
IM_TYPE_INTERPOLATE
};
/* Corresponding C++ types.
@ -348,7 +349,8 @@ vips2cpp( im_type_desc *ty )
"VDisplay",
"std::vector<VImage>",
"std::vector<double>",
"std::vector<int>"
"std::vector<int>",
"char*"
};
for( k = 0; k < IM_NUMBER( vtypes ); k++ )
@ -771,6 +773,12 @@ print_cppdef( im_function *fn )
else if( strcmp( ty->type, IM_TYPE_INTVEC ) == 0 )
print_invec( j, fn->argv[j].name,
"im_intvec_object", "int", "" );
else if( strcmp( ty->type, IM_TYPE_INTERPOLATE ) == 0 ) {
printf( "\tif( vips__input_interpolate_init( "
"&_vec.data(%d), %s ) )\n",
j, fn->argv[j].name );
printf( "\t\tverror();\n" );
}
else
/* Just use vips2cpp().
*/