polishing

This commit is contained in:
John Cupitt 2010-02-02 21:55:29 +00:00
parent 4cc29e99e8
commit e493e7136a
14 changed files with 54 additions and 56 deletions

View File

@ -36,11 +36,11 @@
<xi:include href="xml/boolean.xml"/>
<xi:include href="xml/relational.xml"/>
<xi:include href="xml/colour.xml"/>
<xi:include href="xml/conversion.xml"/>
</chapter>
<chapter>
<title>VIPS operation API by section (no gtkdoc comments yet)</title>
<xi:include href="xml/conversion.xml"/>
<xi:include href="xml/convolution.xml"/>
<xi:include href="xml/format.xml"/>
<xi:include href="xml/morphology.xml"/>

View File

@ -56,7 +56,7 @@
* matrices and back, change header fields, and a few others.
*
* The second group move pixels about in some way. You can flip, rotate,
* extract, insert and join pairs of iamges in various ways.
* extract, insert and join pairs of images in various ways.
*
*/
@ -202,35 +202,6 @@ static im_function gaussnoise_desc = {
gaussnoise_args /* Arg list */
};
/* Args to im_addgnoise.
*/
static im_arg_desc addgnoise_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "sigma" )
};
/* Call im_addgnoise via arg vector.
*/
static int
addgnoise_vec( im_object *argv )
{
double sigma = *((double *) argv[2]);
return( im_addgnoise( argv[0], argv[1], sigma ) );
}
/* Description of im_addgnoise.
*/
static im_function addgnoise_desc = {
"im_addgnoise", /* Name */
"add gaussian noise with mean 0 and std. dev. sigma",
IM_FN_PIO, /* Flags */
addgnoise_vec, /* Dispatch function */
IM_NUMBER( addgnoise_args ), /* Size of arg list */
addgnoise_args /* Arg list */
};
/* Args to im_extract.
*/
static im_arg_desc extract_args[] = {
@ -1397,7 +1368,6 @@ static im_function embed_desc = {
/* Package up all these functions.
*/
static im_function *conv_list[] = {
&addgnoise_desc,
&gaussnoise_desc,
&bandjoin_desc,
&black_desc,

View File

@ -433,28 +433,28 @@ clip_gen( REGION *or, void *vseq, void *a, void *b )
* Returns: 0 on success, -1 on error
*/
int
im_clip2fmt( IMAGE *in, IMAGE *out, VipsBandFmt ofmt )
im_clip2fmt( IMAGE *in, IMAGE *out, VipsBandFmt fmt )
{
Clip *clip;
if( im_check_uncoded( "im_clip2fmt", in ) ||
im_piocheck( in, out ) )
return( -1 );
if( ofmt < 0 || ofmt > IM_BANDFMT_DPCOMPLEX ) {
im_error( "im_clip2fmt", "%s", _( "ofmt out of range" ) );
if( fmt < 0 || fmt > IM_BANDFMT_DPCOMPLEX ) {
im_error( "im_clip2fmt", "%s", _( "fmt out of range" ) );
return( -1 );
}
/* Trivial case: fall back to im_copy().
*/
if( in->BandFmt == ofmt )
if( in->BandFmt == fmt )
return( im_copy( in, out ) );
if( !(clip = clip_new( in, out, ofmt )) )
if( !(clip = clip_new( in, out, fmt )) )
return( -1 );
if( im_cp_desc( out, in ) )
return( -1 );
out->BandFmt = ofmt;
out->BandFmt = fmt;
if( im_demand_hint( out, IM_THINSTRIP, in, NULL ) ||
im_generate( out, clip_start, clip_gen, clip_stop, in, clip ) )

View File

@ -310,8 +310,6 @@ im_copy_swap8_gen( PEL *in, PEL *out, int width, IMAGE *im )
* im_copy_swap:
* @in: input image
* @out: output image
* @field: metadata field to set
* @value: value to set for the field
*
* Copy an image, swapping byte order between little and big endian. This
* really does change image pixels and does not just alter the header.

View File

@ -438,7 +438,7 @@ embed( IMAGE *in, IMAGE *out, int flag, int x, int y, int w, int h )
* </tbody>
* </tgroup>
*
* See also: im_extract(), im_insert().
* See also: im_extract_area(), im_insert().
*
* Returns: 0 on success, -1 on error.
*/

View File

@ -241,7 +241,7 @@ im_extract_areabands( IMAGE *in, IMAGE *out,
* @in: input image
* @out: output image
* @left: left edge of rectangle
* @top: top edge rectangle
* @top: top edge of rectangle
* @width: width of rectangle
* @height: height of rectangle
*
@ -286,8 +286,7 @@ im_extract_bands( IMAGE *in, IMAGE *out, int band, int nbands )
* im_extract_band:
* @in: input image
* @out: output image
* @band: first band to extract
* @nbands: number of bands to extract
* @band: band to extract
*
* Extract a single band from an image.
* Extracting outside @in will trigger an error.

View File

@ -54,7 +54,7 @@
* @in: input mask
* @out output image
*
* Write a one-band, #IM_BANDFMT_DOUBLE image to @out based on mask @in.
* Write a one-band, %IM_BANDFMT_DOUBLE image to @out based on mask @in.
*
* See also: im_vips2mask().
*

View File

@ -72,7 +72,7 @@
* @out: stdout of command is returned here
*
* im_system() runs a command on an image, returning the command's output as a
* string. The command is executed with popen(), the first '%s' in the
* string. The command is executed with popen(), the first '%%s' in the
* command being substituted for a filename.
*
* If the IMAGE is a file on disc, then the filename will be the name of the

View File

@ -95,14 +95,14 @@ system_image( IMAGE *im,
* back. The command's stdout is returned in @log.
*
* First, @im is written to a file. The filename is formed by substituting
* something like "vips-49857-1" for the first %s in @in_format, then
* something like "vips-49857-1" for the first %%s in @in_format, then
* prepending "/tmp". If the environment variable TMPDIR is defined, it
* can be used to set a different temporary directory. If @in_format is
* something like "%s.png", the file will be written in PNG format.
* something like "%%s.png", the file will be written in PNG format.
*
* Next an output filename is created in the same way using @out_format. The
* command string to run is made by substituting the first %s in @cmd_format
* for the name of the input file and the second %s for the output filename.
* command string to run is made by substituting the first %%s in @cmd_format
* for the name of the input file and the second %%s for the output filename.
*
* The command is executed with popen() and the output captured in @log. If
* the command fails, the temporary files are deleted and im_system_image()

View File

@ -57,7 +57,7 @@
* @in: input image
* @outname: name for output mask
*
* Make a mask from an image. All images are cast to #IM_BANDFMT_DOUBLE
* Make a mask from an image. All images are cast to %IM_BANDFMT_DOUBLE
* before processing. There are two cases for handling bands:
*
* If the image has a single band, im_vips2mask() will write a mask the same
@ -66,7 +66,7 @@
* If the image has more than one band, it must be one pixel high or wide. In
* this case the output mask uses that axis to represent band values.
*
* See also: im_mask2vips(), im_measure().
* See also: im_mask2vips(), im_measure_area().
*
* Returns: a #DOUBLEMASK with @outname set as the name, or NULL on error
*/

View File

@ -72,7 +72,7 @@ im_wrap( IMAGE *in, IMAGE *out, int x, int y )
y = y < 0 ? -y % in->Ysize : in->Ysize - y % in->Ysize;
if( !(t = im_open_local( out, "im_wrap", "p" )) ||
im_replicate( in, t[0], 2, 2 ) ||
im_replicate( in, t, 2, 2 ) ||
im_extract_area( t, out, x, y, in->Xsize, in->Ysize ) )
return( -1 );

View File

@ -68,6 +68,35 @@ static im_arg_desc two_in_one_out[] = {
IM_OUTPUT_IMAGE( "out" )
};
/* Args to im_addgnoise.
*/
static im_arg_desc addgnoise_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "sigma" )
};
/* Call im_addgnoise via arg vector.
*/
static int
addgnoise_vec( im_object *argv )
{
double sigma = *((double *) argv[2]);
return( im_addgnoise( argv[0], argv[1], sigma ) );
}
/* Description of im_addgnoise.
*/
static im_function addgnoise_desc = {
"im_addgnoise", /* Name */
"add gaussian noise with mean 0 and std. dev. sigma",
IM_FN_PIO, /* Flags */
addgnoise_vec, /* Dispatch function */
IM_NUMBER( addgnoise_args ), /* Size of arg list */
addgnoise_args /* Arg list */
};
/* Args to im_contrast_surface.
*/
static im_arg_desc contrast_surface_args[] = {
@ -400,6 +429,7 @@ static im_function spcor_desc = {
/* Package up all these functions.
*/
static im_function *convol_list[] = {
&addgnoise_desc,
&compass_desc,
&contrast_surface_desc,
&conv_desc,

View File

@ -50,7 +50,7 @@ int im_copy_swap( IMAGE *in, IMAGE *out );
int im_copy_native( IMAGE *in, IMAGE *out, gboolean is_msb_first );
int im_copy_file( IMAGE *in, IMAGE *out );
int im_clip2fmt( IMAGE *in, IMAGE *out, VipsBandFmt ofmt );
int im_clip2fmt( IMAGE *in, IMAGE *out, VipsBandFmt fmt );
int im_scale( IMAGE *in, IMAGE *out );
int im_msb( IMAGE *in, IMAGE *out );
int im_msb_band( IMAGE *in, IMAGE *out, int band );
@ -63,8 +63,7 @@ int im_c2real( IMAGE *in, IMAGE *out );
int im_scaleps( IMAGE *in, IMAGE *out );
int im_falsecolour( IMAGE *in, IMAGE *out );
int im_addgnoise( IMAGE *, IMAGE *, double );
int im_gaussnoise( IMAGE *, int, int, double, double );
int im_gaussnoise( IMAGE *out, int x, int y, double mean, double sigma );
int im_black( IMAGE *out, int width, int height, int bands );
int im_text( IMAGE *out, const char *text, const char *font,

View File

@ -60,6 +60,8 @@ int im_gradcor( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_contrast_surface( IMAGE *in, IMAGE *out,
int half_win_size, int spacing );
int im_addgnoise( IMAGE *in, IMAGE *out, double sigma );
#ifdef __cplusplus
}
#endif /*__cplusplus*/