vipsobject fallback for new_from_string() as well
This commit is contained in:
parent
3f1c855177
commit
cba1ea0024
23
TODO
23
TODO
@ -1,28 +1,12 @@
|
||||
- interpolate needs stuff for new new_from_string etc. system
|
||||
|
||||
also VipsFormat ... could this replace vips_image_new_from_string()? or
|
||||
- also VipsFormat ... could this replace vips_image_new_from_string()? or
|
||||
could we call this from vips_image_new_from_string()?
|
||||
|
||||
vipsobject should have a fall-back implementation that does something, I
|
||||
don't quite know what
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- vips_object_new_from_string() must go, use the vfunc thing instead
|
||||
|
||||
at the moment, vips_object_new_from_string() is used for
|
||||
|
||||
affinei bilinear{arg=12}
|
||||
|
||||
instead, have a new_from_string vfunc on interpolate which takes off the
|
||||
main part of the arg and uses that to look up the interpolate subclass
|
||||
|
||||
parsing off required and optional sub-args could be moved somewhere else
|
||||
|
||||
use this system to do file format options, eg.
|
||||
- use this system to do file format options, eg.
|
||||
|
||||
vips copy fred.v fred.jpg{quality=90}
|
||||
|
||||
@ -37,6 +21,9 @@
|
||||
- perhaps we should have hard refs everywhere? it's very confusing having a
|
||||
mxture :-( use vips_object_local() to make hard refs autounref
|
||||
|
||||
what would the API look like?
|
||||
|
||||
|
||||
|
||||
|
||||
- try out:
|
||||
|
@ -874,6 +874,29 @@ vips_object_real_rewind( VipsObject *object )
|
||||
object->postclose = FALSE;
|
||||
}
|
||||
|
||||
static VipsObject *
|
||||
vips_object_real_new_from_string( const char *string )
|
||||
{
|
||||
GType type;
|
||||
|
||||
/* The main arg selects the subclass.
|
||||
*/
|
||||
if( !(type = vips_type_find( "VipsObject", string )) )
|
||||
return( NULL );
|
||||
|
||||
return( VIPS_OBJECT( g_object_new( type, NULL ) ) );
|
||||
}
|
||||
|
||||
static void
|
||||
vips_object_real_to_string( VipsObject *object, VipsBuf *buf )
|
||||
{
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
|
||||
/* Just "bicubic" or whatever.
|
||||
*/
|
||||
vips_buf_appends( buf, class->nickname );
|
||||
}
|
||||
|
||||
static void
|
||||
transform_string_double( const GValue *src_value, GValue *dest_value )
|
||||
{
|
||||
@ -904,6 +927,8 @@ vips_object_class_init( VipsObjectClass *class )
|
||||
class->print = vips_object_real_print;
|
||||
class->sanity = vips_object_real_sanity;
|
||||
class->rewind = vips_object_real_rewind;
|
||||
class->new_from_string = vips_object_real_new_from_string;
|
||||
class->to_string = vips_object_real_to_string;
|
||||
class->nickname = "object";
|
||||
class->description = _( "VIPS base class" );
|
||||
|
||||
|
@ -167,43 +167,17 @@ vips_interpolate_real_get_window_offset( VipsInterpolate *interpolate )
|
||||
}
|
||||
}
|
||||
|
||||
static VipsObject *
|
||||
vips_interpolate_new_from_string( const char *string )
|
||||
{
|
||||
GType type;
|
||||
|
||||
/* The main arg selects the subclass.
|
||||
*/
|
||||
if( !(type = vips_type_find( "VipsInterpolate", string )) )
|
||||
return( NULL );
|
||||
return( VIPS_OBJECT( g_object_new( type, NULL ) ) );
|
||||
}
|
||||
|
||||
static void
|
||||
vips_interpolate_to_string( VipsObject *object, VipsBuf *buf )
|
||||
{
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
|
||||
/* Just "bicubic" or whatever.
|
||||
*/
|
||||
vips_buf_appends( buf, class->nickname );
|
||||
}
|
||||
|
||||
static void
|
||||
vips_interpolate_class_init( VipsInterpolateClass *class )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
|
||||
#endif /*DEBUG*/
|
||||
VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
|
||||
|
||||
#ifdef DEBUG
|
||||
gobject_class->finalize = vips_interpolate_finalize;
|
||||
#endif /*DEBUG*/
|
||||
|
||||
vobject_class->new_from_string = vips_interpolate_new_from_string;
|
||||
vobject_class->to_string = vips_interpolate_to_string;
|
||||
|
||||
class->interpolate = NULL;
|
||||
class->get_window_size = vips_interpolate_real_get_window_size;
|
||||
class->get_window_offset = vips_interpolate_real_get_window_offset;
|
||||
|
Loading…
Reference in New Issue
Block a user