finish revising new docs

This commit is contained in:
John Cupitt 2011-11-18 14:34:33 +00:00
parent d401db768d
commit 3b238d4e7e
22 changed files with 1428 additions and 461 deletions

View File

@ -71,34 +71,6 @@
#include "binary.h"
#include "unaryconst.h"
/**
* VipsRelational:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @relational: relational operation to perform
*
* Perform various relational operations on pairs of images.
*
* The output type is always uchar, with 0 for FALSE and 255 for TRUE.
*
* Less-than and greater-than for complex images compare the modulus.
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: #VipsBoolean, #VipsRelationalConst.
*/
typedef struct _VipsRelational {
VipsBinary parent_instance;
@ -263,6 +235,44 @@ vips_relational_init( VipsRelational *relational )
{
}
static int
vips_relationalv( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationRelational relational, va_list ap )
{
return( vips_call_split( "relational", ap, left, right, out,
relational ) );
}
/**
* vips_relational:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @relational: relational operation to perform
* @...: %NULL-terminated list of optional named arguments
*
* Perform various relational operations on pairs of images.
*
* The output type is always uchar, with 0 for FALSE and 255 for TRUE.
*
* Less-than and greater-than for complex images compare the modulus.
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: vips_boolean(), vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_relational( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationRelational relational, ... )
@ -271,33 +281,167 @@ vips_relational( VipsImage *left, VipsImage *right, VipsImage **out,
int result;
va_start( ap, relational );
result = vips_call_split( "relational", ap, left, right, out,
relational );
result = vips_relationalv( left, right, out, relational, ap );
va_end( ap );
return( result );
}
/**
* VipsRelationalConst:
* @in: input image
* @out: output image
* @a: array of constants
* @relational: relational operation to perform
* vips_equal:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform various relational operations on an image against a constant.
* Perform #VIPS_OPERATION_RELATIONAL_EQUAL on a pair of images. See
* vips_relational().
*
* The output type is always uchar, with 0 for FALSE and 255 for TRUE.
*
* If the array of constants has just one element, that constant is used for
* all image bands. If the array has more than one element and they have
* the same number of elements as there are bands in the image, then
* one array element is used for each band. If the arrays have more than one
* element and the image only has a single band, the result is a many-band
* image where each band corresponds to one array element.
*
* See also: #VipsBoolean, #VipsRelational.
* Returns: 0 on success, -1 on error
*/
int
vips_equal( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_relationalv( left, right, out,
VIPS_OPERATION_RELATIONAL_EQUAL, ap );
va_end( ap );
return( result );
}
/**
* vips_notequal:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_NOTEQUAL on a pair of images. See
* vips_relational().
*
* Returns: 0 on success, -1 on error
*/
int
vips_notequal( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_relationalv( left, right, out,
VIPS_OPERATION_RELATIONAL_NOTEQUAL, ap );
va_end( ap );
return( result );
}
/**
* vips_more:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_MORE on a pair of images. See
* vips_relational().
*
* Returns: 0 on success, -1 on error
*/
int
vips_more( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_relationalv( left, right, out,
VIPS_OPERATION_RELATIONAL_MORE, ap );
va_end( ap );
return( result );
}
/**
* vips_moreeq:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_MOREEQ on a pair of images. See
* vips_relational().
*
* Returns: 0 on success, -1 on error
*/
int
vips_moreeq( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_relationalv( left, right, out,
VIPS_OPERATION_RELATIONAL_MOREEQ, ap );
va_end( ap );
return( result );
}
/**
* vips_less:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_LESS on a pair of images. See
* vips_relational().
*
* Returns: 0 on success, -1 on error
*/
int
vips_less( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_relationalv( left, right, out,
VIPS_OPERATION_RELATIONAL_LESS, ap );
va_end( ap );
return( result );
}
/**
* vips_lesseq:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_LESSEQ on a pair of images. See
* vips_relational().
*
* Returns: 0 on success, -1 on error
*/
int
vips_lesseq( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_relationalv( left, right, out,
VIPS_OPERATION_RELATIONAL_LESSEQ, ap );
va_end( ap );
return( result );
}
typedef struct _VipsRelationalConst {
VipsUnaryConst parent_instance;
@ -446,6 +590,31 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
return( result );
}
/**
* vips_relational_const:
* @in: input image
* @out: output image
* @relational: relational operation to perform
* @c: array of constants
* @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments
*
* Perform various relational operations on an image and an array of
* constants.
*
* The output type is always uchar, with 0 for FALSE and 255 for TRUE.
*
* If the array of constants has just one element, that constant is used for
* all image bands. If the array has more than one element and they have
* the same number of elements as there are bands in the image, then
* one array element is used for each band. If the arrays have more than one
* element and the image only has a single band, the result is a many-band
* image where each band corresponds to one array element.
*
* See also: vips_boolean(), vips_relational().
*
* Returns: 0 on success, -1 on error
*/
int
vips_relational_const( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double *c, int n, ... )
@ -460,6 +629,183 @@ vips_relational_const( VipsImage *in, VipsImage **out,
return( result );
}
/**
* vips_equal_const:
* @in: input #VipsImage
* @out: output #VipsImage
* @c: array of constants
* @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_EQUAL, c, n, ap );
va_end( ap );
return( result );
}
/**
* vips_notequal_const:
* @in: input #VipsImage
* @out: output #VipsImage
* @c: array of constants
* @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
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_notequal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_NOTEQUAL, c, n, ap );
va_end( ap );
return( result );
}
/**
* vips_less_const:
* @in: input #VipsImage
* @out: output #VipsImage
* @c: array of constants
* @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_LESS on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_less_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESS, c, n, ap );
va_end( ap );
return( result );
}
/**
* vips_lesseq_const:
* @in: input #VipsImage
* @out: output #VipsImage
* @c: array of constants
* @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_lesseq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESSEQ, c, n, ap );
va_end( ap );
return( result );
}
/**
* vips_more_const:
* @in: input #VipsImage
* @out: output #VipsImage
* @c: array of constants
* @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_MORE on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_more_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MORE, c, n, ap );
va_end( ap );
return( result );
}
/**
* vips_moreeq_const:
* @in: input #VipsImage
* @out: output #VipsImage
* @c: array of constants
* @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MOREEQ, c, n, ap );
va_end( ap );
return( result );
}
/**
* vips_relational_const1:
* @in: input image
* @out: output image
* @relational: relational operation to perform
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* Perform various relational operations on an image and a constant. See
* vips_relational_const().
*
* See also: vips_boolean(), vips_relational().
*
* Returns: 0 on success, -1 on error
*/
int
vips_relational_const1( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double c, ... )
@ -473,3 +819,160 @@ vips_relational_const1( VipsImage *in, VipsImage **out,
return( result );
}
/**
* vips_equal_const1:
* @in: input image
* @out: output image
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_EQUAL, &c, 1, ap );
va_end( ap );
return( result );
}
/**
* vips_notequal_const1:
* @in: input image
* @out: output image
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_NOTEQUAL on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_notequal_const1( VipsImage *in, VipsImage **out, double c, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_NOTEQUAL, &c, 1, ap );
va_end( ap );
return( result );
}
/**
* vips_less_const1:
* @in: input image
* @out: output image
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_LESS on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_less_const1( VipsImage *in, VipsImage **out, double c, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESS, &c, 1, ap );
va_end( ap );
return( result );
}
/**
* vips_lesseq_const1:
* @in: input image
* @out: output image
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_lesseq_const1( VipsImage *in, VipsImage **out, double c, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESSEQ, &c, 1, ap );
va_end( ap );
return( result );
}
/**
* vips_more_const1:
* @in: input image
* @out: output image
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_MORE on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_more_const1( VipsImage *in, VipsImage **out, double c, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MORE, &c, 1, ap );
va_end( ap );
return( result );
}
/**
* vips_moreeq_const1:
* @in: input image
* @out: output image
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. See
* vips_relational_const().
*
* Returns: 0 on success, -1 on error
*/
int
vips_moreeq_const1( VipsImage *in, VipsImage **out, double c, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MOREEQ, &c, 1, ap );
va_end( ap );
return( result );
}

