reenable wrap7 for nicked vips7 ops
so now "vips im_subtract" gets you the old interface, "vips subtract" the new one
This commit is contained in:
parent
cfb076f726
commit
9627f889b0
22
TODO
22
TODO
@ -1,3 +1,25 @@
|
|||||||
|
- try
|
||||||
|
|
||||||
|
vips add
|
||||||
|
|
||||||
|
get
|
||||||
|
|
||||||
|
VipsAdd (add), add two images
|
||||||
|
add (left, right)
|
||||||
|
where:
|
||||||
|
left :: VipsImage
|
||||||
|
right :: VipsImage
|
||||||
|
optional arguments:
|
||||||
|
imtest :: VipsImage
|
||||||
|
booltest :: gboolean
|
||||||
|
|
||||||
|
** leak test on exit:
|
||||||
|
2 objects alive:
|
||||||
|
0) VipsAdd (0x7c7800)
|
||||||
|
1) VipsImage (0x7c9000)
|
||||||
|
|
||||||
|
also, no mention of output image, argh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- turn wrap back on, with renames
|
- turn wrap back on, with renames
|
||||||
|
@ -654,6 +654,65 @@ vips_wrap7_init( VipsWrap7 *wrap7 )
|
|||||||
/* Build a subclass of vips7 for every vips7 operation.
|
/* Build a subclass of vips7 for every vips7 operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
drop_postfix( char *str, const char *postfix )
|
||||||
|
{
|
||||||
|
if( vips_ispostfix( str, postfix ) ) {
|
||||||
|
str[strlen( str ) - strlen( postfix )] = '\0';
|
||||||
|
|
||||||
|
return( TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
|
return( FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Turn a vips7 name into a nickname. Eg. im_lintra_vec becomes lin.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
vips_wrap7_nickname( const char *in, char *out )
|
||||||
|
{
|
||||||
|
static const char *dont_drop[] = {
|
||||||
|
"_set",
|
||||||
|
};
|
||||||
|
static const char *drop[] = {
|
||||||
|
"_vec",
|
||||||
|
"const",
|
||||||
|
"tra",
|
||||||
|
"set",
|
||||||
|
"_f"
|
||||||
|
};
|
||||||
|
|
||||||
|
int i;
|
||||||
|
gboolean changed;
|
||||||
|
|
||||||
|
/* Copy, chopping off "im_" prefix.
|
||||||
|
*/
|
||||||
|
if( vips_isprefix( "im_", in ) )
|
||||||
|
strcpy( out, in + 3 );
|
||||||
|
else
|
||||||
|
strcpy( out, in );
|
||||||
|
|
||||||
|
/* Repeatedly drop postfixes while we can. Stop if we see a dont_drop
|
||||||
|
* postfix.
|
||||||
|
*/
|
||||||
|
do {
|
||||||
|
gboolean found;
|
||||||
|
|
||||||
|
found = FALSE;
|
||||||
|
for( i = 0; i < IM_NUMBER( dont_drop ); i++ )
|
||||||
|
if( vips_ispostfix( out, dont_drop[i] ) ) {
|
||||||
|
found = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( found )
|
||||||
|
break;
|
||||||
|
|
||||||
|
changed = FALSE;
|
||||||
|
for( i = 0; i < IM_NUMBER( drop ); i++ )
|
||||||
|
changed |= drop_postfix( out, drop[i] );
|
||||||
|
} while( changed );
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_wrap7_subclass_class_init( VipsWrap7Class *class )
|
vips_wrap7_subclass_class_init( VipsWrap7Class *class )
|
||||||
{
|
{
|
||||||
@ -666,6 +725,7 @@ vips_wrap7_subclass_class_init( VipsWrap7Class *class )
|
|||||||
strlen( VIPS_WRAP7_PREFIX );
|
strlen( VIPS_WRAP7_PREFIX );
|
||||||
im_function *fn = im_find_function( name );
|
im_function *fn = im_find_function( name );
|
||||||
|
|
||||||
|
char nickname[4096];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_assert( !class->fn );
|
g_assert( !class->fn );
|
||||||
@ -674,7 +734,8 @@ vips_wrap7_subclass_class_init( VipsWrap7Class *class )
|
|||||||
gobject_class->set_property = vips_wrap7_object_set_property;
|
gobject_class->set_property = vips_wrap7_object_set_property;
|
||||||
gobject_class->get_property = vips_wrap7_object_get_property;
|
gobject_class->get_property = vips_wrap7_object_get_property;
|
||||||
|
|
||||||
vobject_class->nickname = im_strdup( NULL, name );
|
vips_wrap7_nickname( name, nickname );
|
||||||
|
vobject_class->nickname = im_strdup( NULL, nickname );
|
||||||
vobject_class->description = fn->desc;
|
vobject_class->description = fn->desc;
|
||||||
|
|
||||||
class->fn = fn;
|
class->fn = fn;
|
||||||
|
@ -246,11 +246,8 @@ vips_init( const char *argv0 )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Build classes which wrap old vips7 operations.
|
/* Build classes which wrap old vips7 operations.
|
||||||
|
|
||||||
handy for testing, but perhaps not much else
|
|
||||||
|
|
||||||
vips__init_wrap7_classes();
|
|
||||||
*/
|
*/
|
||||||
|
vips__init_wrap7_classes();
|
||||||
|
|
||||||
/* Start up the buffer cache.
|
/* Start up the buffer cache.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user