change three C API funcs to match Python/C++/CLI
vips_math2_const(), vips_boolean_const() and vips_relational_const() had the const and oper args reversed from the Python/CLI/C++ API add something to check for arg priority conflicts and resolve the conflicts it found
This commit is contained in:
parent
1046619f3a
commit
205fb817e8
@ -34,6 +34,9 @@
|
||||
- vips_region_shrink() knows about alpha, helps dzsave and tiffsave
|
||||
- use expat, not libxml, for XML load ... removes a required dependency, since
|
||||
we get expat as part of glib
|
||||
- the C functions vips_math2_const(), vips_boolean_const() and
|
||||
vips_relational_const() have changed argument order to match
|
||||
Python/CLI/C++ ... sorry
|
||||
|
||||
8/12/16 started 8.4.5
|
||||
- allow libgsf-1.14.26 to help centos, thanks tdiprima
|
||||
|
@ -533,7 +533,7 @@ vips_boolean_const_init( VipsBooleanConst *boolean_const )
|
||||
|
||||
static int
|
||||
vips_boolean_constv( VipsImage *in, VipsImage **out,
|
||||
VipsOperationBoolean operation, double *c, int n, va_list ap )
|
||||
double *c, int n, VipsOperationBoolean operation, va_list ap )
|
||||
{
|
||||
VipsArea *area_c;
|
||||
double *array;
|
||||
@ -546,7 +546,7 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
|
||||
array[i] = c[i];
|
||||
|
||||
result = vips_call_split( "boolean_const", ap,
|
||||
in, out, operation, area_c );
|
||||
in, out, area_c, operation );
|
||||
|
||||
vips_area_unref( area_c );
|
||||
|
||||
@ -557,9 +557,9 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
|
||||
* vips_boolean_const:
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @boolean: boolean operation to perform
|
||||
* @c: array of constants
|
||||
* @n: number of constants in @c
|
||||
* @boolean: boolean operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform various boolean operations on an image against an array of
|
||||
@ -580,13 +580,13 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
|
||||
*/
|
||||
int
|
||||
vips_boolean_const( VipsImage *in, VipsImage **out,
|
||||
VipsOperationBoolean boolean, double *c, int n, ... )
|
||||
double *c, int n, VipsOperationBoolean boolean, ... )
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_boolean_constv( in, out, boolean, c, n, ap );
|
||||
va_start( ap, boolean );
|
||||
result = vips_boolean_constv( in, out, c, n, boolean, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -615,7 +615,7 @@ vips_andimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_AND, c, n, ap );
|
||||
c, n, VIPS_OPERATION_BOOLEAN_AND, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -644,7 +644,7 @@ vips_orimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_OR, c, n, ap );
|
||||
c, n, VIPS_OPERATION_BOOLEAN_OR, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -673,7 +673,7 @@ vips_eorimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_EOR, c, n, ap );
|
||||
c, n, VIPS_OPERATION_BOOLEAN_EOR, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -702,7 +702,7 @@ vips_lshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_LSHIFT, c, n, ap );
|
||||
c, n, VIPS_OPERATION_BOOLEAN_LSHIFT, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -731,7 +731,7 @@ vips_rshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_RSHIFT, c, n, ap );
|
||||
c, n, VIPS_OPERATION_BOOLEAN_RSHIFT, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -754,13 +754,13 @@ vips_rshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
*/
|
||||
int
|
||||
vips_boolean_const1( VipsImage *in, VipsImage **out,
|
||||
VipsOperationBoolean boolean, double c, ... )
|
||||
double c, VipsOperationBoolean boolean, ... )
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_boolean_constv( in, out, boolean, &c, 1, ap );
|
||||
va_start( ap, boolean );
|
||||
result = vips_boolean_constv( in, out, &c, 1, boolean, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -788,7 +788,7 @@ vips_andimage_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_AND, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_BOOLEAN_AND, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -816,7 +816,7 @@ vips_orimage_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_OR, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_BOOLEAN_OR, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -844,7 +844,7 @@ vips_eorimage_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_EOR, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_BOOLEAN_EOR, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -872,7 +872,7 @@ vips_lshift_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_LSHIFT, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_BOOLEAN_LSHIFT, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -900,7 +900,7 @@ vips_rshift_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_boolean_constv( in, out,
|
||||
VIPS_OPERATION_BOOLEAN_RSHIFT, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_BOOLEAN_RSHIFT, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
|
@ -373,11 +373,17 @@ vips_math2_const_buffer( VipsArithmetic *arithmetic,
|
||||
int i, x, b;
|
||||
|
||||
switch( math2->math2 ) {
|
||||
case VIPS_OPERATION_MATH2_POW: SWITCH( LOOPC, POW ); break;
|
||||
case VIPS_OPERATION_MATH2_WOP: SWITCH( LOOPC, WOP ); break;
|
||||
case VIPS_OPERATION_MATH2_POW:
|
||||
SWITCH( LOOPC, POW );
|
||||
break;
|
||||
|
||||
case VIPS_OPERATION_MATH2_WOP:
|
||||
SWITCH( LOOPC, WOP );
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,7 +421,7 @@ vips_math2_const_init( VipsMath2Const *math2_const )
|
||||
|
||||
static int
|
||||
vips_math2_constv( VipsImage *in, VipsImage **out,
|
||||
VipsOperationMath2 math2, double *c, int n, va_list ap )
|
||||
double *c, int n, VipsOperationMath2 math2, va_list ap )
|
||||
{
|
||||
VipsArea *area_c;
|
||||
double *array;
|
||||
@ -427,7 +433,7 @@ vips_math2_constv( VipsImage *in, VipsImage **out,
|
||||
for( i = 0; i < n; i++ )
|
||||
array[i] = c[i];
|
||||
|
||||
result = vips_call_split( "math2_const", ap, in, out, math2, area_c );
|
||||
result = vips_call_split( "math2_const", ap, in, out, area_c, math2 );
|
||||
|
||||
vips_area_unref( area_c );
|
||||
|
||||
@ -438,9 +444,9 @@ vips_math2_constv( VipsImage *in, VipsImage **out,
|
||||
* vips_math2_const:
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @math2: math operation to perform
|
||||
* @c: array of constants
|
||||
* @n: number of constants in @c
|
||||
* @math2: math operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation calculates various 2-ary maths operations on an image and
|
||||
@ -465,13 +471,13 @@ vips_math2_constv( VipsImage *in, VipsImage **out,
|
||||
*/
|
||||
int
|
||||
vips_math2_const( VipsImage *in, VipsImage **out,
|
||||
VipsOperationMath2 math2, double *c, int n, ... )
|
||||
double *c, int n, VipsOperationMath2 math2, ... )
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_math2_constv( in, out, math2, c, n, ap );
|
||||
va_start( ap, math2 );
|
||||
result = vips_math2_constv( in, out, c, n, math2, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -498,7 +504,7 @@ vips_pow_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_math2_constv( in, out,
|
||||
VIPS_OPERATION_MATH2_POW, c, n, ap );
|
||||
c, n, VIPS_OPERATION_MATH2_POW, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -525,7 +531,7 @@ vips_wop_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_math2_constv( in, out,
|
||||
VIPS_OPERATION_MATH2_WOP, c, n, ap );
|
||||
c, n, VIPS_OPERATION_MATH2_WOP, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -546,13 +552,13 @@ vips_wop_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
*/
|
||||
int
|
||||
vips_math2_const1( VipsImage *in, VipsImage **out,
|
||||
VipsOperationMath2 math2, double c, ... )
|
||||
double c, VipsOperationMath2 math2, ... )
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_math2_constv( in, out, math2, &c, 1, ap );
|
||||
va_start( ap, math2 );
|
||||
result = vips_math2_constv( in, out, &c, 1, math2, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -578,7 +584,7 @@ vips_pow_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_math2_constv( in, out,
|
||||
VIPS_OPERATION_MATH2_POW, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_MATH2_POW, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -604,7 +610,7 @@ vips_wop_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_math2_constv( in, out,
|
||||
VIPS_OPERATION_MATH2_WOP, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_MATH2_WOP, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
|
@ -574,7 +574,7 @@ vips_relational_const_init( VipsRelationalConst *relational_const )
|
||||
|
||||
static int
|
||||
vips_relational_constv( VipsImage *in, VipsImage **out,
|
||||
VipsOperationRelational relational, double *c, int n, va_list ap )
|
||||
double *c, int n, VipsOperationRelational relational, va_list ap )
|
||||
{
|
||||
VipsArea *area_c;
|
||||
double *array;
|
||||
@ -587,7 +587,7 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
|
||||
array[i] = c[i];
|
||||
|
||||
result = vips_call_split( "relational_const", ap,
|
||||
in, out, relational, area_c );
|
||||
in, out, area_c, relational );
|
||||
|
||||
vips_area_unref( area_c );
|
||||
|
||||
@ -598,9 +598,9 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
|
||||
* vips_relational_const:
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @relational: relational operation to perform
|
||||
* @c: array of constants
|
||||
* @n: number of constants in @c
|
||||
* @relational: relational operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform various relational operations on an image and an array of
|
||||
@ -621,13 +621,13 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
|
||||
*/
|
||||
int
|
||||
vips_relational_const( VipsImage *in, VipsImage **out,
|
||||
VipsOperationRelational relational, double *c, int n, ... )
|
||||
double *c, int n, VipsOperationRelational relational, ... )
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_relational_constv( in, out, relational, c, n, ap );
|
||||
va_start( ap, relational );
|
||||
result = vips_relational_constv( in, out, c, n, relational, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -654,7 +654,7 @@ vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_EQUAL, c, n, ap );
|
||||
c, n, VIPS_OPERATION_RELATIONAL_EQUAL, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -681,7 +681,7 @@ vips_notequal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_NOTEQ, c, n, ap );
|
||||
c, n, VIPS_OPERATION_RELATIONAL_NOTEQ, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -708,7 +708,7 @@ vips_less_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_LESS, c, n, ap );
|
||||
c, n, VIPS_OPERATION_RELATIONAL_LESS, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -735,7 +735,7 @@ vips_lesseq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_LESSEQ, c, n, ap );
|
||||
c, n, VIPS_OPERATION_RELATIONAL_LESSEQ, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -762,7 +762,7 @@ vips_more_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_MORE, c, n, ap );
|
||||
c, n, VIPS_OPERATION_RELATIONAL_MORE, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -789,7 +789,7 @@ vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
|
||||
va_start( ap, n );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_MOREEQ, c, n, ap );
|
||||
c, n, VIPS_OPERATION_RELATIONAL_MOREEQ, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -799,8 +799,8 @@ vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
* vips_relational_const1:
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @relational: relational operation to perform
|
||||
* @c: constant
|
||||
* @relational: relational operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform various relational operations on an image and a constant. See
|
||||
@ -812,13 +812,13 @@ vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
*/
|
||||
int
|
||||
vips_relational_const1( VipsImage *in, VipsImage **out,
|
||||
VipsOperationRelational relational, double c, ... )
|
||||
double c, VipsOperationRelational relational, ... )
|
||||
{
|
||||
va_list ap;
|
||||
int result;
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_relational_constv( in, out, relational, &c, 1, ap );
|
||||
va_start( ap, relational );
|
||||
result = vips_relational_constv( in, out, &c, 1, relational, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -844,7 +844,7 @@ vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_EQUAL, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_RELATIONAL_EQUAL, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -870,7 +870,7 @@ vips_notequal_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_NOTEQ, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_RELATIONAL_NOTEQ, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -896,7 +896,7 @@ vips_less_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_LESS, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_RELATIONAL_LESS, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -922,7 +922,7 @@ vips_lesseq_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_LESSEQ, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_RELATIONAL_LESSEQ, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -948,7 +948,7 @@ vips_more_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_MORE, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_RELATIONAL_MORE, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
@ -974,7 +974,7 @@ vips_moreeq_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
|
||||
va_start( ap, c );
|
||||
result = vips_relational_constv( in, out,
|
||||
VIPS_OPERATION_RELATIONAL_MOREEQ, &c, 1, ap );
|
||||
&c, 1, VIPS_OPERATION_RELATIONAL_MOREEQ, ap );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
|
@ -203,7 +203,7 @@ vips_unary_const_class_init( VipsUnaryConstClass *class )
|
||||
object_class->description = _( "unary operations with a constant" );
|
||||
object_class->build = vips_unary_const_build;
|
||||
|
||||
VIPS_ARG_BOXED( class, "c", 200,
|
||||
VIPS_ARG_BOXED( class, "c", 199,
|
||||
_( "c" ),
|
||||
_( "Array of constants" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
|
@ -196,7 +196,7 @@ vips_conversion_class_init( VipsConversionClass *class )
|
||||
vobject_class->description = _( "conversion operations" );
|
||||
vobject_class->build = vips_conversion_build;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "out", 1,
|
||||
VIPS_ARG_IMAGE( class, "out", 2,
|
||||
_( "Output" ),
|
||||
_( "Output image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_OUTPUT,
|
||||
|
@ -559,41 +559,41 @@ vips_embed_class_init( VipsEmbedClass *class )
|
||||
|
||||
operation_class->flags = VIPS_OPERATION_SEQUENTIAL_UNBUFFERED;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "in", -1,
|
||||
VIPS_ARG_IMAGE( class, "in", 1,
|
||||
_( "Input" ),
|
||||
_( "Input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsEmbed, in ) );
|
||||
|
||||
VIPS_ARG_INT( class, "x", 2,
|
||||
VIPS_ARG_INT( class, "x", 3,
|
||||
_( "x" ),
|
||||
_( "Left edge of input in output" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsEmbed, x ),
|
||||
-1000000000, 1000000000, 0 );
|
||||
|
||||
VIPS_ARG_INT( class, "y", 3,
|
||||
VIPS_ARG_INT( class, "y", 4,
|
||||
_( "y" ),
|
||||
_( "Top edge of input in output" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsEmbed, y ),
|
||||
-1000000000, 1000000000, 0 );
|
||||
|
||||
VIPS_ARG_INT( class, "width", 4,
|
||||
VIPS_ARG_INT( class, "width", 5,
|
||||
_( "Width" ),
|
||||
_( "Image width in pixels" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsEmbed, width ),
|
||||
1, 1000000000, 1 );
|
||||
|
||||
VIPS_ARG_INT( class, "height", 5,
|
||||
VIPS_ARG_INT( class, "height", 6,
|
||||
_( "Height" ),
|
||||
_( "Image height in pixels" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsEmbed, height ),
|
||||
1, 1000000000, 1 );
|
||||
|
||||
VIPS_ARG_ENUM( class, "extend", 6,
|
||||
VIPS_ARG_ENUM( class, "extend", 7,
|
||||
_( "Extend" ),
|
||||
_( "How to generate the extra pixels" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
|
@ -190,34 +190,34 @@ vips_extract_area_class_init( VipsExtractAreaClass *class )
|
||||
|
||||
operation_class->flags = VIPS_OPERATION_SEQUENTIAL_UNBUFFERED;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "input", 0,
|
||||
VIPS_ARG_IMAGE( class, "input", 1,
|
||||
_( "Input" ),
|
||||
_( "Input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsExtractArea, in ) );
|
||||
|
||||
VIPS_ARG_INT( class, "left", 2,
|
||||
VIPS_ARG_INT( class, "left", 3,
|
||||
_( "Left" ),
|
||||
_( "Left edge of extract area" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsExtractArea, left ),
|
||||
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
|
||||
|
||||
VIPS_ARG_INT( class, "top", 3,
|
||||
VIPS_ARG_INT( class, "top", 4,
|
||||
_( "Top" ),
|
||||
_( "Top edge of extract area" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsExtractArea, top ),
|
||||
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
|
||||
|
||||
VIPS_ARG_INT( class, "width", 4,
|
||||
VIPS_ARG_INT( class, "width", 5,
|
||||
_( "Width" ),
|
||||
_( "Width of extract area" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsExtractArea, width ),
|
||||
1, VIPS_MAX_COORD, 1 );
|
||||
|
||||
VIPS_ARG_INT( class, "height", 5,
|
||||
VIPS_ARG_INT( class, "height", 6,
|
||||
_( "Height" ),
|
||||
_( "Height of extract area" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
@ -413,7 +413,7 @@ vips_extract_band_class_init( VipsExtractBandClass *class )
|
||||
|
||||
bandary_class->process_line = vips_extract_band_buffer;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "in", 0,
|
||||
VIPS_ARG_IMAGE( class, "in", 1,
|
||||
_( "Input" ),
|
||||
_( "Input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
|
@ -139,13 +139,13 @@ vips_gamma_class_init( VipsGammaClass *class )
|
||||
|
||||
operation_class->flags = VIPS_OPERATION_SEQUENTIAL_UNBUFFERED;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "in", -1,
|
||||
VIPS_ARG_IMAGE( class, "in", 1,
|
||||
_( "in" ),
|
||||
_( "Input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsGamma, in ) );
|
||||
|
||||
VIPS_ARG_DOUBLE( class, "exponent", 0,
|
||||
VIPS_ARG_DOUBLE( class, "exponent", 2,
|
||||
_( "exponent" ),
|
||||
_( "Gamma factor" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
|
@ -508,40 +508,40 @@ vips_insert_class_init( VipsInsertClass *class )
|
||||
*/
|
||||
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "main", -1,
|
||||
VIPS_ARG_IMAGE( class, "main", 0,
|
||||
_( "Main" ),
|
||||
_( "Main input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsInsert, main ) );
|
||||
|
||||
VIPS_ARG_IMAGE( class, "sub", 0,
|
||||
VIPS_ARG_IMAGE( class, "sub", 1,
|
||||
_( "Sub-image" ),
|
||||
_( "Sub-image to insert into main image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsInsert, sub ) );
|
||||
|
||||
VIPS_ARG_INT( class, "x", 2,
|
||||
VIPS_ARG_INT( class, "x", 3,
|
||||
_( "X" ),
|
||||
_( "Left edge of sub in main" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsInsert, x ),
|
||||
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
|
||||
|
||||
VIPS_ARG_INT( class, "y", 3,
|
||||
VIPS_ARG_INT( class, "y", 4,
|
||||
_( "Y" ),
|
||||
_( "Top edge of sub in main" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsInsert, y ),
|
||||
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
|
||||
|
||||
VIPS_ARG_BOOL( class, "expand", 4,
|
||||
VIPS_ARG_BOOL( class, "expand", 5,
|
||||
_( "Expand" ),
|
||||
_( "Expand output to hold all of both inputs" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsInsert, expand ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_BOXED( class, "background", 5,
|
||||
VIPS_ARG_BOXED( class, "background", 6,
|
||||
_( "Background" ),
|
||||
_( "Color for new pixels" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
|
@ -228,19 +228,19 @@ vips_join_class_init( VipsJoinClass *class )
|
||||
vobject_class->description = _( "join a pair of images" );
|
||||
vobject_class->build = vips_join_build;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "in1", -1,
|
||||
VIPS_ARG_IMAGE( class, "in1", 0,
|
||||
_( "in1" ),
|
||||
_( "First input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsJoin, in1 ) );
|
||||
|
||||
VIPS_ARG_IMAGE( class, "in2", 0,
|
||||
VIPS_ARG_IMAGE( class, "in2", 1,
|
||||
_( "in2" ),
|
||||
_( "Second input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsJoin, in2 ) );
|
||||
|
||||
VIPS_ARG_ENUM( class, "direction", 2,
|
||||
VIPS_ARG_ENUM( class, "direction", 3,
|
||||
_( "direction" ),
|
||||
_( "Join left-right or up-down" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
@ -268,7 +268,7 @@ vips_join_class_init( VipsJoinClass *class )
|
||||
G_STRUCT_OFFSET( VipsJoin, background ),
|
||||
VIPS_TYPE_ARRAY_DOUBLE );
|
||||
|
||||
VIPS_ARG_ENUM( class, "align", 2,
|
||||
VIPS_ARG_ENUM( class, "align", 7,
|
||||
_( "Align" ),
|
||||
_( "Align on the low, centre or high coordinate edge" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
|
@ -265,27 +265,27 @@ vips_subsample_class_init( VipsSubsampleClass *class )
|
||||
* scanlines, and that confuses vips_sequential().
|
||||
*/
|
||||
|
||||
VIPS_ARG_IMAGE( class, "input", 0,
|
||||
VIPS_ARG_IMAGE( class, "input", 1,
|
||||
_( "Input" ),
|
||||
_( "Input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsSubsample, in ) );
|
||||
|
||||
VIPS_ARG_INT( class, "xfac", 2,
|
||||
VIPS_ARG_INT( class, "xfac", 3,
|
||||
_( "Xfac" ),
|
||||
_( "Horizontal subsample factor" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsSubsample, xfac ),
|
||||
1, VIPS_MAX_COORD, 1 );
|
||||
|
||||
VIPS_ARG_INT( class, "yfac", 3,
|
||||
VIPS_ARG_INT( class, "yfac", 4,
|
||||
_( "Yfac" ),
|
||||
_( "Vertical subsample factor" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsSubsample, yfac ),
|
||||
1, VIPS_MAX_COORD, 1 );
|
||||
|
||||
VIPS_ARG_BOOL( class, "point", 2,
|
||||
VIPS_ARG_BOOL( class, "point", 5,
|
||||
_( "Point" ),
|
||||
_( "Point sample" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
|
@ -374,20 +374,20 @@ vips_zoom_class_init( VipsZoomClass *class )
|
||||
|
||||
operation_class->flags = VIPS_OPERATION_SEQUENTIAL_UNBUFFERED;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "input", 0,
|
||||
VIPS_ARG_IMAGE( class, "input", 1,
|
||||
_( "Input" ),
|
||||
_( "Input image" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsZoom, in ) );
|
||||
|
||||
VIPS_ARG_INT( class, "xfac", 2,
|
||||
VIPS_ARG_INT( class, "xfac", 3,
|
||||
_( "Xfac" ),
|
||||
_( "Horizontal zoom factor" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
G_STRUCT_OFFSET( VipsZoom, xfac ),
|
||||
1, VIPS_MAX_COORD, 1 );
|
||||
|
||||
VIPS_ARG_INT( class, "yfac", 3,
|
||||
VIPS_ARG_INT( class, "yfac", 4,
|
||||
_( "Yfac" ),
|
||||
_( "Vertical zoom factor" ),
|
||||
VIPS_ARGUMENT_REQUIRED_INPUT,
|
||||
|
@ -2749,7 +2749,7 @@ vips__relational_vec( IMAGE *in, IMAGE *out,
|
||||
{
|
||||
VipsImage *t;
|
||||
|
||||
if( vips_relational_const( in, &t, relational, c, n,
|
||||
if( vips_relational_const( in, &t, c, n, relational,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
if( vips_image_write( t, out ) ) {
|
||||
@ -2921,7 +2921,7 @@ vips__boolean_vec( IMAGE *in, IMAGE *out,
|
||||
{
|
||||
VipsImage *t;
|
||||
|
||||
if( vips_boolean_const( in, &t, boolean, c, n,
|
||||
if( vips_boolean_const( in, &t, c, n, boolean,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
if( vips_image_write( t, out ) ) {
|
||||
@ -3008,7 +3008,7 @@ vips__math2_vec( IMAGE *in, IMAGE *out,
|
||||
{
|
||||
VipsImage *t;
|
||||
|
||||
if( vips_math2_const( in, &t, math2, c, n,
|
||||
if( vips_math2_const( in, &t, c, n, math2,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
if( vips_image_write( t, out ) ) {
|
||||
|
@ -279,7 +279,7 @@ int vips_more( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
||||
int vips_moreeq( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_relational_const( VipsImage *in, VipsImage **out,
|
||||
VipsOperationRelational relational, double *c, int n, ... )
|
||||
double *c, int n, VipsOperationRelational relational, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
__attribute__((sentinel));
|
||||
@ -294,7 +294,7 @@ int vips_more_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
int vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_relational_const1( VipsImage *in, VipsImage **out,
|
||||
VipsOperationRelational relational, double c, ... )
|
||||
double c, VipsOperationRelational relational, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
__attribute__((sentinel));
|
||||
@ -324,7 +324,7 @@ int vips_rshift( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
||||
__attribute__((sentinel));
|
||||
|
||||
int vips_boolean_const( VipsImage *in, VipsImage **out,
|
||||
VipsOperationBoolean boolean, double *c, int n, ... )
|
||||
double *c, int n, VipsOperationBoolean boolean, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_andimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
__attribute__((sentinel));
|
||||
@ -337,7 +337,7 @@ int vips_lshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
int vips_rshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_boolean_const1( VipsImage *in, VipsImage **out,
|
||||
VipsOperationBoolean boolean, double c, ... )
|
||||
double c, VipsOperationBoolean boolean, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_andimage_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
__attribute__((sentinel));
|
||||
@ -358,14 +358,14 @@ int vips_pow( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
||||
int vips_wop( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_math2_const( VipsImage *in, VipsImage **out,
|
||||
VipsOperationMath2 math2, double *c, int n, ... )
|
||||
double *c, int n, VipsOperationMath2 math2, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_pow_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_wop_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_math2_const1( VipsImage *in, VipsImage **out,
|
||||
VipsOperationMath2 math2, double c, ... )
|
||||
double c, VipsOperationMath2 math2, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_pow_const1( VipsImage *in, VipsImage **out, double c, ... )
|
||||
__attribute__((sentinel));
|
||||
|
@ -1661,6 +1661,20 @@ vips_object_init( VipsObject *object )
|
||||
g_mutex_unlock( vips__object_all_lock );
|
||||
}
|
||||
|
||||
static void *
|
||||
traverse_find_required_priority( void *data, void *a, void *b )
|
||||
{
|
||||
VipsArgumentClass *argument_class = (VipsArgumentClass *) data;
|
||||
int priority = GPOINTER_TO_INT( a );
|
||||
|
||||
if( (argument_class->flags & VIPS_ARGUMENT_REQUIRED) &&
|
||||
!(argument_class->flags & VIPS_ARGUMENT_DEPRECATED) &&
|
||||
argument_class->priority == priority )
|
||||
return( argument_class );
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
static gint
|
||||
traverse_sort( gconstpointer a, gconstpointer b )
|
||||
{
|
||||
@ -1677,7 +1691,9 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
|
||||
GParamSpec *pspec, VipsArgumentFlags flags, int priority, guint offset )
|
||||
{
|
||||
VipsArgumentClass *argument_class = g_new( VipsArgumentClass, 1 );
|
||||
|
||||
GSList *argument_table_traverse;
|
||||
VipsArgumentClass *ac;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_object_class_install_argument: %p %s %s\n",
|
||||
@ -1731,6 +1747,21 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
|
||||
argument_table_traverse =
|
||||
g_slist_copy( object_class->argument_table_traverse );
|
||||
|
||||
/* We keep traverse sorted by priority, so we musn't have duplicate
|
||||
* priority values in required args.
|
||||
*/
|
||||
if( (flags & VIPS_ARGUMENT_REQUIRED) &&
|
||||
!(flags & VIPS_ARGUMENT_DEPRECATED) &&
|
||||
(ac = vips_slist_map2( argument_table_traverse,
|
||||
traverse_find_required_priority,
|
||||
GINT_TO_POINTER( priority ), NULL )) )
|
||||
g_warning( "vips_object_class_install_argument: "
|
||||
"%s.%s, %s.%s duplicate priority",
|
||||
g_type_name( G_TYPE_FROM_CLASS( object_class ) ),
|
||||
g_param_spec_get_name( pspec ),
|
||||
g_type_name( G_TYPE_FROM_CLASS( ac->object_class ) ),
|
||||
g_param_spec_get_name( ((VipsArgument *) ac)->pspec ) );
|
||||
|
||||
argument_table_traverse = g_slist_prepend(
|
||||
argument_table_traverse, argument_class );
|
||||
argument_table_traverse = g_slist_sort(
|
||||
|
Loading…
Reference in New Issue
Block a user