diff --git a/ChangeLog b/ChangeLog index 12b0b90e..747d1ff4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ - add @background arg to save: the colour to flatten against - add VIPS_ARGUMENT_MODIFY flag ... used for draw_circle etc, meaning an op which modifies its argument +- rename VIPS_OPERATION_RELATIONAL_NOTEQUAL as VIPS_OPERATION_RELATIONAL_NOTEQ + for consistency 8/9/14 started 7.40.9 - support jfif resunit "none" diff --git a/libvips/arithmetic/relational.c b/libvips/arithmetic/relational.c index d9c78a04..42faaeb9 100644 --- a/libvips/arithmetic/relational.c +++ b/libvips/arithmetic/relational.c @@ -149,7 +149,7 @@ vips_relational_build( VipsObject *object ) } #define CEQUAL( x1, y1, x2, y2 ) (x1 == x2 && y1 == y2) -#define CNOTEQUAL( x1, y1, x2, y2 ) (x1 != x2 || y1 != y2) +#define CNOTEQ( x1, y1, x2, y2 ) (x1 != x2 || y1 != y2) #define CLESS( x1, y1, x2, y2 ) (x1 * x1 + y1 * y1 < x2 * x2 + y2 * y2) #define CLESSEQ( x1, y1, x2, y2 ) (x1 * x1 + y1 * y1 <= x2 * x2 + y2 * y2) #define CMORE( x1, y1, x2, y2 ) (x1 * x1 + y1 * y1 > x2 * x2 + y2 * y2) @@ -170,8 +170,8 @@ vips_relational_buffer( VipsArithmetic *arithmetic, SWITCH( RLOOP, CLOOP, ==, CEQUAL ); break; - case VIPS_OPERATION_RELATIONAL_NOTEQUAL: - SWITCH( RLOOP, CLOOP, !=, CNOTEQUAL ); + case VIPS_OPERATION_RELATIONAL_NOTEQ: + SWITCH( RLOOP, CLOOP, !=, CNOTEQ ); break; case VIPS_OPERATION_RELATIONAL_LESS: @@ -327,7 +327,7 @@ vips_equal( VipsImage *left, VipsImage *right, VipsImage **out, ... ) * @out: output #VipsImage * @...: %NULL-terminated list of optional named arguments * - * Perform #VIPS_OPERATION_RELATIONAL_NOTEQUAL on a pair of images. See + * Perform #VIPS_OPERATION_RELATIONAL_NOTEQ on a pair of images. See * vips_relational(). * * Returns: 0 on success, -1 on error @@ -340,7 +340,7 @@ vips_notequal( VipsImage *left, VipsImage *right, VipsImage **out, ... ) va_start( ap, out ); result = vips_relationalv( left, right, out, - VIPS_OPERATION_RELATIONAL_NOTEQUAL, ap ); + VIPS_OPERATION_RELATIONAL_NOTEQ, ap ); va_end( ap ); return( result ); @@ -517,8 +517,8 @@ vips_relational_const_buffer( VipsArithmetic *arithmetic, SWITCH( RLOOPC, CLOOPC, ==, CEQUAL ); break; - case VIPS_OPERATION_RELATIONAL_NOTEQUAL: - SWITCH( RLOOPC, CLOOPC, !=, CNOTEQUAL ); + case VIPS_OPERATION_RELATIONAL_NOTEQ: + SWITCH( RLOOPC, CLOOPC, !=, CNOTEQ ); break; case VIPS_OPERATION_RELATIONAL_LESS: @@ -672,7 +672,7 @@ vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... ) * @n: number of constants in @c * @...: %NULL-terminated list of optional named arguments * - * Perform #VIPS_OPERATION_RELATIONAL_NOTEQUAL on an image and a constant. See + * Perform #VIPS_OPERATION_RELATIONAL_NOTEQ on an image and a constant. See * vips_relational_const(). * * Returns: 0 on success, -1 on error @@ -685,7 +685,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_NOTEQUAL, c, n, ap ); + VIPS_OPERATION_RELATIONAL_NOTEQ, c, n, ap ); va_end( ap ); return( result ); @@ -861,7 +861,7 @@ vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... ) * @c: constant * @...: %NULL-terminated list of optional named arguments * - * Perform #VIPS_OPERATION_RELATIONAL_NOTEQUAL on an image and a constant. See + * Perform #VIPS_OPERATION_RELATIONAL_NOTEQ on an image and a constant. See * vips_relational_const(). * * Returns: 0 on success, -1 on error @@ -874,7 +874,7 @@ vips_notequal_const1( VipsImage *in, VipsImage **out, double c, ... ) va_start( ap, c ); result = vips_relational_constv( in, out, - VIPS_OPERATION_RELATIONAL_NOTEQUAL, &c, 1, ap ); + VIPS_OPERATION_RELATIONAL_NOTEQ, &c, 1, ap ); va_end( ap ); return( result ); diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 645f1a54..b686da57 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -2631,7 +2631,7 @@ int im_notequal( IMAGE *in1, IMAGE *in2, IMAGE *out ) { return( vips__relational( in1, in2, out, - VIPS_OPERATION_RELATIONAL_NOTEQUAL ) ); + VIPS_OPERATION_RELATIONAL_NOTEQ ) ); } int @@ -2691,7 +2691,7 @@ int im_notequal_vec( VipsImage *in, VipsImage *out, int n, double *c ) { return( vips__relational_vec( in, out, - VIPS_OPERATION_RELATIONAL_NOTEQUAL, c, n ) ); + VIPS_OPERATION_RELATIONAL_NOTEQ, c, n ) ); } int diff --git a/libvips/include/vips/arithmetic.h b/libvips/include/vips/arithmetic.h index d6b9579c..7e41da07 100644 --- a/libvips/include/vips/arithmetic.h +++ b/libvips/include/vips/arithmetic.h @@ -98,7 +98,7 @@ typedef enum { /** * VipsOperationRelational: * @VIPS_OPERATION_RELATIONAL_EQUAL: == - * @VIPS_OPERATION_RELATIONAL_NOTEQUAL: != + * @VIPS_OPERATION_RELATIONAL_NOTEQ: != * @VIPS_OPERATION_RELATIONAL_LESS: < * @VIPS_OPERATION_RELATIONAL_LESSEQ: <= * @VIPS_OPERATION_RELATIONAL_MORE: > @@ -108,7 +108,7 @@ typedef enum { */ typedef enum { VIPS_OPERATION_RELATIONAL_EQUAL, - VIPS_OPERATION_RELATIONAL_NOTEQUAL, + VIPS_OPERATION_RELATIONAL_NOTEQ, VIPS_OPERATION_RELATIONAL_LESS, VIPS_OPERATION_RELATIONAL_LESSEQ, VIPS_OPERATION_RELATIONAL_MORE, diff --git a/libvips/iofuncs/enumtypes.c b/libvips/iofuncs/enumtypes.c index ede5e081..69066f76 100644 --- a/libvips/iofuncs/enumtypes.c +++ b/libvips/iofuncs/enumtypes.c @@ -337,7 +337,7 @@ vips_operation_relational_get_type( void ) if( etype == 0 ) { static const GEnumValue values[] = { {VIPS_OPERATION_RELATIONAL_EQUAL, "VIPS_OPERATION_RELATIONAL_EQUAL", "equal"}, - {VIPS_OPERATION_RELATIONAL_NOTEQUAL, "VIPS_OPERATION_RELATIONAL_NOTEQUAL", "notequal"}, + {VIPS_OPERATION_RELATIONAL_NOTEQ, "VIPS_OPERATION_RELATIONAL_NOTEQ", "noteq"}, {VIPS_OPERATION_RELATIONAL_LESS, "VIPS_OPERATION_RELATIONAL_LESS", "less"}, {VIPS_OPERATION_RELATIONAL_LESSEQ, "VIPS_OPERATION_RELATIONAL_LESSEQ", "lesseq"}, {VIPS_OPERATION_RELATIONAL_MORE, "VIPS_OPERATION_RELATIONAL_MORE", "more"}, diff --git a/python/vips8/vips.py b/python/vips8/vips.py index e187a6b0..f0068caf 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -132,7 +132,7 @@ def _call_base(name, required, optional, self = None, option_string = None): # do we have a non-None self pointer? this is used to set the first # compatible input arg - if self != None: + if self is not None: found = False for x in required_input: if GObject.type_is_a(self, x.prop.value_type): @@ -424,6 +424,36 @@ def vips_more(self, other): else: return self.relational_const(Vips.OperationRelational.MORE, other) +def vips_moreeq(self, other): + if isinstance(other, Vips.Image): + return self.relational(other, Vips.OperationRelational.MOREEQ) + else: + return self.relational_const(Vips.OperationRelational.MOREEQ, other) + +def vips_less(self, other): + if isinstance(other, Vips.Image): + return self.relational(other, Vips.OperationRelational.MORE) + else: + return self.relational_const(Vips.OperationRelational.MORE, other) + +def vips_lesseq(self, other): + if isinstance(other, Vips.Image): + return self.relational(other, Vips.OperationRelational.LESSEQ) + else: + return self.relational_const(Vips.OperationRelational.LESSEQ, other) + +def vips_equal(self, other): + if isinstance(other, Vips.Image): + return self.relational(other, Vips.OperationRelational.EQUAL) + else: + return self.relational_const(Vips.OperationRelational.EQUAL, other) + +def vips_notequal(self, other): + if isinstance(other, Vips.Image): + return self.relational(other, Vips.OperationRelational.NOTEQ) + else: + return self.relational_const(Vips.OperationRelational.NOTEQ, other) + def vips_neg(self): return -1 * self