View File

@ -64,33 +64,6 @@
#include "binary.h"
#include "unaryconst.h"
/**
* VipsRemainder:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
*
* This operation calculates @left % @right (remainder after integer division)
* and writes the result to @out. The images may have any
* non-complex format. For float formats, #VipsRemainder calculates @in1 -
* @in2 * floor (@in1 / @in2).
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>), and that format is the
* result type.
*
* See also: #VipsRemainderConst, #VipsDivide.
*/
typedef VipsBinary VipsRemainder;
typedef VipsBinaryClass VipsRemainderClass;
@ -215,6 +188,35 @@ vips_remainder_init( VipsRemainder *remainder )
{
}
/**
* vips_remainder:
* @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* This operation calculates @left % @right (remainder after integer division)
* and writes the result to @out. The images may have any
* non-complex format. For float formats, vips_remainder() calculates @in1 -
* @in2 * floor (@in1 / @in2).
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>), and that format is the
* result type.
*
* See also: vips_remainder_const(), vips_divide(), vips_round().
*
* Returns: 0 on success, -1 on error
*/
int
vips_remainder( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{
@ -228,28 +230,6 @@ vips_remainder( VipsImage *left, VipsImage *right, VipsImage **out, ... )
return( result );
}
/**
* VipsRemainderConst:
* @in: input image
* @out: output image
* @a: array of constants
*
* This operation calculates @in % @c (remainder after division by constant)
* and writes the result to @out.
* The image may have any
* non-complex format. For float formats, im_remainder() calculates @in -
* @c * floor (@in / @c).
*
* If the array of constants has just one element, that constant is used for
* all image bands. If the array has more than one element and they have
* the same number of elements as there are bands in the image, then
* one array element is used for each band. If the arrays have more than one
* element and the image only has a single band, the result is a many-band
* image where each band corresponds to one array element.
*
* See also: #VipsRemainder, #VipsDivide.
*/
typedef VipsUnaryConst VipsRemainderConst;
typedef VipsUnaryConstClass VipsRemainderConstClass;
@ -379,6 +359,32 @@ vips_remainder_constv( VipsImage *in, VipsImage **out,
return( result );
}
/**
* vips_remainder_const:
* @in: input image
* @out: output image
* @c: array of constants
* @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments
*
* This operation calculates @in % @c (remainder after division by an
* array of constants)
* and writes the result to @out.
* The image may have any
* non-complex format. For float formats, vips_remainder_const() calculates
* @in - @c * floor (@in / @c).
*
* If the array of constants has just one element, that constant is used for
* all image bands. If the array has more than one element and they have
* the same number of elements as there are bands in the image, then
* one array element is used for each band. If the arrays have more than one
* element and the image only has a single band, the result is a many-band
* image where each band corresponds to one array element.
*
* See also: vips_remainder(), vips_divide(), vips_round().
*
* Returns: 0 on success, -1 on error
*/
int
vips_remainder_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
{
@ -392,6 +398,31 @@ vips_remainder_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
return( result );
}
/**
* vips_remainder_const1:
* @in: input image
* @out: output image
* @c: constant
* @...: %NULL-terminated list of optional named arguments
*
* This operation calculates @in % @c (remainder after division by a
* constant)
* and writes the result to @out.
* The image may have any
* non-complex format. For float formats, vips_remainder_const() calculates
* @in - @c * floor (@in / @c).
*
* If the array of constants has just one element, that constant is used for
* all image bands. If the array has more than one element and they have
* the same number of elements as there are bands in the image, then
* one array element is used for each band. If the arrays have more than one
* element and the image only has a single band, the result is a many-band
* image where each band corresponds to one array element.
*
* See also: vips_remainder(), vips_divide(), vips_round().
*
* Returns: 0 on success, -1 on error
*/
int
vips_remainder_const1( VipsImage *in, VipsImage **out, double c, ... )
{

View File

@ -54,20 +54,6 @@
#include "unary.h"
/**
* VipsRound:
* @in: input #VipsImage
* @out: output #VipsImage
* @round: #VipsOperationRound rounding operation to perform
*
* Round to an integral value.
*
* Copy for integer types, round float and
* complex types. Output type == input type.
*
* See also: #VipsCast.
*/
typedef struct _VipsRound {
VipsUnary parent_instance;
@ -141,9 +127,9 @@ vips_round_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
int x;
switch( round->round ) {
case VIPS_OPERATION_ROUND_NEAREST: SWITCH( VIPS_RINT ); break;
case VIPS_OPERATION_ROUND_CEIL: SWITCH( ceil ); break;
case VIPS_OPERATION_ROUND_FLOOR: SWITCH( floor ); break;
case VIPS_OPERATION_ROUND_RINT: SWITCH( VIPS_RINT ); break;
case VIPS_OPERATION_ROUND_CEIL: SWITCH( ceil ); break;
case VIPS_OPERATION_ROUND_FLOOR: SWITCH( floor ); break;
default:
g_assert( 0 );
@ -191,7 +177,7 @@ vips_round_class_init( VipsRoundClass *class )
_( "rounding operation to perform" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsRound, round ),
VIPS_TYPE_OPERATION_ROUND, VIPS_OPERATION_ROUND_NEAREST );
VIPS_TYPE_OPERATION_ROUND, VIPS_OPERATION_ROUND_RINT );
}
static void
@ -199,6 +185,32 @@ vips_round_init( VipsRound *round )
{
}
static int
vips_roundv( VipsImage *in, VipsImage **out,
VipsOperationRound round, va_list ap )
{
return( vips_call_split( "round", ap, in, out, round ) );
}
/**
* vips_round:
* @in: input #VipsImage
* @out: output #VipsImage
* @round: #VipsOperationRound rounding operation to perform
* @...: %NULL-terminated list of optional named arguments
*
* Round to an integral value.
*
* Copy for integer types, round float and
* complex types.
*
* The format of @out is always the same as @in, so you may wish to cast to an
* integer format afterwards.
*
* See also: vips_cast()
*
* Returns: 0 on success, -1 on error
*/
int
vips_round( VipsImage *in, VipsImage **out, VipsOperationRound round, ... )
{
@ -206,7 +218,79 @@ vips_round( VipsImage *in, VipsImage **out, VipsOperationRound round, ... )
int result;
va_start( ap, round );
result = vips_call_split( "round", ap, in, out, round );
result = vips_roundv( in, out, round, ap );
va_end( ap );
return( result );
}
/**
* vips_floor:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Round to an integral value with #VIPS_OPERATION_ROUND_FLOOR. See
* vips_round().
*
* Returns: 0 on success, -1 on error
*/
int
vips_floor( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_roundv( in, out, VIPS_OPERATION_ROUND_FLOOR, ap );
va_end( ap );
return( result );
}
/**
* vips_ceil:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Round to an integral value with #VIPS_OPERATION_ROUND_CEIL. See
* vips_round().
*
* Returns: 0 on success, -1 on error
*/
int
vips_ceil( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_roundv( in, out, VIPS_OPERATION_ROUND_CEIL, ap );
va_end( ap );
return( result );
}
/**
* vips_rint:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Round to an integral value with #VIPS_OPERATION_ROUND_RINT. See
* vips_round().
*
* Returns: 0 on success, -1 on error
*/
int
vips_rint( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_roundv( in, out, VIPS_OPERATION_ROUND_RINT, ap );
va_end( ap );
return( result );

View File

@ -51,19 +51,6 @@
#include "unary.h"
/**
* VipsSign:
* @in: input image
* @out: output image
*
* Finds the unit vector in the direction of the pixel value. For non-complex
* images, it returns a signed char image with values -1, 0, and 1 for negative,
* zero and positive pixels. For complex images, it returns a
* complex normalised to length 1.
*
* See also: #VipsAbs.
*/
typedef VipsUnary VipsSign;
typedef VipsUnaryClass VipsSignClass;
@ -172,6 +159,20 @@ vips_sign_init( VipsSign *sign )
{
}
/**
* vips_sign:
* @in: input image
* @out: output image
*
* Finds the unit vector in the direction of the pixel value. For non-complex
* images, it returns a signed char image with values -1, 0, and 1 for negative,
* zero and positive pixels. For complex images, it returns a
* complex normalised to length 1.
*
* See also: vips_abs().
*
* Returns: 0 on success, -1 on error
*/
int
vips_sign( VipsImage *in, VipsImage **out, ... )
{

View File

@ -73,25 +73,6 @@
#include "statistic.h"
/**
* VipsStats:
* @in: image to scan
* @out: image of statistics
*
* Find many image statistics in a single pass through the data. @out is a
* one-band #VIPS_FORMAT_DOUBLE image of at least 10 columns by n + 1
* (where n is number of bands in image @in)
* rows. Columns are statistics, and are, in order: minimum, maximum, sum,
* sum of squares, mean, standard deviation, x coordinate of minimum, y
* coordinate of minimum, x coordinate of maximum, y coordinate of maximum.
* Later versions of VipsStats may add more columns.
*
* Row 0 has statistics for all
* bands together, row 1 has stats for band 1, and so on.
*
* See also: #VipsAvg, #VipsMin, and friends.
*/
typedef struct _VipsStats {
VipsStatistic parent_instance;
@ -386,6 +367,27 @@ vips_stats_init( VipsStats *stats )
{
}
/**
* vips_stats:
* @in: image to scan
* @out: image of statistics
* @...: %NULL-terminated list of optional named arguments
*
* Find many image statistics in a single pass through the data. @out is a
* one-band #VIPS_FORMAT_DOUBLE image of at least 10 columns by n + 1
* (where n is number of bands in image @in)
* rows. Columns are statistics, and are, in order: minimum, maximum, sum,
* sum of squares, mean, standard deviation, x coordinate of minimum, y
* coordinate of minimum, x coordinate of maximum, y coordinate of maximum.
* Later versions of vips_stats() may add more columns.
*
* Row 0 has statistics for all
* bands together, row 1 has stats for band 1, and so on.
*
* See also: vips_avg(), vips_min().
*
* Returns: 0 on success, -1 on error
*/
int
vips_stats( VipsImage *in, VipsImage **out, ... )
{

View File

@ -76,89 +76,6 @@
#include "binary.h"
/**
* VipsSubtract:
* @in1: input image
* @in2: input image
* @out: output image
*
* This operation calculates @in1 - @in2 and writes the result to @out.
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>), then the
* following table is used to determine the output type:
*
* <table>
* <title>VipsSubtract type promotion</title>
* <tgroup cols='2' align='left' colsep='1' rowsep='1'>
* <thead>
* <row>
* <entry>input type</entry>
* <entry>output type</entry>
* </row>
* </thead>
* <tbody>
* <row>
* <entry>uchar</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>char</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>ushort</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>short</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>uint</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>int</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>float</entry>
* <entry>float</entry>
* </row>
* <row>
* <entry>double</entry>
* <entry>double</entry>
* </row>
* <row>
* <entry>complex</entry>
* <entry>complex</entry>
* </row>
* <row>
* <entry>double complex</entry>
* <entry>double complex</entry>
* </row>
* </tbody>
* </tgroup>
* </table>
*
* In other words, the output type is just large enough to hold the whole
* range of possible values.
*
* See also: #VipsAdd, #VipsLinear.
*
* Returns: 0 on success, -1 on error
*/
typedef VipsBinary VipsSubtract;
typedef VipsBinaryClass VipsSubtractClass;
@ -253,6 +170,89 @@ vips_subtract_init( VipsSubtract *subtract )
{
}
/**
* vips_subtract:
* @in1: input image
* @in2: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* This operation calculates @in1 - @in2 and writes the result to @out.
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>), then the
* following table is used to determine the output type:
*
* <table>
* <title>VipsSubtract type promotion</title>
* <tgroup cols='2' align='left' colsep='1' rowsep='1'>
* <thead>
* <row>
* <entry>input type</entry>
* <entry>output type</entry>
* </row>
* </thead>
* <tbody>
* <row>
* <entry>uchar</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>char</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>ushort</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>short</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>uint</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>int</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>float</entry>
* <entry>float</entry>
* </row>
* <row>
* <entry>double</entry>
* <entry>double</entry>
* </row>
* <row>
* <entry>complex</entry>
* <entry>complex</entry>
* </row>
* <row>
* <entry>double complex</entry>
* <entry>double complex</entry>
* </row>
* </tbody>
* </tgroup>
* </table>
*
* In other words, the output type is just large enough to hold the whole
* range of possible values.
*
* See also: vips_add(), vips_linear().
*
* Returns: 0 on success, -1 on error
*/
int
vips_subtract( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{

View File

@ -72,27 +72,6 @@
#include "conversion.h"
/**
* VipsBandjoin:
* @in: vector of input images
* @out: output image
*
* Join a set of images together, bandwise.
* If the images
* have n and m bands, then the output image will have n + m
* bands, with the first n coming from the first image and the last m
* from the second.
*
* If the images differ in size, the smaller images are enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* The input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: #VipsInsert.
*/
typedef struct _VipsBandjoin {
VipsConversion parent_instance;
@ -244,10 +223,9 @@ vips_bandjoin_init( VipsBandjoin *bandjoin )
*/
}
int
vips_bandjoin( VipsImage **in, VipsImage **out, int n, ... )
static int
vips_bandjoinv( VipsImage **in, VipsImage **out, int n, va_list ap )
{
va_list ap;
VipsArea *area;
VipsImage **array;
int i;
@ -260,35 +238,75 @@ vips_bandjoin( VipsImage **in, VipsImage **out, int n, ... )
g_object_ref( array[i] );
}
va_start( ap, n );
result = vips_call_split( "bandjoin", ap, area, out );
va_end( ap );
vips_area_unref( area );
return( result );
}
/**
* vips_bandjoin:
* @in: array of input images
* @out: output image
* @n: number of input images
* @...: %NULL-terminated list of optional named arguments
*
* Join a set of images together, bandwise.
*
* If the images
* have n and m bands, then the output image will have n + m
* bands, with the first n coming from the first image and the last m
* from the second.
*
* If the images differ in size, the smaller images are enlarged to match the
* larger by adding zero pixels along the bottom and right.
*
* The input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: vips_insert().
*
* Returns: 0 on success, -1 on error
*/
int
vips_bandjoin( VipsImage **in, VipsImage **out, int n, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_bandjoinv( in, out, n, ap );
va_end( ap );
return( result );
}
/**
* vips_bandjoin2:
* @in1: first input image
* @in2: second input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Join a pair of images together, bandwise. See vips_bandjoin().
*
* Returns: 0 on success, -1 on error
*/
int
vips_bandjoin2( VipsImage *in1, VipsImage *in2, VipsImage **out, ... )
{
va_list ap;
VipsArea *area;
VipsImage **array;
int result;
VipsImage *in[2];
area = vips_area_new_array_object( 2 );
array = (VipsImage **) area->data;
array[0] = in1;
array[1] = in2;
g_object_ref( array[0] );
g_object_ref( array[1] );
in[0] = in1;
in[1] = in2;
va_start( ap, out );
result = vips_call_split( "bandjoin", ap, area, out );
result = vips_bandjoinv( in, out, 2, ap );
va_end( ap );
vips_area_unref( area );
return( result );
}

View File

@ -62,18 +62,6 @@
#include "conversion.h"
/**
* VipsBlack:
* @out: output image
* @width: output width
* @height: output height
* @bands: output bands
*
* Make a black unsigned char image of a specified size.
*
* See also: im_make_xy(), im_text(), im_gaussnoise().
*/
typedef struct _VipsBlack {
VipsConversion parent_instance;
@ -167,6 +155,20 @@ vips_black_init( VipsBlack *black )
black->bands = 1;
}
/**
* vips_black:
* @out: output image
* @width: output width
* @height: output height
* @bands: output bands
* @...: %NULL-terminated list of optional named arguments
*
* Make a black unsigned char image of a specified size.
*
* See also: im_make_xy(), im_text(), im_gaussnoise().
*
* Returns: 0 on success, -1 on error
*/
int
vips_black( VipsImage **out, int width, int height, ... )
{

View File

@ -93,18 +93,6 @@
#include "conversion.h"
/**
* VipsCast:
* @in: input image
* @out: output image
* @format: format to convert to
*
* Convert @in to @format. You can convert between any pair of formats.
* Floats are truncated (not rounded). Out of range values are clipped.
*
* See also: im_scale(), im_ri2c().
*/
typedef struct _VipsCast {
VipsConversion parent_instance;
@ -502,6 +490,28 @@ vips_cast_init( VipsCast *cast )
{
}
static int
vips_castv( VipsImage *in, VipsImage **out, VipsBandFormat format, va_list ap )
{
return( vips_call_split( "cast", ap, in, out, format ) );
}
/**
* vips_cast:
* @in: input image
* @out: output image
* @format: format to convert to
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to @format. You can convert between any pair of formats.
* Floats are truncated (not rounded). Out of range values are clipped.
*
* Casting from complex to real returns the real part.
*
* See also: im_scale(), im_ri2c().
*
* Returns: 0 on success, -1 on error
*/
int
vips_cast( VipsImage *in, VipsImage **out, VipsBandFormat format, ... )
{
@ -509,8 +519,239 @@ vips_cast( VipsImage *in, VipsImage **out, VipsBandFormat format, ... )
int result;
va_start( ap, format );
result = vips_call_split( "cast", ap, in, out, format );
result = vips_castv( in, out, format, ap );
va_end( ap );
return( result );
}
/**
* vips_uchar:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_UCHAR. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_uchar( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_UCHAR, ap );
va_end( ap );
return( result );
}
/**
* vips_char:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_CHAR. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_char( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_CHAR, ap );
va_end( ap );
return( result );
}
/**
* vips_ushort:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_USHORT. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_ushort( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_USHORT, ap );
va_end( ap );
return( result );
}
/**
* vips_short:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_SHORT. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_short( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_SHORT, ap );
va_end( ap );
return( result );
}
/**
* vips_uint:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_UINT. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_uint( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_UINT, ap );
va_end( ap );
return( result );
}
/**
* vips_int:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_INT. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_int( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_INT, ap );
va_end( ap );
return( result );
}
/**
* vips_float:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_FLOAT. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_float( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_FLOAT, ap );
va_end( ap );
return( result );
}
/**
* vips_double:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_DOUBLE. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_double( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_DOUBLE, ap );
va_end( ap );
return( result );
}
/**
* vips_complex:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_COMPLEX. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_complex( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_COMPLEX, ap );
va_end( ap );
return( result );
}
/**
* vips_dpcomplex:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert @in to #VIPS_FORMAT_DPCOMPLEX. See vips_cast().
*
* Returns: 0 on success, -1 on error
*/
int
vips_dpcomplex( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_castv( in, out, VIPS_FORMAT_DPCOMPLEX, ap );
va_end( ap );
return( result );
}

View File

@ -92,22 +92,6 @@
#include "conversion.h"
/**
* VipsCopy:
* @in: input image
* @out: output image
*
* Copy an image, optionally modifying the header. VIPS copies images by
* copying pointers, so this operation is fast, even for very large images.
*
* You can optionally set any or all header fields during the copy. Some
* header fields, such as "xres", the horizontal resolution, are safe to
* change in any way, others, such as "width" will cause immediate crashes if
* they are not set carefully.
*
* Returns: 0 on success, -1 on error.
*/
typedef struct _VipsCopy {
VipsConversion parent_instance;
@ -426,6 +410,36 @@ vips_copy_init( VipsCopy *copy )
*/
}
/**
* vips_copy:
* @in: input image
* @out: output image
* @width: set image width
* @height: set image height
* @bands: set image bands
* @format: set image format
* @coding: set image coding
* @interpretation: set image interpretation
* @xres: set image xres
* @yres: set image yres
* @xoffset: set image xoffset
* @yoffset: set image yoffset
* @swap: swap byte order
* @...: %NULL-terminated list of optional named arguments
*
* Copy an image, optionally modifying the header. VIPS copies images by
* copying pointers, so this operation is instant, even for very large images.
*
* You can optionally set any or all header fields during the copy. Some
* header fields, such as "xres", the horizontal resolution, are safe to
* change in any way, others, such as "width" will cause immediate crashes if
* they are not set carefully.
*
* Setting @swap to %TRUE will make vips_copy() swap the byte ordering of
* pixels according to the image's format.
*
* Returns: 0 on success, -1 on error.
*/
int
vips_copy( VipsImage *in, VipsImage **out, ... )
{

View File

@ -71,25 +71,6 @@
#include "conversion.h"
/**
* VipsEmbed:
* @in: input image
* @out: output image
* @extend: how to generate the edge pixels
* @width: @out should be this many pixels across
* @height: @out should be this many pixels down
* @x: place @in at this x position in @out
* @y: place @in at this y position in @out
*
* The opposite of #VipsExtractArea: embed @in within an image of size @width
* by @height at position @x, @y. @extend
* controls what appears in the new pels, see #VipsExtend.
*
* See also: #VipsExtractArea, #VipsInsert.
*
* Returns: 0 on success, -1 on error.
*/
typedef struct _VipsEmbed {
VipsConversion parent_instance;
@ -583,6 +564,25 @@ vips_embed_init( VipsEmbed *embed )
*/
}
/**
* vips_embed:
* @in: input image
* @out: output image
* @width: @out should be this many pixels across
* @height: @out should be this many pixels down
* @x: place @in at this x position in @out
* @y: place @in at this y position in @out
* @extend: how to generate the edge pixels
* @...: %NULL-terminated list of optional named arguments
*
* The opposite of vips_extract_area(): embed @in within an image of size
* @width by @height at position @x, @y. @extend
* controls what appears in the new pels, see #VipsExtend.
*
* See also: vips_extract_area(), vips_insert().
*
* Returns: 0 on success, -1 on error.
*/
int
vips_embed( VipsImage *in, VipsImage **out,
int x, int y, int width, int height, ... )
@ -591,8 +591,7 @@ vips_embed( VipsImage *in, VipsImage **out,
int result;
va_start( ap, height );
result = vips_call_split( "embed", ap,
in, out, x, y, width, height );
result = vips_call_split( "embed", ap, in, out, x, y, width, height );
va_end( ap );
return( result );

View File

@ -84,21 +84,6 @@
#include "conversion.h"
/**
* VipsExtractArea:
* @in: input image
* @out: output image
* @left: left edge of area to extract
* @top: top edge of area to extract
* @width: width of area to extract
* @height: height of area to extract
*
* Extract an area from an image.
* Extracting outside @in will trigger an error.
*
* See also: VipsExtractBand().
*/
typedef struct _VipsExtractArea {
VipsConversion parent_instance;
@ -245,6 +230,22 @@ vips_extract_area_init( VipsExtractArea *extract )
{
}
/**
* vips_extract_area:
* @in: input image
* @out: output image
* @left: left edge of area to extract
* @top: top edge of area to extract
* @width: width of area to extract
* @height: height of area to extract
* @...: %NULL-terminated list of optional named arguments
*
* Extract an area from an image. The area must fit within @in.
*
* See also: vips_extract_bands().
*
* Returns: 0 on success, -1 on error.
*/
int
vips_extract_area( VipsImage *in, VipsImage **out,
int left, int top, int width, int height, ... )
@ -260,18 +261,6 @@ vips_extract_area( VipsImage *in, VipsImage **out,
return( result );
}
/**
* VipsExtractBand:
* @in: input image
* @out: output image
* @band: band to extract
* @n: number of bands to extract
*
* Extract a band or bands from an image. Extracting out of range is an error.
*
* See also: VipsExtractArea().
*/
typedef struct _VipsExtractBand {
VipsConversion parent_instance;
@ -399,6 +388,20 @@ vips_extract_band_init( VipsExtractBand *extract )
extract->n = 1;
}
/**
* vips_extract_band:
* @in: input image
* @out: output image
* @band: band to extract
* @n: number of bands to extract
* @...: %NULL-terminated list of optional named arguments
*
* Extract a band or bands from an image. Extracting out of range is an error.
*
* See also: vips_extract_area().
*
* Returns: 0 on success, -1 on error.
*/
int
vips_extract_band( VipsImage *in, VipsImage **out, int band, ... )
{

View File

@ -64,19 +64,6 @@
#include "conversion.h"
/**
* VipsFlip:
* @in: input image
* @out: output image
* @direction: flip horizontally or vertically
*
* Flips an image left-right or up-down.
*
* See also: #VipsRot.
*
* Returns: 0 on success, -1 on error
*/
typedef struct _VipsFlip {
VipsConversion parent_instance;
@ -269,6 +256,19 @@ vips_flip_init( VipsFlip *flip )
{
}
/**
* vips_flip:
* @in: input image
* @out: output image
* @direction: flip horizontally or vertically
* @...: %NULL-terminated list of optional named arguments
*
* Flips an image left-right or up-down.
*
* See also: vips_rot().
*
* Returns: 0 on success, -1 on error
*/
int
vips_flip( VipsImage *in, VipsImage **out, VipsDirection direction, ... )
{

View File

@ -69,35 +69,6 @@
#include "conversion.h"
/**
* VipsIfthenelse:
* @cond: condition #VipsImage
* @in1: then #VipsImage
* @in2: else #VipsImage
* @out: output #VipsImage
*
* This operation scans the condition image @cond
* and uses it to select pixels from either the then image @in1 or the else
* image @in2. Non-zero means @in1, 0 means @in2.
*
* Any image can have either 1 band or n bands, where n is the same for all
* the non-1-band images. Single band images are then effectively copied to
* make n-band images.
*
* Images @in1 and @in2 are cast up to the smallest common format. @cond is
* cast to uchar.
*
* If the images differ in size, the smaller images are enlarged to match the
* largest by adding zero pixels along the bottom and right.
*
* If @blend is %TRUE, then values in @out are smoothly blended between @in1
* and @in2 using the formula:
*
* @out = (@cond / 255) * @in1 + (1 - @cond / 255) * @in2
*
* See also: #VipsEqual.
*/
typedef struct _VipsIfthenelse {
VipsConversion parent_instance;
@ -453,6 +424,37 @@ vips_ifthenelse_init( VipsIfthenelse *ifthenelse )
{
}
/**
* vips_ifthenelse:
* @cond: condition #VipsImage
* @in1: then #VipsImage
* @in2: else #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* This operation scans the condition image @cond
* and uses it to select pixels from either the then image @in1 or the else
* image @in2. Non-zero means @in1, 0 means @in2.
*
* Any image can have either 1 band or n bands, where n is the same for all
* the non-1-band images. Single band images are then effectively copied to
* make n-band images.
*
* Images @in1 and @in2 are cast up to the smallest common format. @cond is
* cast to uchar.
*
* If the images differ in size, the smaller images are enlarged to match the
* largest by adding zero pixels along the bottom and right.
*
* If @blend is %TRUE, then values in @out are smoothly blended between @in1
* and @in2 using the formula:
*
* @out = (@cond / 255) * @in1 + (1 - @cond / 255) * @in2
*
* See also: vips_equal().
*
* Returns: 0 on success, -1 on error
*/
int
vips_ifthenelse( VipsImage *cond, VipsImage *in1, VipsImage *in2,
VipsImage **out, ... )

View File

@ -75,41 +75,6 @@
#include "conversion.h"
/**
* VipsInsert:
* @main: big image
* @sub: small image
* @out: output image
* @x: left position of @sub
* @y: top position of @sub
* @expand: expand output to hold whole of both images
* @background: colour for new pixels
*
* Insert one image into another. @sub is inserted into image @main at
* position @x, @y relative to the top LH corner of @main.
*
* Normally @out shows the whole of @main. If @expand is #TRUE then @out is
* made large enough to hold all of @main and @sub.
* Any areas of @out not coming from
* either @main or @sub are set to @background (default 0).
*
* If @sub overlaps @main,
* @sub will appear on top of @main.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: #VipsJoin.
*
* Returns: 0 on success, -1 on error
*/
typedef struct _VipsInsert {
VipsConversion parent_instance;
@ -436,6 +401,41 @@ vips_insert_init( VipsInsert *insert )
((double *) (insert->background->data))[0] = 0.0;
}
/**
* vips_insert:
* @main: big image
* @sub: small image
* @out: output image
* @x: left position of @sub
* @y: top position of @sub
* @expand: expand output to hold whole of both images
* @background: colour for new pixels
* @...: %NULL-terminated list of optional named arguments
*
* Insert one image into another. @sub is inserted into image @main at
* position @x, @y relative to the top LH corner of @main.
*
* Normally @out shows the whole of @main. If @expand is #TRUE then @out is
* made large enough to hold all of @main and @sub.
* Any areas of @out not coming from
* either @main or @sub are set to @background (default 0).
*
* If @sub overlaps @main,
* @sub will appear on top of @main.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: vips_join(), vips_embed(), vips_extract_area().
*
* Returns: 0 on success, -1 on error
*/
int
vips_insert( VipsImage *main, VipsImage *sub, VipsImage **out,
int x, int y, ... )

View File

@ -279,6 +279,7 @@ vips_join_init( VipsJoin *join )
* @shim: space between images, in pixels
* @background: background ink colour
* @align: low, centre or high alignment
* @...: %NULL-terminated list of optional named arguments
*
* Join @in1 and @in2 together, left-right or up-down depending on the value
* of @direction.

View File

@ -55,18 +55,6 @@
#include "conversion.h"
/**
* VipsReplicate:
* @in: input image
* @out: output image
* @across: repeat input this many times across
* @down: repeat input this many times down
*
* Repeats an image many times.
*
* See also: #VipsExtract.
*/
typedef struct _VipsReplicate {
VipsConversion parent_instance;
@ -232,6 +220,20 @@ vips_replicate_init( VipsReplicate *replicate )
{
}
/**
* vips_replicate:
* @in: input image
* @out: output image
* @across: repeat input this many times across
* @down: repeat input this many times down
* @...: %NULL-terminated list of optional named arguments
*
* Repeats an image many times.
*
* See also: vips_extract().
*
* Returns: 0 on success, -1 on error
*/
int
vips_replicate( VipsImage *in, VipsImage **out, int across, int down, ... )
{

View File

@ -73,19 +73,6 @@
#include "conversion.h"
/**
* VipsRot:
* @in: input image
* @out: output image
* @direction: rot horizontally or vertically
*
* Rots an image left-right or up-down.
*
* See also: #VipsFlip.
*
* Returns: 0 on success, -1 on error
*/
typedef struct _VipsRot {
VipsConversion parent_instance;
@ -384,6 +371,19 @@ vips_rot_init( VipsRot *rot )
{
}
/**
* vips_rot:
* @in: input image
* @out: output image
* @angle: rotation angle
* @...: %NULL-terminated list of optional named arguments
*
* Rotate @in by a multiple of 90 degrees.
*
* See also: vips_flip().
*
* Returns: 0 on success, -1 on error
*/
int
vips_rot( VipsImage *in, VipsImage **out, VipsAngle angle, ... )
{

View File

@ -1666,7 +1666,7 @@ vips__round( VipsImage *in, VipsImage *out, VipsOperationRound round )
int
im_rint( IMAGE *in, IMAGE *out )
{
return( vips__round( in, out, VIPS_OPERATION_ROUND_NEAREST ) );
return( vips__round( in, out, VIPS_OPERATION_ROUND_RINT ) );
}
int

View File

@ -81,14 +81,14 @@ typedef enum {
/**
* VipsOperationRound:
* @VIPS_OPERATION_ROUND_NEAREST: round to nearest
* @VIPS_OPERATION_ROUND_RINT: round to nearest
* @VIPS_OPERATION_ROUND_FLOOR: largest integral value not greater than
* @VIPS_OPERATION_ROUND_CEIL: the smallest integral value not less than
*
* See also: vips_round().
*/
typedef enum {
VIPS_OPERATION_ROUND_NEAREST,
VIPS_OPERATION_ROUND_RINT,
VIPS_OPERATION_ROUND_CEIL,
VIPS_OPERATION_ROUND_FLOOR,
VIPS_OPERATION_ROUND_LAST
@ -161,6 +161,12 @@ int vips_sign( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_round( VipsImage *in, VipsImage **out, VipsOperationRound round, ... )
__attribute__((sentinel));
int vips_floor( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_ceil( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_rint( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_math( VipsImage *in, VipsImage **out,
VipsOperationMath math, ... )
@ -189,12 +195,48 @@ int vips_log10( VipsImage *in, VipsImage **out, ... )
int vips_relational( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationRelational relational, ... )
__attribute__((sentinel));
int vips_equal( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_notequal( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_less( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_lesseq( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_more( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
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, ... )
__attribute__((sentinel));
int vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_notequal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_less_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_lesseq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_more_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
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, ... )
__attribute__((sentinel));
int vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
int vips_notequal_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
int vips_less_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
int vips_lesseq_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
int vips_more_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
int vips_moreeq_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
int vips_boolean( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationBoolean boolean, ... )

View File

@ -155,8 +155,30 @@ int vips_extract_band( VipsImage *input, VipsImage **output, int band, ... )
__attribute__((sentinel));
int vips_replicate( VipsImage *in, VipsImage **out, int across, int down, ... )
__attribute__((sentinel));
int vips_cast( VipsImage *in, VipsImage **out, VipsBandFormat format, ... )
__attribute__((sentinel));
int vips_uchar( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_char( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_ushort( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_short( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_uint( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_int( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_float( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_double( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_complex( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_dpcomplex( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_bandjoin( VipsImage **in, VipsImage **out, int n, ... )
__attribute__((sentinel));
int vips_bandjoin2( VipsImage *in1, VipsImage *in2, VipsImage **out, ... )

View File

@ -135,7 +135,7 @@ vips_operation_round_get_type( void )
if( etype == 0 ) {
static const GEnumValue values[] = {
{VIPS_OPERATION_ROUND_NEAREST, "VIPS_OPERATION_ROUND_NEAREST", "nearest"},
{VIPS_OPERATION_ROUND_RINT, "VIPS_OPERATION_ROUND_RINT", "rint"},
{VIPS_OPERATION_ROUND_CEIL, "VIPS_OPERATION_ROUND_CEIL", "ceil"},
{VIPS_OPERATION_ROUND_FLOOR, "VIPS_OPERATION_ROUND_FLOOR", "floor"},
{VIPS_OPERATION_ROUND_LAST, "VIPS_OPERATION_ROUND_LAST", "last"},