more docs hacking

This commit is contained in:
John Cupitt 2011-11-18 10:42:41 +00:00
parent 8cbf924d3f
commit d401db768d
8 changed files with 462 additions and 182 deletions

2
TODO
View File

@ -1,6 +1,6 @@
- test docs
do math.c next
do relational.c next
try

View File

@ -68,21 +68,6 @@
#include "unary.h"
/**
* VipsMath:
* @in: input #VipsImage
* @out: output #VipsImage
* @math: math operation to perform
*
* Perform various functions in -lm, the maths library, on images.
*
* Angles are expressed in degrees. The output type is float unless the
* input is double, in which case the output is double.
* Non-complex images only.
*
* See also: #VipsAdd.
*/
typedef struct _VipsMath {
VipsUnary parent_instance;
@ -228,6 +213,30 @@ vips_math_init( VipsMath *math )
{
}
static int
vips_mathv( VipsImage *in, VipsImage **out, VipsOperationMath math, va_list ap )
{
return( vips_call_split( "math", ap, in, out, math ) );
}
/**
* vips_math:
* @in: input #VipsImage
* @out: output #VipsImage
* @math: math operation to perform
* @...: %NULL-terminated list of optional named arguments
*
* Perform various functions in -lm, the maths library, on images.
*
* Angles are expressed in degrees. The output type is float unless the
* input is double, in which case the output is double.
*
* Non-complex images only.
*
* See also: vips_math2().
*
* Returns: 0 on success, -1 on error
*/
int
vips_math( VipsImage *in, VipsImage **out, VipsOperationMath math, ... )
{
@ -235,7 +244,237 @@ vips_math( VipsImage *in, VipsImage **out, VipsOperationMath math, ... )
int result;
va_start( ap, math );
result = vips_call_split( "math", ap, in, out, math );
result = vips_mathv( in, out, math, ap );
va_end( ap );
return( result );
}
/**
* vips_sin:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_SIN on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_sin( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_SIN, ap );
va_end( ap );
return( result );
}
/**
* vips_cos:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_COS on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_cos( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_COS, ap );
va_end( ap );
return( result );
}
/**
* vips_tan:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_TAN on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_tan( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_TAN, ap );
va_end( ap );
return( result );
}
/**
* vips_asin:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_ASIN on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_asin( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_ASIN, ap );
va_end( ap );
return( result );
}
/**
* vips_acos:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_ACOS on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_acos( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_ACOS, ap );
va_end( ap );
return( result );
}
/**
* vips_atan:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_ATAN on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_atan( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_ATAN, ap );
va_end( ap );
return( result );
}
/**
* vips_log:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_LOG on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_log( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_LOG, ap );
va_end( ap );
return( result );
}
/**
* vips_log10:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_LOG10 on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_log10( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_LOG10, ap );
va_end( ap );
return( result );
}
/**
* vips_exp:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_EXP on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_exp( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_EXP, ap );
va_end( ap );
return( result );
}
/**
* vips_exp10:
* @in: input #VipsImage
* @out: output #VipsImage
* @...: %NULL-terminated list of optional named arguments
*
* Perform #VIPS_OPERATION_MATH_EXP10 on an image. See vips_math().
*
* Returns: 0 on success, -1 on error
*/
int
vips_exp10( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_mathv( in, out, VIPS_OPERATION_MATH_EXP10, ap );
va_end( ap );
return( result );

View File

@ -65,24 +65,6 @@
#include "statistic.h"
/**
* VipsMax:
* @in: input #VipsImage
* @out: output pixel maximum
*
* This operation finds the maximum value in an image.
*
* If the image contains several maximum values, only the first one found is
* returned.
*
* It operates on all
* bands of the input image: use im_stats() if you need to find an
* maximum for each band. For complex images, find the maximum modulus.
*
* See also: #VipsAvg, #VipsMin, im_stats(), im_bandmean(), #VipsDeviate,
* im_rank().
*/
typedef struct _VipsMax {
VipsStatistic parent_instance;
@ -338,6 +320,29 @@ vips_max_init( VipsMax *max )
{
}
/**
* vips_max:
* @in: input #VipsImage
* @out: output pixel maximum
* @x: horizontal position of maximum
* @y: vertical position of maximum
* @...: %NULL-terminated list of optional named arguments
*
* This operation finds the maximum value in an image.
*
* If the image contains several maximum values, only the first one found is
* returned.
*
* It operates on all
* bands of the input image: use vips_stats() if you need to find an
* maximum for each band.
*
* For complex images, this operation finds the maximum modulus.
*
* See also: vips_min(), vips_stats().
*
* Returns: 0 on success, -1 on error
*/
int
vips_max( VipsImage *in, double *out, ... )
{

View File

@ -67,26 +67,6 @@
#include "statistic.h"
/**
* VipsMeasure:
* @im: image to measure
* @out: array of measurements
* @left: area of image containing chart
* @top: area of image containing chart
* @width: area of image containing chart
* @height: area of image containing chart
* @h: patches across chart
* @v: patches down chart
*
* Analyse a grid of colour patches, producing an array of patch averages.
* The mask has a row for each measured patch and a column for each image
* band. The operations issues a warning if any patch has a deviation more
* than 20% of
* the mean. Only the central 50% of each patch is averaged.
*
* See also: #VipsAvg, #VipsDeviate.
*/
typedef struct _VipsStats {
VipsOperation parent_instance;
@ -273,6 +253,32 @@ vips_measure_init( VipsMeasure *measure )
{
}
/**
* vips_measure:
* @im: image to measure
* @out: array of measurements
* @h: patches across chart
* @v: patches down chart
* @left: area of image containing chart
* @top: area of image containing chart
* @width: area of image containing chart
* @height: area of image containing chart
* @...: %NULL-terminated list of optional named arguments
*
* Analyse a grid of colour patches, producing an array of patch averages.
* The mask has a row for each measured patch and a column for each image
* band. The operations issues a warning if any patch has a deviation more
* than 20% of
* the mean. Only the central 50% of each patch is averaged.
*
* If the chart does not fill the whole image, use the optional @left, @top,
* @width, @height arguments to indicate the
* position of the chart.
*
* See also: vips_avg(), vips_deviate().
*
* Returns: 0 on success, -1 on error
*/
int
vips_measure( VipsImage *in, VipsImage **out, int h, int v, ... )
{

View File

@ -66,23 +66,6 @@
#include "statistic.h"
/**
* VipsMin:
* @in: input #VipsImage
* @out: output pixel minimum
*
* This operation finds the minimum value in an image.
*
* If the image contains several minimum values, only the first one found is
* returned.
*
* It operates on all
* bands of the input image: use im_stats() if you need to find an
* minimum for each band. For complex images, return the minimum modulus.
*
* See also: #VipsAvg, im_stats(), im_bandmean(), im_deviate(), im_rank()
*/
typedef struct _VipsMin {
VipsStatistic parent_instance;
@ -338,6 +321,29 @@ vips_min_init( VipsMin *min )
{
}
/**
* vips_min:
* @in: input #VipsImage
* @out: output pixel maximum
* @x: horizontal position of minimum
* @y: vertical position of minimum
* @...: %NULL-terminated list of optional named arguments
*
* This operation finds the minimum value in an image.
*
* If the image contains several minimum values, only the first one found is
* returned.
*
* It operates on all
* bands of the input image: use vips_stats() if you need to find an
* minimum for each band.
*
* For complex images, this operation finds the minimum modulus.
*
* See also: vips_max(), vips_stats().
*
* Returns: 0 on success, -1 on error
*/
int
vips_min( VipsImage *in, double *out, ... )
{

View File

@ -72,89 +72,6 @@
#include "binary.h"
/**
* VipsMultiply:
* @in1: input #VipsImage 1
* @in2: input #VipsImage 2
* @out: output #VipsImage
*
* 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>VipsMultiply 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>ushort</entry>
* </row>
* <row>
* <entry>char</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>ushort</entry>
* <entry>uint</entry>
* </row>
* <row>
* <entry>short</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>uint</entry>
* <entry>uint</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: im_multiply(), im_lintra().
*
* Returns: 0 on success, -1 on error
*/
typedef VipsBinary VipsMultiply;
typedef VipsBinaryClass VipsMultiplyClass;
@ -264,6 +181,88 @@ vips_multiply_init( VipsMultiply *multiply )
{
}
/**
* vips_multiply:
* @in1: input #VipsImage 1
* @in2: input #VipsImage 2
* @out: output #VipsImage
*
* 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>VipsMultiply 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>ushort</entry>
* </row>
* <row>
* <entry>char</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>ushort</entry>
* <entry>uint</entry>
* </row>
* <row>
* <entry>short</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>uint</entry>
* <entry>uint</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_multiply( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{

View File

@ -53,22 +53,6 @@
#include "unary.h"
/**
* VipsRecomb:
* @in: input image
* @out: output image
* @m: recombination matrix
*
* This operation recombines an image's bands. Each pixel in @in is treated as
* an n-element vector, where n is the number of bands in @in, and multipled by
* the n x m matrix @recomb to produce the m-band image @out.
*
* @out is always float, unless @in is double, in which case @out is double
* too. No complex images allowed.
*
* It's useful for various sorts of colour space conversions.
*/
typedef struct _VipsRecomb {
VipsOperation parent_instance;
@ -239,6 +223,25 @@ vips_recomb_init( VipsRecomb *recomb )
{
}
/**
* vips_recomb:
* @in: input image
* @out: output image
* @m: recombination matrix
*
* This operation recombines an image's bands. Each pixel in @in is treated as
* an n-element vector, where n is the number of bands in @in, and multipled by
* the n x m matrix @m to produce the m-band image @out.
*
* @out is always float, unless @in is double, in which case @out is double
* too. No complex images allowed.
*
* It's useful for various sorts of colour space conversions.
*
* See also: vips_bandmean().
*
* Returns: 0 on success, -1 on error
*/
int
vips_recomb( VipsImage *in, VipsImage **out, VipsImage *m, ... )
{

View File

@ -145,10 +145,15 @@ int vips_linear( VipsImage *in, VipsImage **out,
__attribute__((sentinel));
int vips_linear1( VipsImage *in, VipsImage **out, double a, double b, ... )
__attribute__((sentinel));
int vips_invert( VipsImage *in, VipsImage **out, ... )
int vips_remainder( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_math( VipsImage *in, VipsImage **out,
VipsOperationMath math, ... )
int vips_remainder_const( VipsImage *in, VipsImage **out,
double *c, int n, ... )
__attribute__((sentinel));
int vips_remainder_const1( VipsImage *in, VipsImage **out,
double c, ... )
__attribute__((sentinel));
int vips_invert( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_abs( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
@ -156,6 +161,31 @@ int vips_sign( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_round( VipsImage *in, VipsImage **out, VipsOperationRound round, ... )
__attribute__((sentinel));
int vips_math( VipsImage *in, VipsImage **out,
VipsOperationMath math, ... )
__attribute__((sentinel));
int vips_sin( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_cos( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_tan( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_asin( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_acos( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_atan( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_exp( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_exp10( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_log( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_log10( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_relational( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationRelational relational, ... )
__attribute__((sentinel));
@ -165,14 +195,6 @@ int vips_relational_const( VipsImage *in, VipsImage **out,
int vips_relational_const1( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double c, ... )
__attribute__((sentinel));
int vips_remainder( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_remainder_const( VipsImage *in, VipsImage **out,
double *c, int n, ... )
__attribute__((sentinel));
int vips_remainder_const1( VipsImage *in, VipsImage **out,
double c, ... )
__attribute__((sentinel));
int vips_boolean( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationBoolean boolean, ... )