add optional args for testing
arithmetic now has optional bool and im args for testing operation interfaces
This commit is contained in:
parent
81b68ec979
commit
860a04a882
@ -61,6 +61,8 @@
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
PROP_OUTPUT = 1,
|
PROP_OUTPUT = 1,
|
||||||
|
PROP_BOOLTEST = 2,
|
||||||
|
PROP_IMTEST = 3,
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -69,13 +71,22 @@ G_DEFINE_ABSTRACT_TYPE( VipsArithmetic, vips_arithmetic, VIPS_TYPE_OPERATION );
|
|||||||
static int
|
static int
|
||||||
vips_arithmetic_build( VipsObject *object )
|
vips_arithmetic_build( VipsObject *object )
|
||||||
{
|
{
|
||||||
|
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object );
|
||||||
|
|
||||||
if( VIPS_OBJECT_CLASS( vips_arithmetic_parent_class )->build( object ) )
|
if( VIPS_OBJECT_CLASS( vips_arithmetic_parent_class )->build( object ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* Should we _generate() here? We should keep the params in the object
|
/* Should we _generate() here? We should keep the params in the object
|
||||||
* ready to be dropped in.
|
* ready to be dropped in.
|
||||||
|
*
|
||||||
|
* At the moment we _generate() in binary.c and unary.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
printf( "vips_arithmetic_build: booltest = %d\n",
|
||||||
|
arithmetic->booltest );
|
||||||
|
printf( "vips_arithmetic_build: imtest = %p\n",
|
||||||
|
arithmetic->imtest );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,8 +103,8 @@ vips_arithmetic_class_init( VipsArithmeticClass *class )
|
|||||||
|
|
||||||
vobject_class->build = vips_arithmetic_build;
|
vobject_class->build = vips_arithmetic_build;
|
||||||
|
|
||||||
pspec = g_param_spec_object( "out",
|
pspec = g_param_spec_object( "out", "Output",
|
||||||
"Output", "Output image",
|
_( "Output image" ),
|
||||||
VIPS_TYPE_IMAGE,
|
VIPS_TYPE_IMAGE,
|
||||||
G_PARAM_READWRITE );
|
G_PARAM_READWRITE );
|
||||||
g_object_class_install_property( gobject_class,
|
g_object_class_install_property( gobject_class,
|
||||||
@ -101,6 +112,27 @@ vips_arithmetic_class_init( VipsArithmeticClass *class )
|
|||||||
vips_object_class_install_argument( vobject_class, pspec,
|
vips_object_class_install_argument( vobject_class, pspec,
|
||||||
VIPS_ARGUMENT_REQUIRED_OUTPUT,
|
VIPS_ARGUMENT_REQUIRED_OUTPUT,
|
||||||
G_STRUCT_OFFSET( VipsArithmetic, output ) );
|
G_STRUCT_OFFSET( VipsArithmetic, output ) );
|
||||||
|
|
||||||
|
pspec = g_param_spec_boolean( "booltest", "Bool test",
|
||||||
|
_( "Test optional boolean argument" ),
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READWRITE );
|
||||||
|
g_object_class_install_property( gobject_class,
|
||||||
|
PROP_BOOLTEST, pspec );
|
||||||
|
vips_object_class_install_argument( vobject_class, pspec,
|
||||||
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
|
G_STRUCT_OFFSET( VipsArithmetic, booltest ) );
|
||||||
|
|
||||||
|
pspec = g_param_spec_object( "imtest", "Image test",
|
||||||
|
_( "Test optional image argument" ),
|
||||||
|
VIPS_TYPE_IMAGE,
|
||||||
|
G_PARAM_READWRITE );
|
||||||
|
g_object_class_install_property( gobject_class,
|
||||||
|
PROP_IMTEST, pspec );
|
||||||
|
vips_object_class_install_argument( vobject_class, pspec,
|
||||||
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
|
G_STRUCT_OFFSET( VipsArithmetic, imtest ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -62,6 +62,11 @@ typedef struct _VipsArithmetic {
|
|||||||
*/
|
*/
|
||||||
VipsImage *output;
|
VipsImage *output;
|
||||||
|
|
||||||
|
/* Optional bool argument for testing.
|
||||||
|
*/
|
||||||
|
gboolean booltest;
|
||||||
|
VipsImage *imtest;
|
||||||
|
|
||||||
} VipsArithmetic;
|
} VipsArithmetic;
|
||||||
|
|
||||||
typedef struct _VipsArithmeticClass {
|
typedef struct _VipsArithmeticClass {
|
||||||
|
Loading…
Reference in New Issue
Block a user