fix im_errormsg() calls

This commit is contained in:
John Cupitt 2009-09-21 15:50:29 +00:00
parent ea2285f315
commit b628642f4a
110 changed files with 1152 additions and 785 deletions

View File

@ -39,6 +39,10 @@
open files) ... this lets them delete temps and stuff. Expect breakage :(
- added vips_interpolate_get_window_offset()
- boolean revised: smaller, more general, faster
- im_remainderconst_vec() renamed to im_remainder_vec() for consistency
- added im_shift*_vec()
- renamed im_eor_vec() as im_eorimage_vec() for consistency, also and, or
- renamed im_eorconst() as im_eorimage_const() for consistency, also and, or
25/3/09 started 7.18.0
- revised version numbers

19
TODO
View File

@ -1,16 +1,10 @@
- move im_and_vec() to deprecated
- need in deprecated_dispatch.c
- shouldn't it be im_remainder_vec()?
im_remainderconst_vec
im_remainderconst_vec() is better? cf.
- move resample / im_affine, im_similarity, im_similarity_area to deprecated
im_andimage()
im_andimageconst()
im_andimage_vec()
- booolean needs gtkdoc
- test boolean
- we have tools/ and contrib/ argh
@ -25,11 +19,6 @@
- Joe's new def
- im_add(), im_subtract() etc. could all be in one file and share macros like
boolean.c
quite hard, because of things like complex *, / and liboil

View File

@ -128,7 +128,7 @@ main( int argc, char *argv[] )
ysize = vips->Ysize;
}
else {
im_diagnostics( "mitsub: rotating ..." );
im_diag( "mitsub", "%s", _( "rotating ..." ) );
xsize = vips->Ysize;
ysize = vips->Xsize;
}
@ -141,7 +141,7 @@ main( int argc, char *argv[] )
double factor = IM_MAX( x_factor, y_factor );
IMAGE *sh = im_open( "shrink", "t" );
im_diagnostics( "mitsub: shrinking by %g ...", factor );
im_diag( "mitsub", "%s", _( "shrinking by %g ..." ), factor );
if( !sh || im_shrink( vips, sh, factor, factor ) )
error_exit( "mitsub: shrink failed" );
@ -199,7 +199,7 @@ main( int argc, char *argv[] )
n = 255;
m = (int) xsize/fact + 1;
}
im_diagnostics( "mitsub: enlarging by %g ...", (double) n/m );
im_diag( "mitsub", _( "enlarging by %g ..." ), (double) n/m );
/* Horizontal enlarge.
*/
@ -278,7 +278,7 @@ main( int argc, char *argv[] )
/* Centering. ('1' = centering available, '0'= no centering).
*/
if( center ) {
im_diagnostics( "mitsub: centering ..." );
im_diag( "mitsub", "%s", _( "centering ..." ) );
putc( 0x1b, out );
putc( '&', out );
putc( 'C', out );
@ -419,7 +419,7 @@ main( int argc, char *argv[] )
p = (PEL *) vips->data;
switch( vips->Bands ) {
case 4:
im_diagnostics( "mitsub: sending IM_TYPE_CMYK ..." );
im_diag( "mitsub", "%s", _( "sending IM_TYPE_CMYK ..." ) );
for( y = 0; y < vips->Ysize; y++ )
for( x = 0; x < vips->Xsize; x++ ) {
putc( p[2], out );
@ -431,7 +431,7 @@ main( int argc, char *argv[] )
break;
case 3:
im_diagnostics( "mitsub: sending IM_TYPE_RGB ..." );
im_diag( "mitsub", "%s", _( "sending IM_TYPE_RGB ..." ) );
for( y = 0; y < vips->Ysize; y++ )
for( x = 0; x < vips->Xsize; x++ ) {
putc( p[0], out );
@ -442,7 +442,7 @@ main( int argc, char *argv[] )
break;
case 1:
im_diagnostics( "mitsub: sending K ..." );
im_diag( "mitsub", "%s", _( "sending K ..." ) );
for( y = 0; y < vips->Ysize; y++ )
for( x = 0; x < vips->Xsize; x++ )
putc( *p++, out );

View File

@ -59,7 +59,7 @@ writeimage( REGION *ir, FILE *out )
int c1 = (C);\
\
if( putc( c1, out ) == EOF ) {\
im_errormsg( "vips2hp2500cp: write error - disc full?" );\
im_error( "vips2hp2500cp", "%s", _( "write error - disc full?" ) );\
return( -1 );\
}\
}

View File

@ -86,7 +86,7 @@ find_printer( char *name )
if( strcmp( name, printer_data[i].name ) == 0 )
return( &printer_data[i] );
im_errormsg( "vips2dj: unknown printer \"%s\"", name );
im_error( "vips2dj", _( "unknown printer \"%s\"" ), name );
return( NULL );
}
@ -99,7 +99,8 @@ copy_bytes( FILE *in, FILE *out )
while( (ch = getc( in )) != EOF )
if( putc( ch, out ) == EOF ) {
im_errormsg( "vips2dj: write error -- disc full?" );
im_error( "vips2dj", "%s",
_( "write error -- disc full?" ) );
return( -1 );
}
@ -123,7 +124,7 @@ transmit_file( char *mode, char *name, FILE *out )
im_snprintf( buf, PATH_MAX, "%s/share/vips/vips2dj/%s/%s",
prefix, mode, name );
if( !(in = fopen( buf, "r" )) ) {
im_errormsg( "vips2dj: can't find \"%s\"", name );
im_error( "vips2dj", _( "can't find \"%s\"" ), name );
return( -1 );
}
if( copy_bytes( in, out ) ) {

View File

@ -422,7 +422,7 @@ exp10tra_vec( im_object *argv )
*/
static im_function exp10tra_desc = {
"im_exp10tra", /* Name */
N_( "10^pel of image" ), /* Description */
N_( "10^pel of image" ), /* Description */
IM_FN_PIO | IM_FN_PTOP, /* Flags */
exp10tra_vec, /* Dispatch function */
IM_NUMBER( one_in_one_out ), /* Size of arg list */
@ -571,7 +571,7 @@ static im_function lintra_desc = {
N_( "calculate a*in + b = outfile" ),
IM_FN_PIO | IM_FN_PTOP, /* Flags */
lintra_vec, /* Dispatch function */
IM_NUMBER( lintra_args ), /* Size of arg list */
IM_NUMBER( lintra_args ), /* Size of arg list */
lintra_args /* Arg list */
};
@ -643,7 +643,7 @@ logtra_vec( im_object *argv )
*/
static im_function logtra_desc = {
"im_logtra", /* Name */
N_( "ln of image" ), /* Description */
N_( "ln of image" ), /* Description */
IM_FN_PIO | IM_FN_PTOP, /* Flags */
logtra_vec, /* Dispatch function */
IM_NUMBER( one_in_one_out ), /* Size of arg list */
@ -915,7 +915,7 @@ static im_function maxpos_desc = {
N_( "position of maximum value of image" ),
0, /* Flags */
maxpos_vec, /* Dispatch function */
IM_NUMBER( maxpos_args ), /* Size of arg list */
IM_NUMBER( maxpos_args ), /* Size of arg list */
maxpos_args /* Arg list */
};
@ -940,7 +940,7 @@ maxpos_avg_vec( im_object *argv )
*/
static im_function maxpos_avg_desc = {
"im_maxpos_avg",
"position of maximum value of image, averaging in case of draw",
N_( "position of maximum value of image, averaging in case of draw" ),
IM_FN_PIO,
maxpos_avg_vec,
IM_NUMBER( maxpos_avg_args ),
@ -984,7 +984,7 @@ maxpos_vec_vec( im_object *argv )
*/
static im_function maxpos_vec_desc = {
"im_maxpos_vec",
"position and value of n maxima of image",
N_( "position and value of n maxima of image" ),
IM_FN_PIO,
maxpos_vec_vec,
IM_NUMBER( maxpos_vec_args ),
@ -1018,7 +1018,7 @@ minpos_vec_vec( im_object *argv )
*/
static im_function minpos_vec_desc = {
"im_minpos_vec",
"position and value of n minima of image",
N_( "position and value of n minima of image" ),
IM_FN_PIO,
minpos_vec_vec,
IM_NUMBER( maxpos_vec_args ),
@ -1124,7 +1124,7 @@ static im_function minpos_desc = {
N_( "position of minimum value of image" ),
0, /* Flags */
minpos_vec, /* Dispatch function */
IM_NUMBER( maxpos_args ), /* Size of arg list */
IM_NUMBER( maxpos_args ), /* Size of arg list */
maxpos_args /* Arg list */
};
@ -1172,23 +1172,23 @@ static im_function remainderconst_desc = {
N_( "remainder after integer division by a constant" ),/* Description */
IM_FN_PIO | IM_FN_PTOP, /* Flags */
remainderconst_vec, /* Dispatch function */
IM_NUMBER( remainderconst_args ), /* Size of arg list */
IM_NUMBER( remainderconst_args ),/* Size of arg list */
remainderconst_args /* Arg list */
};
/* Call im_remainderconst_vec via arg vector.
*/
static int
remainderconst_vec_vec( im_object *argv )
remainder_vec_vec( im_object *argv )
{
im_doublevec_object *dv = (im_doublevec_object *) argv[2];
return( im_remainderconst_vec( argv[0], argv[1], dv->n, dv->vec ) );
return( im_remainder_vec( argv[0], argv[1], dv->n, dv->vec ) );
}
/* Args for im_remainderconst_vec().
/* Args for im_remainder_vec().
*/
static im_arg_desc remainderconst_vec_args[] = {
static im_arg_desc remainder_vec_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLEVEC( "x" )
@ -1197,13 +1197,13 @@ static im_arg_desc remainderconst_vec_args[] = {
/* Description of im_remainderconst_vec.
*/
static im_function remainderconst_vec_desc = {
"im_remainderconst_vec", /* Name */
"im_remainder_vec", /* Name */
N_( "remainder after integer division by a vector of constants" ),
/* Description */
IM_FN_PIO | IM_FN_PTOP, /* Flags */
remainderconst_vec_vec, /* Dispatch function */
IM_NUMBER( remainderconst_vec_args ), /* Size of arg list */
remainderconst_vec_args /* Arg list */
remainder_vec_vec, /* Dispatch function */
IM_NUMBER( remainder_vec_args ),/* Size of arg list */
remainder_vec_args /* Arg list */
};
/* Call im_multiply via arg vector.
@ -1239,7 +1239,7 @@ powtra_vec( im_object *argv )
*/
static im_function powtra_desc = {
"im_powtra", /* Name */
N_( "pel^x ofbuildimage" ),
N_( "pel^x of image" ),
IM_FN_PIO | IM_FN_PTOP, /* Flags */
powtra_vec, /* Dispatch function */
IM_NUMBER( powtra_args ), /* Size of arg list */
@ -1294,7 +1294,7 @@ static im_function stats_desc = {
N_( "many image statistics in one pass" ),
IM_FN_PIO, /* Flags */
stats_vec, /* Dispatch function */
IM_NUMBER( stats_args ), /* Size of arg list */
IM_NUMBER( stats_args ), /* Size of arg list */
stats_args /* Arg list */
};

View File

@ -366,7 +366,7 @@ remainderconst_buffer( PEL *in, PEL *out, int width, PEL *vector, IMAGE *im )
}
/**
* im_remainderconst_vec:
* im_remainder_vec:
* @in: input #IMAGE
* @out: output #IMAGE
* @n: number of elements in array
@ -388,7 +388,7 @@ remainderconst_buffer( PEL *in, PEL *out, int width, PEL *vector, IMAGE *im )
* Returns: 0 on success, -1 on error
*/
int
im_remainderconst_vec( IMAGE *in, IMAGE *out, int n, double *c )
im_remainder_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
if( im_check_noncomplex( "im_remainder", in ) )
return( -1 );
@ -409,12 +409,12 @@ im_remainderconst_vec( IMAGE *in, IMAGE *out, int n, double *c )
* This operation calculates @in % @c (remainder after division by constant)
* and writes the result to @out. The image must be one of the integer types.
*
* See also: im_remainderconst_vec(), im_divide().
* See also: im_remainder_vec(), im_divide().
*
* Returns: 0 on success, -1 on error
*/
int
im_remainderconst( IMAGE *in, IMAGE *out, double c )
{
return( im_remainderconst_vec( in, out, 1, &c ) );
return( im_remainder_vec( in, out, 1, &c ) );
}

View File

@ -51,7 +51,7 @@
*
* These operations perform boolean operations, such as bitwise-and, on
* every pixel in an image or pair of images.
* All (except in a few cases noted below) will work with
* All will work with
* images of any type or any mixture of types, of any size and of any number
* of bands.
*
@ -67,6 +67,8 @@
* The output type is the same as the input type for integer types. Float and
* complex types are cast to signed int.
*
* For binary operations, the images must match in size.
*
* You might think im_andimage() would be called "im_and", but that causes
* problems when we try and make a C++ binding and drop the "im_" prefix.
*/
@ -95,185 +97,185 @@ static im_arg_desc vec_in_one_out[] = {
IM_INPUT_DOUBLEVEC( "vec" )
};
/* Call im_and via arg vector.
/* Call im_andimage via arg vector.
*/
static int
and_vec( im_object *argv )
andimage_vec( im_object *argv )
{
return( im_andimage( argv[0], argv[1], argv[2] ) );
}
/* Description of im_and.
/* Description of im_andimage.
*/
static im_function and_desc = {
static im_function andimage_desc = {
"im_andimage", /* Name */
"bitwise and of two images", /* Description */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
and_vec, /* Dispatch function */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
andimage_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_andconst via arg vector.
/* Call im_andimageconst via arg vector.
*/
static int
andconst_vec( im_object *argv )
andimageconst_vec( im_object *argv )
{
int c = *((int *) argv[2]);
return( im_andconst( argv[0], argv[1], c ) );
return( im_andimageconst( argv[0], argv[1], c ) );
}
/* Description of im_andconst.
*/
static im_function andconst_desc = {
"im_andimageconst", /* Name */
static im_function andimageconst_desc = {
"im_andimageconst", /* Name */
"bitwise and of an image with a constant",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
andconst_vec, /* Dispatch function */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
andimageconst_vec, /* Dispatch function */
IM_NUMBER( const_in_one_out ), /* Size of arg list */
const_in_one_out /* Arg list */
};
/* Call im_and_vec via arg vector.
/* Call im_andimage_vec via arg vector.
*/
static int
and_vec_vec( im_object *argv )
andimage_vec_vec( im_object *argv )
{
im_doublevec_object *rv = (im_doublevec_object *) argv[2];
return( im_and_vec( argv[0], argv[1], rv->n, rv->vec ) );
return( im_andimage_vec( argv[0], argv[1], rv->n, rv->vec ) );
}
/* Description of im_andconst.
/* Description of im_andimageconst.
*/
static im_function and_vec_desc = {
static im_function andimage_vec_desc = {
"im_andimage_vec", /* Name */
"bitwise and of an image with a vector constant",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
and_vec_vec, /* Dispatch function */
andimage_vec_vec, /* Dispatch function */
IM_NUMBER( vec_in_one_out ), /* Size of arg list */
vec_in_one_out /* Arg list */
};
/* Call im_or via arg vector.
/* Call im_orimage via arg vector.
*/
static int
or_vec( im_object *argv )
orimage_vec( im_object *argv )
{
return( im_orimage( argv[0], argv[1], argv[2] ) );
}
/* Description of im_or.
/* Description of im_orimage.
*/
static im_function or_desc = {
static im_function orimage_desc = {
"im_orimage", /* Name */
"bitwise or of two images", /* Description */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
or_vec, /* Dispatch function */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
orimage_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_orconst via arg vector.
/* Call im_orimageconst via arg vector.
*/
static int
orconst_vec( im_object *argv )
orimageconst_vec( im_object *argv )
{
int c = *((int *) argv[2]);
return( im_orconst( argv[0], argv[1], c ) );
return( im_orimageconst( argv[0], argv[1], c ) );
}
/* Description of im_orconst.
/* Description of im_orimageconst.
*/
static im_function orconst_desc = {
"im_orimageconst", /* Name */
static im_function orimageconst_desc = {
"im_orimageconst", /* Name */
"bitwise or of an image with a constant",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
orconst_vec, /* Dispatch function */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
orimageconst_vec, /* Dispatch function */
IM_NUMBER( const_in_one_out ), /* Size of arg list */
const_in_one_out /* Arg list */
};
/* Call im_or_vec via arg vector.
/* Call im_orimage_vec via arg vector.
*/
static int
or_vec_vec( im_object *argv )
orimage_vec_vec( im_object *argv )
{
im_doublevec_object *rv = (im_doublevec_object *) argv[2];
return( im_or_vec( argv[0], argv[1], rv->n, rv->vec ) );
return( im_orimage_vec( argv[0], argv[1], rv->n, rv->vec ) );
}
/* Description of im_orconst.
/* Description of im_orimage_vec.
*/
static im_function or_vec_desc = {
static im_function orimage_vec_desc = {
"im_orimage_vec", /* Name */
"bitwise or of an image with a vector constant",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
or_vec_vec, /* Dispatch function */
orimage_vec_vec, /* Dispatch function */
IM_NUMBER( vec_in_one_out ), /* Size of arg list */
vec_in_one_out /* Arg list */
};
/* Call im_eor via arg vector.
/* Call im_eorimage via arg vector.
*/
static int
eor_vec( im_object *argv )
eorimage_vec( im_object *argv )
{
return( im_eorimage( argv[0], argv[1], argv[2] ) );
}
/* Description of im_eor.
/* Description of im_eorimage.
*/
static im_function eor_desc = {
static im_function eorimage_desc = {
"im_eorimage", /* Name */
"bitwise eor of two images", /* Description */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
eor_vec, /* Dispatch function */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
eorimage_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_eorconst via arg vector.
/* Call im_eorimageconst via arg vector.
*/
static int
eorconst_vec( im_object *argv )
eorimageconst_vec( im_object *argv )
{
int c = *((int *) argv[2]);
return( im_eorconst( argv[0], argv[1], c ) );
return( im_eorimageconst( argv[0], argv[1], c ) );
}
/* Description of im_eorconst.
/* Description of im_eorimageconst.
*/
static im_function eorconst_desc = {
"im_eorimageconst", /* Name */
static im_function eorimageconst_desc = {
"im_eorimageconst", /* Name */
"bitwise eor of an image with a constant",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
eorconst_vec, /* Dispatch function */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
eorimageconst_vec, /* Dispatch function */
IM_NUMBER( const_in_one_out ), /* Size of arg list */
const_in_one_out /* Arg list */
};
/* Call im_eor_vec via arg vector.
/* Call im_eorimage_vec via arg vector.
*/
static int
eor_vec_vec( im_object *argv )
eorimage_vec_vec( im_object *argv )
{
im_doublevec_object *rv = (im_doublevec_object *) argv[2];
return( im_eor_vec( argv[0], argv[1], rv->n, rv->vec ) );
return( im_eorimage_vec( argv[0], argv[1], rv->n, rv->vec ) );
}
/* Description of im_eorconst.
/* Description of im_eorimage_vec.
*/
static im_function eor_vec_desc = {
static im_function eorimage_vec_desc = {
"im_eorimage_vec", /* Name */
"bitwise eor of an image with a vector constant",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
eor_vec_vec, /* Dispatch function */
eorimage_vec_vec, /* Dispatch function */
IM_NUMBER( vec_in_one_out ), /* Size of arg list */
vec_in_one_out /* Arg list */
};
@ -292,13 +294,34 @@ shiftleft_vec( im_object *argv )
*/
static im_function shiftleft_desc = {
"im_shiftleft", /* Name */
"shift integer image n bits to left",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
"shift image n bits to left",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
shiftleft_vec, /* Dispatch function */
IM_NUMBER( const_in_one_out ), /* Size of arg list */
const_in_one_out /* Arg list */
};
/* Call im_shiftleft_vec via arg vector.
*/
static int
shiftleft_vec_vec( im_object *argv )
{
im_doublevec_object *rv = (im_doublevec_object *) argv[2];
return( im_shiftleft_vec( argv[0], argv[1], rv->n, rv->vec ) );
}
/* Description of im_shiftleft_vec.
*/
static im_function shiftleft_vec_desc = {
"im_shiftleft_vec", /* Name */
"shift image array bits to left",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
shiftleft_vec_vec, /* Dispatch function */
IM_NUMBER( vec_in_one_out ), /* Size of arg list */
vec_in_one_out /* Arg list */
};
/* Call im_shiftright via arg vector.
*/
static int
@ -314,25 +337,48 @@ shiftright_vec( im_object *argv )
static im_function shiftright_desc = {
"im_shiftright", /* Name */
"shift integer image n bits to right",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
IM_FN_PTOP | IM_FN_PIO, /* Flags */
shiftright_vec, /* Dispatch function */
IM_NUMBER( const_in_one_out ), /* Size of arg list */
const_in_one_out /* Arg list */
};
/* Call im_shiftright_vec via arg vector.
*/
static int
shiftright_vec_vec( im_object *argv )
{
im_doublevec_object *rv = (im_doublevec_object *) argv[2];
return( im_shiftright_vec( argv[0], argv[1], rv->n, rv->vec ) );
}
/* Description of im_shiftright_vec.
*/
static im_function shiftright_vec_desc = {
"im_shiftright_vec", /* Name */
"shift image array bits to right",
IM_FN_PTOP | IM_FN_PIO, /* Flags */
shiftright_vec_vec, /* Dispatch function */
IM_NUMBER( vec_in_one_out ), /* Size of arg list */
vec_in_one_out /* Arg list */
};
/* Package up all these functions.
*/
static im_function *bool_list[] = {
&and_desc,
&andconst_desc,
&and_vec_desc,
&or_desc,
&orconst_desc,
&or_vec_desc,
&eor_desc,
&eorconst_desc,
&eor_vec_desc,
&andimage_desc,
&andimageconst_desc,
&andimage_vec_desc,
&orimage_desc,
&orimageconst_desc,
&orimage_vec_desc,
&eorimage_desc,
&eorimageconst_desc,
&eorimage_vec_desc,
&shiftleft_vec_desc,
&shiftleft_desc,
&shiftright_vec_desc,
&shiftright_desc
};

View File

@ -1,4 +1,4 @@
/* boolean.c
/* boolean.c --- various bit operations
*
* Modified:
* 15/12/94 JC
@ -301,6 +301,21 @@ CONST1_BUFFER( AND, & )
CONSTN_BUFFER( AND, & )
/**
* im_andimage_vec:
* @in1: input #IMAGE 1
* @in2: input #IMAGE 2
* @out: output #IMAGE
* @n: array length
* @c: array of constants
*
* This operation calculates @in1 & @c (bitwise and of image pixels with array
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimage_vec().
*
* Returns: 0 on success, -1 on error
*/
int
im_andimage_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
@ -311,10 +326,46 @@ im_andimage_vec( IMAGE *in, IMAGE *out, int n, double *c )
(im_wrapone_fn) ANDn_buffer ) );
}
/**
* im_andimageconst:
* @in1: input #IMAGE 1
* @in2: input #IMAGE 2
* @out: output #IMAGE
* @c: constant
*
* This operation calculates @in1 & @c (bitwise and of image pixels with
* constant
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimage_vec().
*
* Returns: 0 on success, -1 on error
*/
int
im_andimageconst( IMAGE *in, IMAGE *out, double c )
{
return( im_andimage_vec( in, out, 1, &c ) );
}
CONST1_BUFFER( OR, | )
CONSTN_BUFFER( OR, | )
/**
* im_orimage_vec:
* @in1: input #IMAGE 1
* @in2: input #IMAGE 2
* @out: output #IMAGE
* @n: array length
* @c: array of constants
*
* This operation calculates @in1 | @c (bitwise or of image pixels with array
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimageconst().
*
* Returns: 0 on success, -1 on error
*/
int
im_orimage_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
@ -325,10 +376,47 @@ im_orimage_vec( IMAGE *in, IMAGE *out, int n, double *c )
(im_wrapone_fn) ORn_buffer ) );
}
/**
* im_orimageconst:
* @in1: input #IMAGE 1
* @in2: input #IMAGE 2
* @out: output #IMAGE
* @c: constant
*
* This operation calculates @in1 | @c (bitwise or of image pixels with
* constant
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimage_vec().
*
* Returns: 0 on success, -1 on error
*/
int
im_orimageconst( IMAGE *in, IMAGE *out, double c )
{
return( im_orimage_vec( in, out, 1, &c ) );
}
CONST1_BUFFER( EOR, ^ )
CONSTN_BUFFER( EOR, ^ )
/**
* im_eorimage_vec:
* @in1: input #IMAGE 1
* @in2: input #IMAGE 2
* @out: output #IMAGE
* @n: array length
* @c: array of constants
*
* This operation calculates @in1 ^ @c (bitwise exclusive-or of image pixels
* with array
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimageconst().
*
* Returns: 0 on success, -1 on error
*/
int
im_eorimage_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
@ -339,10 +427,47 @@ im_eorimage_vec( IMAGE *in, IMAGE *out, int n, double *c )
(im_wrapone_fn) EORn_buffer ) );
}
/**
* im_eorimageconst:
* @in1: input #IMAGE 1
* @in2: input #IMAGE 2
* @out: output #IMAGE
* @c: constant
*
* This operation calculates @in1 ^ @c (bitwise exclusive-or of image pixels
* with
* constant
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimage_vec().
*
* Returns: 0 on success, -1 on error
*/
int
im_eorimageconst( IMAGE *in, IMAGE *out, double c )
{
return( im_eorimage_vec( in, out, 1, &c ) );
}
CONST1_BUFFER( SHIFTL, << )
CONSTN_BUFFER( SHIFTL, << )
/**
* im_shiftleft_vec:
* @in: input #IMAGE
* @out: output #IMAGE
* @n: array length
* @c: array of constants
*
* This operation calculates @in1 << @c (left-shift by @c bits
* with array
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimageconst().
*
* Returns: 0 on success, -1 on error
*/
int
im_shiftleft_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
@ -353,10 +478,46 @@ im_shiftleft_vec( IMAGE *in, IMAGE *out, int n, double *c )
(im_wrapone_fn) SHIFTLn_buffer ) );
}
/**
* im_shiftleft:
* @in: input #IMAGE
* @out: output #IMAGE
* @c: constant
*
* This operation calculates @in1 << @c (left-shift by @c bits)
* and writes the result to @out.
*
* See also: im_andimage(), im_orimageconst().
*
* Returns: 0 on success, -1 on error
*/
int
im_shiftleft( IMAGE *in, IMAGE *out, int n )
{
double c = n;
return( im_shiftleft_vec( in, out, 1, &c ) );
}
CONST1_BUFFER( SHIFTR, >> )
CONSTN_BUFFER( SHIFTR, >> )
/**
* im_shiftright_vec:
* @in: input #IMAGE
* @out: output #IMAGE
* @n: array length
* @c: array of constants
*
* This operation calculates @in1 << @c (right-shift by @c bits
* with array
* @c) and writes the result to @out.
*
* See also: im_andimage(), im_orimageconst().
*
* Returns: 0 on success, -1 on error
*/
int
im_shiftright_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
@ -367,50 +528,19 @@ im_shiftright_vec( IMAGE *in, IMAGE *out, int n, double *c )
(im_wrapone_fn) SHIFTRn_buffer ) );
}
int
im_and_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
return( im_andimage_vec( in, out, n, c ) );
}
int
im_or_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
return( im_orimage_vec( in, out, n, c ) );
}
int
im_eor_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
return( im_eorimage_vec( in, out, n, c ) );
}
int
im_andconst( IMAGE *in, IMAGE *out, double c )
{
return( im_andimage_vec( in, out, 1, &c ) );
}
int
im_orconst( IMAGE *in, IMAGE *out, double c )
{
return( im_orimage_vec( in, out, 1, &c ) );
}
int
im_eorconst( IMAGE *in, IMAGE *out, double c )
{
return( im_eorimage_vec( in, out, 1, &c ) );
}
int
im_shiftleft( IMAGE *in, IMAGE *out, int n )
{
double c = n;
return( im_shiftleft_vec( in, out, 1, &c ) );
}
/**
* im_shiftright:
* @in: input #IMAGE
* @out: output #IMAGE
* @c: constant
*
* This operation calculates @in1 >> @c (right-shift by @c bits)
* and writes the result to @out.
*
* See also: im_andimage(), im_orimageconst().
*
* Returns: 0 on success, -1 on error
*/
int
im_shiftright( IMAGE *in, IMAGE *out, int n )
{

View File

@ -482,7 +482,7 @@ im_col_rgb2XYZ( struct im_col_display *d, struct im_col_tab_disp *table,
int i;
if( r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 ) {
im_errormsg( "im_col_rgb2XYZ: out of range [0,255]" );
im_error( "im_col_rgb2XYZ", "%s", _( "out of range [0,255]" ) );
return( -1 );
}
@ -508,7 +508,7 @@ im_col_rgb2XYZ( struct im_col_display *d, struct im_col_tab_disp *table,
break;
default:
im_errormsg( "im_col_rgb2XYZ: bad display type" );
im_error( "im_col_rgb2XYZ", "%s", _( "bad display type" ) );
return( -1 );
}
@ -621,7 +621,7 @@ im_col_XYZ2rgb( struct im_col_display *d, struct im_col_tab_disp *table,
break;
default:
im_errormsg("XYZ2rgb: display unknown");
im_error( "XYZ2rgb", "%s", _( "display unknown" ) );
return( -1 );
/*NOTREACHED*/
}

View File

@ -88,7 +88,8 @@ im_LCh2Lab( IMAGE *in, IMAGE *out )
*/
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_LCh2Lab: 3-band float uncoded input only" );
im_error( "im_LCh2Lab", "%s",
_( "3-band float uncoded input only" ) );
return( -1 );
}

View File

@ -79,7 +79,8 @@ im_LCh2UCS( IMAGE *in, IMAGE *out )
*/
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_LCh2UCS: 3-band uncoded float input only" );
im_error( "im_LCh2UCS", "%s",
_( "3-band uncoded float input only" ) );
return( -1 );
}

View File

@ -82,7 +82,8 @@ im_Lab2LCh( IMAGE *in, IMAGE *out )
*/
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_Lab2LCh: 3-band uncoded float input only" );
im_error( "im_Lab2LCh", "%s",
_( "3-band uncoded float input only" ) );
return( -1 );
}

View File

@ -130,11 +130,13 @@ im_Lab2LabQ( IMAGE *labim, IMAGE *outim )
/* Check for uncoded Lab type
*/
if( labim->Coding != IM_CODING_NONE ) {
im_errormsg( "im_Lab2LabQ: uncoded input only" );
im_error( "im_Lab2LabQ", "%s",
_( "uncoded input only" ) );
return( -1 );
}
if( labim->BandFmt != IM_BANDFMT_FLOAT || labim->Bands != 3 ) {
im_errormsg( "im_Lab2LabQ: three-band float input only" );
im_error( "im_Lab2LabQ", "%s",
_( "three-band float input only" ) );
return( -1 );
}

View File

@ -66,11 +66,13 @@ im_Lab2LabS( IMAGE *labim, IMAGE *outim )
/* Check for uncoded Lab type
*/
if( labim->Coding != IM_CODING_NONE ) {
im_errormsg( "im_Lab2LabS: uncoded input only" );
im_error( "im_Lab2LabS", "%s",
_( "uncoded input only" ) );
return( -1 );
}
if( labim->BandFmt != IM_BANDFMT_FLOAT || labim->Bands != 3 ) {
im_errormsg( "im_Lab2LabS: three-band float input only" );
im_error( "im_Lab2LabS", "%s",
_( "three-band float input only" ) );
return( -1 );
}

View File

@ -111,7 +111,7 @@ im_LabQ2Lab( IMAGE *labim, IMAGE *outim )
/* check for coded Lab type
*/
if( labim->Coding != IM_CODING_LABQ ) {
im_errormsg( "im_LabQ2Lab: not a packed Lab image" );
im_error( "im_LabQ2Lab", "%s", _( "not a packed Lab image" ) );
return( -1 );
}

View File

@ -101,7 +101,8 @@ im_LabQ2LabS( IMAGE *labim, IMAGE *outim )
/* check for coded Lab type
*/
if( labim->Coding != IM_CODING_LABQ ) {
im_errormsg( "im_LabQ2LabS: not a packed Lab image" );
im_error( "im_LabQ2LabS", "%s",
_( "not a packed Lab image" ) );
return( -1 );
}

View File

@ -178,7 +178,8 @@ im_LabQ2disp_table( IMAGE *in, IMAGE *out, void *table )
CalibrateInfo *cal = (CalibrateInfo *) table;
if ( in->Coding != IM_CODING_LABQ ) {
im_errormsg( "im_LabQ2Lab: not a packed Lab image" );
im_error( "im_LabQ2Lab", "%s",
_( "not a packed Lab image" ) );
return( -1 );
}

View File

@ -72,11 +72,13 @@ im_LabS2Lab( IMAGE *in, IMAGE *out )
/* Check type.
*/
if( in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_LabS2Lab: not an uncoded image" );
im_error( "im_LabS2Lab", "%s",
_( "not an uncoded image" ) );
return( -1 );
}
if( in->BandFmt != IM_BANDFMT_SHORT || in->Bands != 3 ) {
im_errormsg( "im_LabS2Lab: not a 3-band signed short image" );
im_error( "im_LabS2Lab", "%s",
_( "not a 3-band signed short image" ) );
return( -1 );
}

View File

@ -125,11 +125,13 @@ im_LabS2LabQ( IMAGE *in, IMAGE *out )
/* Check type.
*/
if( in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_LabS2LabQ: not an uncoded image" );
im_error( "im_LabS2LabQ", "%s",
_( "not an uncoded image" ) );
return( -1 );
}
if( in->BandFmt != IM_BANDFMT_SHORT || in->Bands != 3 ) {
im_errormsg( "im_LabS2LabQ: not a 3-band signed short image" );
im_error( "im_LabS2LabQ", "%s",
_( "not a 3-band signed short image" ) );
return( -1 );
}

View File

@ -88,7 +88,8 @@ im_UCS2LCh( IMAGE *in, IMAGE *out )
*/
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_UCS2LCh: 3-band float uncoded input only" );
im_error( "im_UCS2LCh", "%s",
_( "3-band float uncoded input only" ) );
return( -1 );
}

View File

@ -84,7 +84,8 @@ im_XYZ2Yxy( IMAGE *in, IMAGE *out )
{
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_XYZ2Yxy: 3-band uncoded float input only" );
im_error( "im_XYZ2Yxy", "%s",
_( "3-band uncoded float input only" ) );
return( -1 );
}

View File

@ -85,7 +85,8 @@ im_Yxy2XYZ( IMAGE *in, IMAGE *out )
{
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_Yxy2XYZ: 3-band uncoded float input only" );
im_error( "im_Yxy2XYZ", "%s",
_( "3-band uncoded float input only" ) );
return( -1 );
}

View File

@ -86,7 +86,7 @@ im_dE00_fromLab( IMAGE *im1, IMAGE *im2, IMAGE *out )
im1->Coding != IM_CODING_NONE ||
im2->Bands != 3 || im2->BandFmt != IM_BANDFMT_FLOAT ||
im2->Coding != IM_CODING_NONE ) {
im_errormsg( "im_dE00_fromLab: 3-band float only" );
im_error( "im_dE00_fromLab", "%s", _( "3-band float only" ) );
return( -1 );
}

View File

@ -86,7 +86,7 @@ im_dECMC_fromLab( IMAGE *im1, IMAGE *im2, IMAGE *out )
im1->Coding != IM_CODING_NONE ||
im2->Bands != 3 || im2->BandFmt != IM_BANDFMT_FLOAT ||
im2->Coding != IM_CODING_NONE ) {
im_errormsg( "im_dECMC_fromLab: 3-band float only" );
im_error( "im_dECMC_fromLab", "%s", _( "3-band float only" ) );
return( -1 );
}

View File

@ -92,7 +92,8 @@ im_dE_fromLab( IMAGE *im1, IMAGE *im2, IMAGE *out )
im1->Coding != IM_CODING_NONE ||
im2->Bands != 3 || im2->BandFmt != IM_BANDFMT_FLOAT ||
im2->Coding != IM_CODING_NONE ) {
im_errormsg( "im_dE_fromLab: inputs should be 3 band float");
im_error( "im_dE_fromLab", "%s",
_( "inputs should be 3 band float") );
return( -1 );
}

View File

@ -391,17 +391,19 @@ im_icc_transform( IMAGE *in, IMAGE *out,
if( !cmsIsIntentSupported( icc->in_profile,
intent, LCMS_USED_AS_INPUT ) )
im_warning( "im_icc_transform: intent %d (%s) not supported by "
im_warn( "im_icc_transform",
_( "intent %d (%s) not supported by "
"profile \"%s\"; falling back to default intent "
"(usually PERCEPTUAL)",
"(usually PERCEPTUAL)" ),
intent, decode_intent( intent ),
input_profile_filename );
if( !cmsIsIntentSupported( icc->out_profile,
intent, LCMS_USED_AS_OUTPUT ) )
im_warning( "im_icc_transform: intent %d (%s) not supported by "
im_warn( "im_icc_transform",
_( "intent %d (%s) not supported by "
"profile \"%s\"; falling back to default intent "
"(usually PERCEPTUAL)",
"(usually PERCEPTUAL)" ),
intent, decode_intent( intent ),
output_profile_filename );
@ -524,7 +526,8 @@ icc_import( IMAGE *in, IMAGE *out, Icc *icc )
if( !cmsIsIntentSupported( icc->in_profile,
icc->intent, LCMS_USED_AS_INPUT ) )
im_warn( "im_icc_import", _( "intent %d (%s) not supported by "
im_warn( "im_icc_import",
_( "intent %d (%s) not supported by "
"profile; falling back to default intent "
"(usually PERCEPTUAL)" ),
icc->intent, decode_intent( icc->intent ) );
@ -697,9 +700,10 @@ im_icc_export_depth( IMAGE *in, IMAGE *out, int depth,
if( !cmsIsIntentSupported( icc->out_profile,
intent, LCMS_USED_AS_OUTPUT ) )
im_warning( "im_icc_export: intent %d (%s) not supported by "
im_warn( "im_icc_export",
_( "intent %d (%s) not supported by "
"profile \"%s\"; falling back to default intent "
"(usually PERCEPTUAL)",
"(usually PERCEPTUAL)" ),
intent, decode_intent( intent ),
output_profile_filename );

View File

@ -93,7 +93,8 @@ morph_init( Params *parm,
parm->b_scale = b_scale;
if( mask->xsize != 3 || mask->ysize < 1 || mask->ysize > 100 ) {
im_errormsg( "im_lab_morph: bad greyscale mask size" );
im_error( "im_lab_morph", "%s",
_( "bad greyscale mask size" ) );
return( -1 );
}
for( i = 0; i < mask->ysize; i++ ) {
@ -103,8 +104,8 @@ morph_init( Params *parm,
if( L < 0 || L > 100 || a < -120 || a > 120 ||
b < -120 || b > 120 ) {
im_errormsg( "im_lab_morph: bad greyscale mask "
"value, row %d", i );
im_error( "im_lab_morph",
_( "bad greyscale mask value, row %d" ), i );
return( -1 );
}
}
@ -228,15 +229,18 @@ im_lab_morph( IMAGE *in, IMAGE *out,
}
if( in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_lab_morph: must be uncoded or IM_CODING_LABQ" );
im_error( "im_lab_morph", "%s",
_( "must be uncoded or IM_CODING_LABQ" ) );
return( -1 );
}
if( in->BandFmt != IM_BANDFMT_FLOAT && in->BandFmt != IM_BANDFMT_DOUBLE ) {
im_errormsg( "im_lab_morph: must be uncoded float or double" );
im_error( "im_lab_morph", "%s",
_( "must be uncoded float or double" ) );
return( -1 );
}
if( in->Bands != 3 ) {
im_errormsg( "im_lab_morph: must be 3 bands" );
im_error( "im_lab_morph", "%s",
_( "must be 3 bands" ) );
return( -1 );
}

View File

@ -124,15 +124,15 @@ im_bandjoin( IMAGE *in1, IMAGE *in2, IMAGE *out )
return( -1 );
if( in1->Xsize != in2->Xsize ||
in1->Ysize != in2->Ysize ) {
im_errormsg( "im_bandjoin: images not same size" );
im_error( "im_bandjoin", "%s", _( "images not same size" ) );
return( -1 );
}
if( in1->BandFmt != in2->BandFmt ) {
im_errormsg( "im_bandjoin: images not same type" );
im_error( "im_bandjoin", "%s", _( "images not same type" ) );
return( -1 );
}
if( in1->Coding != IM_CODING_NONE || in2->Coding != IM_CODING_NONE ) {
im_errormsg( "im_bandjoin: input coded" );
im_error( "im_bandjoin", "%s", _( "input coded" ) );
return( -1 );
}

View File

@ -84,7 +84,7 @@ im_black( IMAGE *out, int x, int y, int bands )
/* Check parameters.
*/
if( x < 0 || y < 0 || bands < 0 ) {
im_errormsg( "im_black: bad parameter" );
im_error( "im_black", "%s", _( "bad parameter" ) );
return( -1 );
}

View File

@ -126,7 +126,8 @@ int
im_c2amph( IMAGE *in, IMAGE *out )
{
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
im_errormsg( "im_c2amph: input should be uncoded complex" );
im_error( "im_c2amph", "%s",
_( "input should be uncoded complex" ) );
return( -1 );
}
if( im_cp_desc( out, in ) )

View File

@ -90,7 +90,8 @@ int
im_c2imag( IMAGE *in, IMAGE *out )
{
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
im_errormsg( "im_c2imag: input should be uncoded complex" );
im_error( "im_c2imag", "%s",
_( "input should be uncoded complex" ) );
return( -1 );
}
if( im_cp_desc( out, in ) )

View File

@ -95,7 +95,8 @@ int
im_c2real( IMAGE *in, IMAGE *out )
{
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
im_errormsg( "im_c2real: input should be uncoded complex" );
im_error( "im_c2real", "%s",
_( "input should be uncoded complex" ) );
return( -1 );
}
if( im_cp_desc( out, in ) )

View File

@ -92,7 +92,8 @@ int
im_c2rect( IMAGE *in, IMAGE *out )
{
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
im_errormsg( "im_c2rect: input should be uncoded complex" );
im_error( "im_c2rect", "%s",
_( "input should be uncoded complex" ) );
return( -1 );
}
if( im_cp_desc( out, in ) )

View File

@ -60,7 +60,7 @@ im_mask2vips( DOUBLEMASK *in, IMAGE *out )
/* Check the mask.
*/
if( !in || !in->coeff ) {
im_errormsg( "im_mask2vips: bad input mask" );
im_error( "im_mask2vips", "%s", _( "bad input mask" ) );
return( -1 );
}

View File

@ -111,7 +111,7 @@ recomb_buf( void *bin, void *bout, int width, IMAGE *in, DOUBLEMASK *mat )
case IM_BANDFMT_DOUBLE: LOOP( double, double ); break;
default:
im_errormsg( "im_recomb: unsupported input type" );
im_error( "im_recomb", "%s", _( "unsupported input type" ) );
return( -1 );
}
@ -130,11 +130,13 @@ im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *mat )
if( im_piocheck( in, out ) )
return( -1 );
if( in->Coding != IM_CODING_NONE || im_iscomplex( in ) ) {
im_errormsg( "im_recomb: uncoded non-complex only" );
im_error( "im_recomb", "%s",
_( "uncoded non-complex only" ) );
return( -1 );
}
if( in->Bands != mat->xsize ) {
im_errormsg( "im_recomb: bands in must equal matrix width" );
im_error( "im_recomb", "%s",
_( "bands in must equal matrix width" ) );
return( -1 );
}

View File

@ -134,7 +134,7 @@ int
im_replicate( IMAGE *in, IMAGE *out, int across, int down )
{
if( across <= 0 || down <= 0 ) {
im_errormsg( "im_replicate: bad parameters" );
im_error( "im_replicate", "%s", _( "bad parameters" ) );
return( -1 );
}
if( im_piocheck( in, out ) )

View File

@ -115,11 +115,11 @@ im_ri2c( IMAGE *in1, IMAGE *in2, IMAGE *out )
* im_wrapmany does this for us.
*/
if( in1->Coding != IM_CODING_NONE || in2->Coding != IM_CODING_NONE ) {
im_errormsg( "im_ri2c: inputs should be uncoded" );
im_error( "im_ri2c", "%s", _( "inputs should be uncoded" ) );
return( -1 );
}
if( im_iscomplex( in1 ) || im_iscomplex( in2 ) ) {
im_errormsg( "im_ri2c: inputs already complex" );
im_error( "im_ri2c", "%s", _( "inputs already complex" ) );
return( -1 );
}

View File

@ -88,26 +88,26 @@ double t1, t2;
/* Check our args. */
if( im_iocheck( in, out ) )
{
im_errormsg("im_slice: im_iocheck failed");
im_error( "im_slice", "%s", _( "im_iocheck failed") );
return( -1 );
}
if( in->Coding != IM_CODING_NONE )
{
im_errormsg("im_slice: input should be uncoded");
im_error( "im_slice", "%s", _( "input should be uncoded") );
return( -1 );
}
/* Set up the output header. */
if( im_cp_desc( out, in ) )
{
im_errormsg("im_slice: im_cp_desc failed");
im_error( "im_slice", "%s", _( "im_cp_desc failed") );
return( -1 );
}
out->BandFmt = IM_BANDFMT_UCHAR;
out->Bbits = IM_BBITS_BYTE;
if( im_setupout( out ) )
{
im_errormsg("im_slice: im_setupout failed");
im_error( "im_slice", "%s", _( "im_setupout failed") );
return( -1 );
}
@ -149,7 +149,7 @@ double t1, t2;
im_for_all_types( im_slice_loop );
default:
im_errormsg("im_slice: Unknown input format");
im_error( "im_slice", "%s", _( "Unknown input format") );
return( -1 );
}

View File

@ -80,20 +80,19 @@ double threshold;
/* Check our args. */
if( im_iocheck( in, out ) )
{ im_errormsg("im_thresh: im_iocheck failed"); return( -1 ); }
if( in->Coding != IM_CODING_NONE )
{ im_errormsg("im_thresh: input should be uncoded");return(-1);}
return( -1 );
if( in->Coding != IM_CODING_NONE ) {
im_error( "im_thresh", "%s", _( "input should be uncoded") );
return(-1);
}
/* Set up the output header. */
if( im_cp_desc( out, in ) )
{ im_errormsg("im_thresh: im_cp_desc failed"); return( -1 ); }
return( -1 );
out->BandFmt = IM_BANDFMT_UCHAR;
out->Bbits = IM_BBITS_BYTE;
if( im_setupout( out ) )
{
im_errormsg("im_thresh: im_setupout failed");
return( -1 );
}
/* Make buffer for building o/p in. */
epl = in->Xsize * in->Bands;
@ -126,7 +125,7 @@ double threshold;
im_for_all_types( im_thresh_loop );
default:
im_errormsg("im_thresh: Unknown input format");
im_error( "im_thresh", "%s", _( "Unknown input format") );
return( -1 );
}

View File

@ -504,7 +504,7 @@ im__create_int_luts( int *buffer, int buffersize,
buf2 = (int*)calloc( (unsigned)buffersize, sizeof(int) );
if ( ( buf1 == NULL ) || ( buf2 == NULL ) )
{
im_errormsg("im_create_int_luts: calloc failed (1)");
im_error( "im_create_int_luts", "%s", _( "calloc failed (1)") );
return( -1 );
}
@ -557,7 +557,7 @@ im__create_int_luts( int *buffer, int buffersize,
orig_luts[i] = (int*)calloc((unsigned)256, sizeof(int));
if (orig_luts[i] == NULL)
{
im_errormsg("im_create_int_luts: calloc failed (2)");
im_error( "im_create_int_luts", "%s", _( "calloc failed (2)") );
return( -1 );
}
for ( j=0; j<256; j++ )

View File

@ -89,22 +89,22 @@ int xskip, yskip;
/* Check input, output and vars */
if ((xskip < 1)||(yskip < 1))
{
im_errormsg("im_convsub: xskip and yskip must be >= 1");
im_error( "im_convsub", "%s", _( "xskip and yskip must be >= 1") );
return(-1);
}
if (im_iocheck(in, out) == -1)
{ im_errormsg("im_convsub: Unable to im_iocheck"); return(-1); }
return( -1 );
if ( (in->Coding != IM_CODING_NONE)||(in->Bbits != IM_BBITS_BYTE)
||(in->BandFmt != IM_BANDFMT_UCHAR) )
{
im_errormsg("im_convsub:input should be unsigned char uncoded");
im_error( "im_convsub", "%s", _( "nput should be unsigned char uncoded") );
return(-1);
}
/* Prepare output */
if (im_cp_desc(out, in) == -1)
{ im_errormsg("im_convsub: im_cp_desc failed"); return(-1); }
return( -1 );
tempsize = in->Xsize/xskip;
while ( 1 )
{
@ -127,16 +127,20 @@ int xskip, yskip;
break;
}
out->Ysize = tempsize;
if ( ( out->Xsize < 2 )||( out->Ysize < 2 ) )
{im_errormsg("im_convsub: too small output sizes");return(-1); }
if ( ( out->Xsize < 2 )||( out->Ysize < 2 ) ) {
im_error( "im_convsub", "%s", _( "too small output sizes") );
return(-1);
}
if( im_setupout(out) == -1)
{im_errormsg("im_convsub: im_setupout failed"); return(-1); }
return(-1);
/* Malloc one line of output data */
os = out->Xsize * out->Bands;
if ( (line=(PEL*)calloc( (unsigned)os, sizeof(char))) == NULL)
{ im_errormsg("im_convsub: unable to calloc(1)"); return(-1); }
if ( (line=(PEL*)calloc( (unsigned)os, sizeof(char))) == NULL) {
im_error( "im_convsub", "%s", _( "unable to calloc(1)") );
return(-1);
}
/* Malloc pointers and put them at correct location */
ms = m->xsize * m->ysize;
@ -152,7 +156,10 @@ int xskip, yskip;
((pnts = (PEL**)calloc((unsigned)count, sizeof(char *))) == NULL)||
((cpnt1s=(PEL**)calloc((unsigned)count, sizeof(char *))) == NULL)||
((cpnt2s=(PEL**)calloc((unsigned)count, sizeof(char *))) ==NULL ) )
{ im_errormsg("im_convsub: unable to calloc(2)"); return(-1); }
{
im_error( "im_convsub", "%s", _( "unable to calloc(2)") );
return(-1);
}
pnt = pnts;
cpnt1 = cpnt1s;
@ -177,21 +184,23 @@ int xskip, yskip;
}
}
if ( i != count )
{ im_errormsg("im_convsub: impossible state"); return(-1); }
if ( i != count ) {
im_error( "im_convsub", "%s", _( "impossible state") );
return(-1); }
/* Malloc pointers; not all lut_orig are used necessarily */
lut_orig = (int**)calloc((unsigned)count, sizeof(int**) );
lut = (int**)calloc((unsigned)count, sizeof(int**) );
if ( (lut == NULL) || (lut_orig == NULL) )
{ im_errormsg("im_conv: unable to calloc(1)"); return(-1); }
if ( (lut == NULL) || (lut_orig == NULL) ) {
im_error( "im_conv", "%s", _( "unable to calloc(1)") );
return(-1); }
/* Create luts; count is needed for freeing pointers. Not all lut_orig are used
* if zero elms are detected.
*/
if ( im__create_int_luts(newm, count, lut_orig, lut, &lutcnt ) == -1 )
{
im_errormsg("im_convsub: im_create_int_luts failed");
im_error( "im_convsub", "%s", _( "im_create_int_luts failed") );
return(-1);
}
@ -237,7 +246,6 @@ int xskip, yskip;
/* Output the calculated line */
if ( im_writeline(y, out, (PEL*)line) == -1 )
{
im_errormsg("im_convsub: im_writeline failed(2)");
free((char*)line); free((char*)newm);
free((char*)pnts);
free((char*)cpnt1s); free((char*)cpnt2s);

View File

@ -148,7 +148,7 @@ im_fastcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
/* Check sizes.
*/
if( in->Xsize < ref->Xsize || in->Ysize < ref->Ysize ) {
im_errormsg( "im_fastcor: ref not smaller than in" );
im_error( "im_fastcor", "%s", _( "ref not smaller than in" ) );
return( -1 );
}
@ -158,7 +158,8 @@ im_fastcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
in->BandFmt != IM_BANDFMT_UCHAR ||
ref->Coding != IM_CODING_NONE || ref->Bands != 1 ||
ref->BandFmt != IM_BANDFMT_UCHAR ) {
im_errormsg( "im_fastcor_raw: input not uncoded 1 band uchar" );
im_error( "im_fastcor_raw", "%s",
_( "input not uncoded 1 band uchar" ) );
return( -1 );
}

View File

@ -121,7 +121,7 @@ im_gaussnoise( IMAGE *out, int x, int y, double mean, double sigma )
/* Check parameters.
*/
if( x < 0 || y < 0 ) {
im_errormsg( "im_gaussnoise: bad parameter" );
im_error( "im_gaussnoise", "%s", _( "bad parameter" ) );
return( -1 );
}

View File

@ -131,7 +131,7 @@ im_log_dmask( const char *filename, double sigma, double min_ampl )
last = val;
}
if( x == IM_MAXMASK ) {
im_errormsg( "im_log_dmask: mask too large" );
im_error( "im_log_dmask", "%s", _( "mask too large" ) );
return( NULL );
}

View File

@ -354,12 +354,13 @@ im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int order )
/* Check parameters.
*/
if( !in || in->Coding != IM_CODING_NONE || im_iscomplex( in ) ) {
im_errormsg( "im_rank: input non-complex uncoded only" );
im_error( "im_rank", "%s",
_( "input non-complex uncoded only" ) );
return( -1 );
}
if( xsize > 1000 || ysize > 1000 || xsize <= 0 || ysize <= 0 ||
order < 0 || order > xsize * ysize - 1 ) {
im_errormsg( "im_rank: bad parameters" );
im_error( "im_rank", "%s", _( "bad parameters" ) );
return( -1 );
}
if( im_piocheck( in, out ) )
@ -384,7 +385,7 @@ im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int order )
out->Xsize -= xsize - 1;
out->Ysize -= ysize - 1;
if( out->Xsize <= 0 || out->Ysize <= 0 ) {
im_errormsg( "im_rank: image too small for window" );
im_error( "im_rank", "%s", _( "image too small for window" ) );
return( -1 );
}

View File

@ -275,12 +275,12 @@ im_rank_image( IMAGE **in, IMAGE *out, int n, int index )
Rank *rank;
if( n < 1 ) {
im_errormsg( "im_rank_image: zero input images!" );
im_error( "im_rank_image", "%s", _( "zero input images!" ) );
return( -1 );
}
if( index < 0 || index > n - 1 ) {
im_errormsg( "im_rank_image: "
"index should be in range 0 - %d", n - 1 );
im_error( "im_rank_image",
_( "index should be in range 0 - %d" ), n - 1 );
return( -1 );
}
if( im_poutcheck( out ) )
@ -290,25 +290,25 @@ im_rank_image( IMAGE **in, IMAGE *out, int n, int index )
return( -1 );
if( in[i]->Coding != IM_CODING_NONE || im_iscomplex( in[i] ) ) {
im_errormsg( "im_rank_image: "
"uncoded non-complex only" );
im_error( "im_rank_image", "%s",
_( "uncoded non-complex only" ) );
return( -1 );
}
if( in[0]->BandFmt != in[i]->BandFmt ) {
im_errormsg( "im_rank_image: "
"input images differ in format" );
im_error( "im_rank_image", "%s",
_( "input images differ in format" ) );
return( -1 );
}
if( in[0]->Xsize != in[i]->Xsize ||
in[0]->Ysize != in[i]->Ysize ) {
im_errormsg( "im_rank_image: "
"input images differ in size" );
im_error( "im_rank_image", "%s",
_( "input images differ in size" ) );
return( -1 );
}
if( in[0]->Bands != in[i]->Bands ) {
im_errormsg( "im_rank_image: "
"input images differ in number of bands" );
im_error( "im_rank_image", "%s",
_( "input images differ in number of bands" ) );
return( -1 );
}
}

View File

@ -122,11 +122,11 @@ im_resize_linear( IMAGE *in, IMAGE *out, int X, int Y )
if( im_iocheck( in, out ) )
return( -1 );
if( im_iscomplex( in ) ) {
im_errormsg( "im_lowpass: non-complex input only" );
im_error( "im_lowpass", "%s", _( "non-complex input only" ) );
return( -1 );
}
if( in->Coding != IM_CODING_NONE ) {
im_errormsg("im_lowpass: input should be uncoded");
im_error("im_lowpass: ", "%s", _( "put should be uncoded") );
return( -1 );
}
if( im_cp_desc( out, in ) )
@ -181,7 +181,7 @@ for (y=0; y<Y; y++)
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
default:
im_errormsg( "im_lowpass: unsupported image type" );
im_error( "im_lowpass", "%s", _( "unsupported image type" ) );
return( -1 );
/*NOTREACHED*/
}

View File

@ -118,7 +118,7 @@ im_offsets45( int size )
int *pnt, *cpnt1, *cpnt2;
if( size%2 == 0 ) {
im_errormsg( "im_offsets45: size not odd" );
im_error( "im_offsets45", "%s", _( "size not odd" ) );
return( NULL );
}
if( !(pnt = IM_ARRAY( NULL, size2, int )) )
@ -222,8 +222,8 @@ rotdmask( offset_fn fn, DOUBLEMASK *m, const char *name )
int i;
if( m->xsize != m->ysize || (m->xsize % 2) == 0 ) {
im_errormsg( "im_rotate_*mask*: mask should "
"be square of even size" );
im_error( "im_rotate_mask", "%s",
_( "mask should be square of even size" ) );
return( NULL );
}
if( !(offsets = fn( m->xsize )) )
@ -254,8 +254,8 @@ rotimask( offset_fn fn, INTMASK *m, const char *name )
int i;
if( m->xsize != m->ysize || (m->xsize % 2) == 0 ) {
im_errormsg( "im_rotate_*mask*: mask should "
"be square of even size" );
im_error( "im_rotate_mask", "%s",
_( "mask should be square of even size" ) );
return( NULL );
}
if( !(offsets = fn( m->xsize )) )

View File

@ -7,6 +7,7 @@ libdeprecated_la_SOURCES = \
im_gaddim.c \
im_cmulnorm.c \
im_gfadd.c \
rename.c \
im_litecor.c
INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@

View File

@ -41,18 +41,6 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/**
* SECTION: deprecated
* @short_description: various deprecated operations which remain for
* compatibility
*
* @stability: Stable
* @include: vips/vips.h
*
* These operations are left-overs from earlier versions of VIPS which are
* kept for compatibility.
*/
/* Two images in, one out.
*/
static im_arg_desc two_in_one_out[] = {
@ -182,13 +170,142 @@ static im_function litecor_desc = {
litecor_args /* Arg list */
};
/* affine args
*/
static im_arg_desc affine_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "c" ),
IM_INPUT_DOUBLE( "d" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" ),
IM_INPUT_INT( "x" ),
IM_INPUT_INT( "y" ),
IM_INPUT_INT( "w" ),
IM_INPUT_INT( "h" )
};
/* Call im_affine via arg vector.
*/
static int
affine_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double b = *((double *) argv[3]);
double c = *((double *) argv[4]);
double d = *((double *) argv[5]);
double dx = *((double *) argv[6]);
double dy = *((double *) argv[7]);
int x = *((int *) argv[8]);
int y = *((int *) argv[9]);
int w = *((int *) argv[10]);
int h = *((int *) argv[11]);
return( im_affine( argv[0], argv[1], a, b, c, d, dx, dy, x, y, w, h ) );
}
/* Description of im_affine.
*/
static im_function affine_desc = {
"im_affine", /* Name */
"affine transform",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
affine_vec, /* Dispatch function */
IM_NUMBER( affine_args ), /* Size of arg list */
affine_args /* Arg list */
};
/* similarity args
*/
static im_arg_desc similarity_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" )
};
/* Call im_similarity via arg vector.
*/
static int
similarity_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double b = *((double *) argv[3]);
double dx = *((double *) argv[4]);
double dy = *((double *) argv[5]);
return( im_similarity( argv[0], argv[1], a, b, dx, dy ) );
}
/* Description of im_similarity.
*/
static im_function similarity_desc = {
"im_similarity", /* Name */
"similarity transformation",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
similarity_vec, /* Dispatch function */
IM_NUMBER( similarity_args ), /* Size of arg list */
similarity_args /* Arg list */
};
/* similarity_area args
*/
static im_arg_desc similarity_area_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "dx" ),
IM_INPUT_DOUBLE( "dy" ),
IM_INPUT_INT( "x" ),
IM_INPUT_INT( "y" ),
IM_INPUT_INT( "w" ),
IM_INPUT_INT( "h" )
};
/* Call im_similarity_area via arg vector.
*/
static int
similarity_area_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double b = *((double *) argv[3]);
double dx = *((double *) argv[4]);
double dy = *((double *) argv[5]);
int x = *((int *) argv[6]);
int y = *((int *) argv[7]);
int w = *((int *) argv[8]);
int h = *((int *) argv[9]);
return( im_similarity_area( argv[0], argv[1], a, b, dx, dy,
x, y, w, h ) );
}
/* Description of im_similarity_area.
*/
static im_function similarity_area_desc = {
"im_similarity_area", /* Name */
"output area xywh of similarity transformation",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
similarity_area_vec, /* Dispatch function */
IM_NUMBER( similarity_area_args ), /* Size of arg list */
similarity_area_args /* Arg list */
};
/* Package up all these functions.
*/
static im_function *deprecated_list[] = {
&cmulnorm_desc,
&fav4_desc,
&gadd_desc,
&litecor_desc
&litecor_desc,
&affine_desc,
&similarity_area_desc,
&similarity_desc
};
/* Package of functions.

141
libvips/deprecated/rename.c Normal file
View File

@ -0,0 +1,141 @@
/* rename.c --- wrappers for various renamed functions
*
* 20/9/09
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <vips/vips.h>
#include <vips/deprecated.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
int
im_remainderconst_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
return( im_remainder_vec( in, out, n, c ) );
}
int
im_and_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
return( im_andimage_vec( in, out, n, c ) );
}
int
im_or_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
return( im_orimage_vec( in, out, n, c ) );
}
int
im_eor_vec( IMAGE *in, IMAGE *out, int n, double *c )
{
return( im_eorimage_vec( in, out, n, c ) );
}
int
im_andconst( IMAGE *in, IMAGE *out, double c )
{
return( im_andimageconst( in, out, c ) );
}
int
im_orconst( IMAGE *in, IMAGE *out, double c )
{
return( im_orimageconst( in, out, c ) );
}
int
im_eorconst( IMAGE *in, IMAGE *out, double c )
{
return( im_eorimageconst( in, out, c ) );
}
void
im_errormsg( const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_verror( "untranslated", fmt, ap );
va_end( ap );
}
void
im_verrormsg( const char *fmt, va_list ap )
{
im_verror( "untranslated", fmt, ap );
}
void
im_errormsg_system( int err, const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_verror_system( err, "untranslated", fmt, ap );
va_end( ap );
}
void
im_diagnostics( const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_vdiag( "untranslated", fmt, ap );
va_end( ap );
}
void
im_warning( const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_vwarn( "untranslated", fmt, ap );
va_end( ap );
}
int
im_affine( IMAGE *in, IMAGE *out,
double a, double b, double c, double d, double dx, double dy,
int ox, int oy, int ow, int oh )
{
return( im_affinei( in, out,
vips_interpolate_bilinear_static(),
a, b, c, d, dx, dy,
ox, oy, ow, oh ) );
}

View File

@ -122,7 +122,7 @@ ideal_hpf( IMAGE *out, int xs, int ys, double fc )
double *xd, *yd, fc2, distance2;
if( xs != ys || fc < 0.0 ) {
im_errormsg( "ideal_hpf: bad args" );
im_error( "ideal_hpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -131,7 +131,7 @@ ideal_hpf( IMAGE *out, int xs, int ys, double fc )
else if( fc <= 1.0 && fc > 0.0 )
fc2 = fc * fc;
else {
im_errormsg( "ideal_hpf: bad args" );
im_error( "ideal_hpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -165,7 +165,7 @@ ideal_lpf( IMAGE *out, int xs, int ys, double fc )
double *xd, *yd, fc2, distance2;
if( xs != ys || fc <= 0.0 ) {
im_errormsg( "ideal_lpf: bad args" );
im_error( "ideal_lpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -174,7 +174,7 @@ ideal_lpf( IMAGE *out, int xs, int ys, double fc )
else if( fc <= 1.0 && fc > 0.0 )
fc2 = fc * fc;
else {
im_errormsg( "ideal_lpf: bad args" );
im_error( "ideal_lpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -207,7 +207,7 @@ butterworth_hpf( IMAGE *out, int xs, int ys,
double *xd, *yd, fc2, distance2, cnst;
if( xs != ys || fc < 0.0 || order < 1.0 || ac <= 0.0 || ac >= 1.0 ) {
im_errormsg( "butterworth_hpf: bad args" );
im_error( "butterworth_hpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -216,7 +216,7 @@ butterworth_hpf( IMAGE *out, int xs, int ys,
else if( fc <= 1.0 && fc > 0.0 )
fc2 = fc * fc;
else {
im_errormsg( "butterworth_hpf: bad args" );
im_error( "butterworth_hpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -254,7 +254,7 @@ butterworth_lpf( IMAGE *out, int xs, int ys,
double *xd, *yd, fc2, distance2, cnst;
if( xs != ys || fc <= 0.0 || order < 1.0 || ac >= 1.0 || ac <= 0.0 ) {
im_errormsg( "butterworth_lpf: bad args" );
im_error( "butterworth_lpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -263,7 +263,7 @@ butterworth_lpf( IMAGE *out, int xs, int ys,
else if( fc <= 1.0 && fc > 0.0 )
fc2 = fc * fc;
else {
im_errormsg( "butterworth_lpf: bad args" );
im_error( "butterworth_lpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -294,7 +294,7 @@ gaussian_hpf( IMAGE *out, int xs, int ys, double fc, double ac )
double *xd, *yd, fc2, distance2, cnst;
if( xs != ys || fc <= 0.0 || ac >= 1.0 || ac <= 0.0 ) {
im_errormsg( "gaussian_hpf: bad args" );
im_error( "gaussian_hpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -303,7 +303,7 @@ gaussian_hpf( IMAGE *out, int xs, int ys, double fc, double ac )
else if( fc <= 1.0 && fc > 0.0 )
fc2 = fc * fc;
else {
im_errormsg( "gaussian_hpf: bad args" );
im_error( "gaussian_hpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -335,7 +335,7 @@ gaussian_lpf( IMAGE *out, int xs, int ys, double fc, double ac )
double *xd, *yd, fc2, distance2, cnst;
if( xs != ys || fc < 0.0 || ac >= 1.0 || ac <= 0.0 ) {
im_errormsg( "gaussian_lpf: bad args" );
im_error( "gaussian_lpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -344,7 +344,7 @@ gaussian_lpf( IMAGE *out, int xs, int ys, double fc, double ac )
else if( fc <= 1.0 && fc > 0.0 )
fc2 = fc * fc;
else {
im_errormsg( "gaussian_lpf: bad args" );
im_error( "gaussian_lpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -375,7 +375,7 @@ ideal_rpf( IMAGE *out, int xs, int ys, double fc, double width )
double *xd, *yd, df, distance2, radius1_2, radius2_2;
if( xs != ys || fc <= 0 || width <= 0 ) {
im_errormsg( "ideal_rpf: bad args" );
im_error( "ideal_rpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -389,7 +389,7 @@ ideal_rpf( IMAGE *out, int xs, int ys, double fc, double width )
radius2_2 = (fc + df) * (fc + df) * 4.0 / ((double)(xs * xs));
}
else {
im_errormsg( "ideal_rpf: bad args" );
im_error( "ideal_rpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -425,7 +425,7 @@ ideal_rrf( IMAGE *out, int xs, int ys, double fc, double width )
double *xd, *yd, df, distance2, radius1_2, radius2_2;
if( xs != ys || fc < 0.0 || width <= 0.0 ) {
im_errormsg( "ideal_rrf: bad args" );
im_error( "ideal_rrf", "%s", _( "bad args" ) );
return( NULL );
}
@ -439,7 +439,7 @@ ideal_rrf( IMAGE *out, int xs, int ys, double fc, double width )
radius2_2 = (fc + df) * (fc + df) * 4.0 / ((double)(xs * xs));
}
else {
im_errormsg( "ideal_rrf: bad args" );
im_error( "ideal_rrf", "%s", _( "bad args" ) );
return( NULL );
}
@ -475,7 +475,7 @@ butterworth_rpf( IMAGE *out, int xs, int ys,
if( xs != ys || fc <= 0.0 || width <= 0.0 ||
order < 1.0 || ac >= 1.0 || ac <= 0.0 ) {
im_errormsg( "butterworth_rpf: bad args" );
im_error( "butterworth_rpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -489,7 +489,7 @@ butterworth_rpf( IMAGE *out, int xs, int ys,
ndf = width /(double)ys;
}
else {
im_errormsg( "butterworth_rpf: bad args" );
im_error( "butterworth_rpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -529,7 +529,7 @@ butterworth_rrf( IMAGE *out, int xs, int ys,
if( xs != ys || fc <= 0.0 || width <= 0.0 ||
order < 1.0 || ac >= 1.0 || ac <= 0.0 ) {
im_errormsg( "butterworth_rrf: bad args" );
im_error( "butterworth_rrf", "%s", _( "bad args" ) );
return( NULL );
}
@ -543,7 +543,7 @@ butterworth_rrf( IMAGE *out, int xs, int ys,
ndf = width /(double)ys;
}
else {
im_errormsg( "butterworth_rrf: bad args" );
im_error( "butterworth_rrf", "%s", _( "bad args" ) );
return( NULL );
}
@ -580,7 +580,7 @@ gaussian_rpf( IMAGE *out, int xs, int ys, double fc, double width, double ac )
double *xd, *yd, d, df, ndf, ndf2, nfc, cnst;
if( xs != ys || fc < 0.0 || width <= 0.0 || ac <= 0.0 || ac > 1.0 ) {
im_errormsg( "gaussian_rpf: bad args" );
im_error( "gaussian_rpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -594,7 +594,7 @@ gaussian_rpf( IMAGE *out, int xs, int ys, double fc, double width, double ac )
ndf = width /(double)ys;
}
else {
im_errormsg( "gaussian_rpf: bad args" );
im_error( "gaussian_rpf", "%s", _( "bad args" ) );
return( NULL );
}
@ -631,7 +631,7 @@ gaussian_rrf( IMAGE *out, int xs, int ys, double fc, double width, double ac )
double *xd, *yd, d, df, ndf, ndf2, nfc, cnst;
if( xs != ys || fc < 0.0 || width <= 0.0 || ac <= 0.0 || ac > 1.0 ) {
im_errormsg( "gaussian_rrf: bad args" );
im_error( "gaussian_rrf", "%s", _( "bad args" ) );
return( NULL );
}
@ -645,7 +645,7 @@ gaussian_rrf( IMAGE *out, int xs, int ys, double fc, double width, double ac )
ndf = width / (double)ys;
}
else {
im_errormsg( "gaussian_rrf: bad args" );
im_error( "gaussian_rrf", "%s", _( "bad args" ) );
return( NULL );
}
@ -699,7 +699,7 @@ fractal_flt( IMAGE *out, int xs, int ys, double frdim )
double *xd, *yd, distance2, cnst;
if( xs != ys || frdim <= 2.0 || frdim >= 3.0 ) {
im_errormsg( "fractal_flt: bad args" );
im_error( "fractal_flt", "%s", _( "bad args" ) );
return( NULL );
}
@ -792,7 +792,8 @@ im__create_quarter( IMAGE *out, int xs, int ys, MaskType flag, va_list ap )
return( fractal_flt( out, xs, ys, p0 ) );
default:
im_errormsg( "create_quarter: unimplemented mask" );
im_error( "create_quarter", "%s",
_( "unimplemented mask" ) );
return( NULL );
}

View File

@ -160,7 +160,7 @@ ideal_bpf( IMAGE *out, double fcx, double fcy, double r )
int y2plus, y2minus;
if( xs != ys ) {
im_errormsg( "ideal_bpf: bad sizes" );
im_error( "ideal_bpf", "%s", _( "bad sizes" ) );
return( -1 );
}
if( fabs(fcx) <= 1.0 && fabs(fcy) < 1.0 && r > 0.0 && r < 1.0 ) {
@ -174,7 +174,7 @@ ideal_bpf( IMAGE *out, double fcx, double fcy, double r )
r2 = r*r;
}
else {
im_errormsg( "ideal_bpf: bad args" );
im_error( "ideal_bpf", "%s", _( "bad args" ) );
return( -1 );
}
@ -230,7 +230,7 @@ ideal_brf( IMAGE *out, double fcx, double fcy, double r )
int y2plus, y2minus;
if( xs != ys ) {
im_errormsg( "ideal_brf: bad args" );
im_error( "ideal_brf", "%s", _( "bad args" ) );
return( -1 );
}
if( fabs(fcx) <= 1.0 && fabs(fcy) <= 1.0 && r > 0.0 && r < 1.0 ) {
@ -244,7 +244,7 @@ ideal_brf( IMAGE *out, double fcx, double fcy, double r )
r2 = r*r;
}
else {
im_errormsg( "ideal_brf: bad args" );
im_error( "ideal_brf", "%s", _( "bad args" ) );
return( -1 );
}
@ -305,7 +305,7 @@ butterworth_bpf( IMAGE *out,
int y2plus, y2minus;
if( xs != ys || order < 1.0 ) {
im_errormsg( "butterworth_bpf: bad sizes" );
im_error( "butterworth_bpf", "%s", _( "bad sizes" ) );
return( -1 );
}
if( fabs(fcx) <= 1.0 && fabs(fcy) <= 1.0 && r > 0.0 && r < 1.0 ) {
@ -319,11 +319,11 @@ butterworth_bpf( IMAGE *out,
nr2 = r*r;
}
else {
im_errormsg( "butterworth_bpf: bad args" );
im_error( "butterworth_bpf", "%s", _( "bad args" ) );
return( -1 );
}
if( ac >= 1.0 || ac < 0.0) {
im_errormsg( "butterworth_bpf: bad args" );
im_error( "butterworth_bpf", "%s", _( "bad args" ) );
return( -1 );
}
@ -396,7 +396,7 @@ butterworth_brf( IMAGE *out,
int y2plus, y2minus;
if( xs != ys || order < 1.0 ) {
im_errormsg( "butterworth_brf: bad sizes" );
im_error( "butterworth_brf", "%s", _( "bad sizes" ) );
return( -1 );
}
if( fabs(fcx) <= 1.0 && fabs(fcy) <= 1.0 && r > 0.0 && r < 1.0 ) {
@ -410,11 +410,11 @@ butterworth_brf( IMAGE *out,
nr2 = r*r;
}
else {
im_errormsg( "butterworth_brf: bad args" );
im_error( "butterworth_brf", "%s", _( "bad args" ) );
return( -1 );
}
if( ac >= 1.0 || ac < 0.0) {
im_errormsg( "butterworth_brf: bad args" );
im_error( "butterworth_brf", "%s", _( "bad args" ) );
return( -1 );
}
@ -478,7 +478,7 @@ gaussian_bpf( IMAGE *out, double fcx, double fcy, double r, double ac )
int y2plus, y2minus;
if( xs != ys ) {
im_errormsg( "gauss_bpf: bad sizes" );
im_error( "gauss_bpf", "%s", _( "bad sizes" ) );
return( -1 );
}
if( fabs(fcx) <= 1.0 && fabs(fcy) <= 1.0 && r > 0.0 && r < 1.0 ) {
@ -492,11 +492,11 @@ gaussian_bpf( IMAGE *out, double fcx, double fcy, double r, double ac )
nr2 = r*r;
}
else {
im_errormsg( "gauss_bpf: bad args (f)" );
im_error( "gauss_bpf", "%s", _( "bad args (f)" ) );
return( -1 );
}
if( ac >= 1.0 || ac < 0.0 ) {
im_errormsg( "gauss_bpf: bad args (ac)" );
im_error( "gauss_bpf", "%s", _( "bad args (ac)" ) );
return( -1 );
}
@ -558,7 +558,7 @@ gaussian_brf( IMAGE *out, double fcx, double fcy, double r, double ac )
int y2plus, y2minus;
if( xs != ys ) {
im_errormsg( "gauss_brf: bad sizes" );
im_error( "gauss_brf", "%s", _( "bad sizes" ) );
return( -1 );
}
if( fabs(fcx) <= 1.0 && fabs(fcy) <= 1.0 && r > 0.0 && r < 1.0 ) {
@ -572,11 +572,11 @@ gaussian_brf( IMAGE *out, double fcx, double fcy, double r, double ac )
nr2 = r * r;
}
else {
im_errormsg( "gauss_brf: bad args" );
im_error( "gauss_brf", "%s", _( "bad args" ) );
return( -1 );
}
if( ac >= 1.0 || ac < 0.0 ) {
im_errormsg( "gauss_brf: bad args" );
im_error( "gauss_brf", "%s", _( "bad args" ) );
return( -1 );
}
@ -656,7 +656,8 @@ im__fmaskcir( IMAGE *out, MaskType flag, va_list ap )
return( gaussian_brf( out, p0, p1, p2, p3 ) );
default:
im_errormsg( "im__fmaskcir: unimplemented mask" );
im_error( "im__fmaskcir", "%s",
_( "unimplemented mask" ) );
return( -1 );
}

View File

@ -69,7 +69,8 @@ im_fractsurf( IMAGE *out, int size, double frd )
if( !noise )
return( -1 );
if( frd <= 2.0 || frd >= 3.0 ) {
im_errormsg( "im_fractsurf: dimension shuld be in (2,3)" );
im_error( "im_fractsurf", "%s",
_( "dimension shuld be in (2,3)" ) );
return( -1 );
}

View File

@ -143,7 +143,8 @@ build_freq_mask( IMAGE *out, int xs, int ys, MaskType flag, va_list ap )
/* Check sizes and create one quarter of the final mask
*/
if( !im_ispoweroftwo( xs ) || !im_ispoweroftwo( ys ) ) {
im_errormsg( "im_freq_mask: mask sizes power of 2 only" );
im_error( "im_freq_mask", "%s",
_( "mask sizes power of 2 only" ) );
return( -1 );
}
@ -190,7 +191,7 @@ build_freq_mask( IMAGE *out, int xs, int ys, MaskType flag, va_list ap )
break;
default:
im_errormsg( "im_freq_mask: unimplemented mask type" );
im_error( "im_freq_mask", "%s", _( "unimplemented mask type" ) );
return( -1 );
}

View File

@ -68,7 +68,7 @@ im_gammacorrect( IMAGE *in, IMAGE *out, double exponent )
if( im_piocheck( in, out ) )
return( -1 );
if( in->BandFmt != IM_BANDFMT_UCHAR ) {
im_errormsg( "im_gammacorrect: uchar images only" );
im_error( "im_gammacorrect", "%s", _( "uchar images only" ) );
return( -1 );
}

View File

@ -89,17 +89,17 @@ match( IMAGE *in, IMAGE *ref, IMAGE *out )
if( im_iocheck( in, out ) || im_iocheck( ref, out ) )
return( -1 );
if( in->Coding != IM_CODING_NONE || ref->Coding != IM_CODING_NONE ) {
im_errormsg( "im_histspec: not uncoded" );
im_error( "im_histspec", "%s", _( "not uncoded" ) );
return( -1 );
}
if( in->BandFmt != IM_BANDFMT_UINT ||
ref->BandFmt != IM_BANDFMT_UINT ) {
im_errormsg( "im_histspec: bad band format" );
im_error( "im_histspec", "%s", _( "bad band format" ) );
return( -1 );
}
if( in->Bands != ref->Bands ) {
im_errormsg( "im_histspec: input histograms differ in "
"number of bands" );
im_error( "im_histspec", "%s",
_( "input histograms differ in number of bands" ) );
return( -1 );
}
@ -110,7 +110,7 @@ match( IMAGE *in, IMAGE *ref, IMAGE *out )
else if( inpx <= 65536 && refpx <= 65536 )
px = 65536;
else {
im_errormsg( "im_histspec: luts too large" );
im_error( "im_histspec", "%s", _( "luts too large" ) );
return( -1 );
}
max = px * bands;
@ -187,8 +187,8 @@ im_histspec( IMAGE *in, IMAGE *ref, IMAGE *out )
if( !t1 || !t2 || !t2 || !t4 || !t5 )
return( -1 );
if( !im_isuint( in ) || !im_isuint( ref ) ) {
im_errormsg( "im_histspec: input luts are not some unsigned "
"integer type" );
im_error( "im_histspec", "%s",
_( "input luts are not some unsigned integer type" ) );
return( -1 );
}

View File

@ -83,7 +83,7 @@ im_identity( IMAGE *lut, int bands )
if( im_outcheck( lut ) )
return( -1 );
if( bands < 0 ) {
im_errormsg( "im_identity: bad bands" );
im_error( "im_identity", "%s", _( "bad bands" ) );
return( -1 );
}
@ -126,11 +126,11 @@ im_identity_ushort( IMAGE *lut, int bands, int sz )
if( im_outcheck( lut ) )
return( -1 );
if( sz > 65536 || sz < 0 ) {
im_errormsg( "im_identity_ushort: bad size" );
im_error( "im_identity_ushort", "%s", _( "bad size" ) );
return( -1 );
}
if( bands < 0 ) {
im_errormsg( "im_identity_ushort: bad bands" );
im_error( "im_identity_ushort", "%s", _( "bad bands" ) );
return( -1 );
}

View File

@ -142,8 +142,8 @@ build_state( State *state, DOUBLEMASK *input, IMAGE *output, int lut_size )
for( x = 0; x < input->xsize; x++ )
if( state->data[y][x] > 1.0 ||
state->data[y][x] < 0.0 ) {
im_errormsg( "im_invertlut: element out of "
"range [0,1]" );
im_error( "im_invertlut", "%s",
_( "element out of range [0,1]" ) );
return( -1 );
}
@ -242,11 +242,11 @@ im_invertlut( DOUBLEMASK *input, IMAGE *output, int lut_size )
State state;
if( !input || input->xsize < 2 || input->ysize < 1 ) {
im_errormsg( "im_invertlut: bad input matrix" );
im_error( "im_invertlut", "%s", _( "bad input matrix" ) );
return( -1 );
}
if( lut_size < 1 || lut_size > 65536 ) {
im_errormsg( "im_invertlut: bad lut_size" );
im_error( "im_invertlut", "%s", _( "bad lut_size" ) );
return( -1 );
}

View File

@ -197,18 +197,19 @@ im_stdif_raw( IMAGE *in, IMAGE *out,
if( m0 < 0 || m0 > 255 || a < 0 || a > 1.0 || b < 0 || b > 2 ||
s0 < 0 || s0 > 255 ) {
im_errormsg( "im_stdif: parameters out of range" );
im_error( "im_stdif", "%s", _( "parameters out of range" ) );
return( -1 );
}
if( im_piocheck( in, out ) )
return( -1 );
if( in->Bbits != IM_BBITS_BYTE || in->BandFmt != IM_BANDFMT_UCHAR ||
in->Bands != 1 || in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_stdif: one band uchar uncoded only" );
im_error( "im_stdif", "%s",
_( "one band uchar uncoded only" ) );
return( -1 );
}
if( xwin > in->Xsize || ywin > in->Ysize ) {
im_errormsg( "im_stdif: window too large" );
im_error( "im_stdif", "%s", _( "window too large" ) );
return( -1 );
}
if( im_cp_desc( out, in ) )

View File

@ -533,7 +533,7 @@ im_tone_analyse(
}
Lw = i / 10.24;
im_diagnostics( "im_tone_analyse: set Lb = %g, Lw = %g", Lb, Lw );
im_diag( "im_tone_analyse", "set Lb = %g, Lw = %g", Lb, Lw );
return( im_tone_build( lut, Lb, Lw, Ps, Pm, Ph, S, M, H ) );
}

View File

@ -1,6 +1,7 @@
pkginclude_HEADERS = \
arithmetic.h \
colour.h \
boolean.h \
debug.h \
dispatch.h \
format.h \

View File

@ -72,8 +72,8 @@ int im_expntra_vec( IMAGE *in, IMAGE *out, int n, double *e );
int im_logtra( IMAGE *in, IMAGE *out );
int im_log10tra( IMAGE *in, IMAGE *out );
int im_remainder( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_remainder_vec( IMAGE *in, IMAGE *out, int n, double *c );
int im_remainderconst( IMAGE *in, IMAGE *out, double c );
int im_remainderconst_vec( IMAGE *in, IMAGE *out, int n, double *c );
int im_floor( IMAGE *in, IMAGE *out );
int im_rint( IMAGE *in, IMAGE *out );
int im_ceil( IMAGE *in, IMAGE *out );

View File

@ -0,0 +1,58 @@
/* boolean.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_BOOLEAN_H
#define IM_BOOLEAN_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
int im_andimage( IMAGE *, IMAGE *, IMAGE * );
int im_andimage_vec( IMAGE *, IMAGE *, int, double * );
int im_andimageconst( IMAGE *, IMAGE *, double );
int im_orimage( IMAGE *, IMAGE *, IMAGE * );
int im_orimage_vec( IMAGE *, IMAGE *, int, double * );
int im_orimageconst( IMAGE *, IMAGE *, double );
int im_eorimage( IMAGE *, IMAGE *, IMAGE * );
int im_eorimage_vec( IMAGE *, IMAGE *, int, double * );
int im_eorimageconst( IMAGE *, IMAGE *, double );
int im_shiftleft_vec( IMAGE *in, IMAGE *out, int n, double *c );
int im_shiftleft( IMAGE *, IMAGE *, int );
int im_shiftright_vec( IMAGE *in, IMAGE *out, int n, double *c );
int im_shiftright( IMAGE *, IMAGE *, int );
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*IM_BOOLEAN_H*/

View File

@ -286,6 +286,33 @@ int im_fav4( IMAGE **, IMAGE * );
int im_gadd( double, IMAGE *, double, IMAGE *, double, IMAGE *);
int im_litecor( IMAGE *, IMAGE *, IMAGE *, int, double );
/* Renamed operations.
*/
/* arithmetic
*/
int im_remainderconst_vec( IMAGE *in, IMAGE *out, int n, double *c );
/* boolean
*/
int im_andconst( IMAGE *, IMAGE *, double );
int im_and_vec( IMAGE *, IMAGE *, int, double * );
int im_orconst( IMAGE *, IMAGE *, double );
int im_or_vec( IMAGE *, IMAGE *, int, double * );
int im_eorconst( IMAGE *, IMAGE *, double );
int im_eor_vec( IMAGE *, IMAGE *, int, double * );
/* mosaicing
*/
int im_affine( IMAGE *in, IMAGE *out,
double a, double b, double c, double d, double dx, double dy,
int ox, int oy, int ow, int oh );
int im_similarity( IMAGE *in, IMAGE *out,
double a, double b, double dx, double dy );
int im_similarity_area( IMAGE *in, IMAGE *out,
double a, double b, double dx, double dy,
int ox, int oy, int ow, int oh );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -73,7 +73,6 @@ GOptionGroup *im_get_option_group( void );
*/
void im_progress_set( int progress );
const char *im_error_buffer( void );
int im_debugim( IMAGE * );
int im_printlines( IMAGE * );
@ -163,14 +162,19 @@ int im_add_invalidate_callback( IMAGE *, im_callback_fn, void *, void * );
void error_exit( const char *, ... )
__attribute__((noreturn, format(printf, 1, 2)));
const char *im_error_buffer( void );
void im_error_clear( void );
void im_verror( const char *domain, const char *fmt, va_list ap );
void im_error( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void im_verror_system( int err, const char *domain,
const char *fmt, va_list ap );
void im_error_system( int err, const char *domain, const char *fmt, ... )
__attribute__((format(printf, 3, 4)));
void im_vdiag( const char *domain, const char *fmt, va_list ap );
void im_warn( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void im_vwarn( const char *domain, const char *fmt, va_list ap );
void im_diag( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
@ -302,20 +306,6 @@ int im_fwfft( IMAGE *, IMAGE * );
int im_invfft( IMAGE *, IMAGE * );
int im_invfftr( IMAGE *, IMAGE * );
/* boolean
*/
int im_andimage( IMAGE *, IMAGE *, IMAGE * );
int im_andconst( IMAGE *, IMAGE *, double );
int im_and_vec( IMAGE *, IMAGE *, int, double * );
int im_orimage( IMAGE *, IMAGE *, IMAGE * );
int im_orconst( IMAGE *, IMAGE *, double );
int im_or_vec( IMAGE *, IMAGE *, int, double * );
int im_eorimage( IMAGE *, IMAGE *, IMAGE * );
int im_eorconst( IMAGE *, IMAGE *, double );
int im_eor_vec( IMAGE *, IMAGE *, int, double * );
int im_shiftleft( IMAGE *, IMAGE *, int );
int im_shiftright( IMAGE *, IMAGE *, int );
/* cimg
*/
int im_greyc_mask( IMAGE *in, IMAGE *out, IMAGE *mask,
@ -611,17 +601,6 @@ int im_correl( IMAGE *ref, IMAGE *sec,
int im_remosaic( IMAGE *in, IMAGE *out,
const char *old_str, const char *new_str );
/* Old stuff, for compat.
*/
int im_affine( IMAGE *in, IMAGE *out,
double a, double b, double c, double d, double dx, double dy,
int ox, int oy, int ow, int oh );
int im_similarity( IMAGE *in, IMAGE *out,
double a, double b, double dx, double dy );
int im_similarity_area( IMAGE *in, IMAGE *out,
double a, double b, double dx, double dy,
int ox, int oy, int ow, int oh );
int im_align_bands( IMAGE *in, IMAGE *out );
int im_maxpos_subpel( IMAGE *in, double *x, double *y );
@ -700,23 +679,6 @@ int im_video_v4l1( IMAGE *im, const char *device,
int ngrabs );
int im_video_test( IMAGE *im, int brightness, int error );
/* Backwards compatibility macros.
*/
#define im_clear_error_string() im_error_clear()
#define im_errorstring() im_error_buffer()
/* Deprecated API.
*/
void im_errormsg( const char *fmt, ... )
__attribute__((format(printf, 1, 2)));
void im_verrormsg( const char *fmt, va_list ap );
void im_errormsg_system( int err, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void im_diagnostics( const char *fmt, ... )
__attribute__((format(printf, 1, 2)));
void im_warning( const char *fmt, ... )
__attribute__((format(printf, 1, 2)));
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -137,6 +137,7 @@ typedef struct im__DOUBLEMASK {
#include <vips/proto.h>
#include <vips/arithmetic.h>
#include <vips/boolean.h>
#ifdef IM_ENABLE_DEPRECATED
#include <vips/deprecated.h>

View File

@ -75,19 +75,19 @@ im_circle( IMAGE *im, int cx, int cy, int radius, int intensity)
if ( (im->data == NULL)||(im->BandFmt != IM_BANDFMT_UCHAR)||(im->Bands != 1)
||(im->Bbits != IM_BBITS_BYTE) )
{
im_errormsg("im_circle: unable to write input image");
im_error("im_circle: ", "%s", _( "able to write input image") );
return(-1);
}
if ((intensity > 255)||(intensity <= 0))
{
im_errormsg("im_circle: intensity between 0 and 255");
im_error( "im_circle", "%s", _( "intensity between 0 and 255") );
return(-1);
}
/* Check if circle fits into image */
if ( ((radius+cy)> im->Ysize - 1) || ((cy-radius)< 0 ) ||
((radius+cx)> im->Xsize - 1) || ((cx-radius) < 0 ) )
{
im_errormsg("im_circle: The circle doesnot fit in image");
im_error( "im_circle", "%s", _( "The circle doesnot fit in image") );
return(-1);
}
/* Draw the circle */

View File

@ -69,13 +69,16 @@ double signx, signy;
return( -1 );
/* check coordinates */
if ( (x1 > image->Xsize)||(x1<0)||(y1 > image->Ysize)||(y1<0)
||(x2 > image->Xsize)||(x2<0)||(y2 > image->Ysize)||(y2<0) )
{ im_errormsg("im_line: invalid line cooordinates"); return(-1); }
if ((pelval > 255)||(pelval < 0))
{im_errormsg("im_line: line intensity between 0 and 255"); return(-1); }
||(x2 > image->Xsize)||(x2<0)||(y2 > image->Ysize)||(y2<0) ) {
im_error( "im_line", "%s", _( "invalid line cooordinates") );
return(-1); }
if ((pelval > 255)||(pelval < 0)) {
im_error( "im_line", "%s", _( "line intensity between 0 and 255") );
return(-1); }
if (image->Bands != 1)
{ im_errormsg("im_line: image should have one band only");return(-1); }
if (image->Bands != 1) {
im_error( "im_line", "%s", _( "image should have one band only") );
return(-1); }
dx = (double)(x2 - x1);
dy = (double)(y2 - y1);

View File

@ -107,7 +107,8 @@ im_fastline( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel )
y1 > im->Ysize || y1 < 0 ||
x2 > im->Xsize || x2 < 0 ||
y2 > im->Ysize || y2 < 0 ) {
im_errormsg( "im_fastline: invalid line cooordinates" );
im_error( "im_fastline", "%s",
_( "invalid line cooordinates" ) );
return( -1 );
}
@ -426,7 +427,7 @@ im_lineset( IMAGE *in, IMAGE *out, IMAGE *mask, IMAGE *ink,
return( -1 );
}
/* Copy the image thenm fastline to it ... this will render to a "t"
/* Copy the image then fastline to it ... this will render to a "t"
* usually.
*/
if( im_incheck( mask ) ||

View File

@ -75,7 +75,7 @@ im_readpoint( IMAGE *im, int x, int y, PEL *pel )
/* Check coordinates in range.
*/
if( x > im->Xsize || x < 0 || y > im->Ysize || y < 0 ) {
im_errormsg( "im_readpoint: invalid cooordinates" );
im_error( "im_readpoint", "%s", _( "invalid cooordinates" ) );
return( 1 );
}

View File

@ -1,10 +1,5 @@
/* @(#) error handling
* @(#)
* @(#) Usage:
* @(#) void im_errormsg(variable_list)
* @(#) (variable_list) is (format, arg1, arg2, ...)
* @(#) format, arg1, arg2, etc are the same as in fprintf
* @(#)
/* error.c --- error message handling
*
* Copyright: N. Dessipris
* Written on: 18/03/1991
* Updated on: 9/7/92 KM
@ -202,52 +197,3 @@ im_warn( const char *domain, const char *fmt, ... )
im_vwarn( domain, fmt, ap );
va_end( ap );
}
/* Compatibility with pre-7.10 ... can't portably do these as macros sadly.
*/
void
im_errormsg( const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_verror( "untranslated", fmt, ap );
va_end( ap );
}
void
im_verrormsg( const char *fmt, va_list ap )
{
im_verror( "untranslated", fmt, ap );
}
void
im_errormsg_system( int err, const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_verror_system( err, "untranslated", fmt, ap );
va_end( ap );
}
void
im_diagnostics( const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_vdiag( "untranslated", fmt, ap );
va_end( ap );
}
void
im_warning( const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
im_vwarn( "untranslated", fmt, ap );
va_end( ap );
}

View File

@ -68,7 +68,7 @@ im_debugim( IMAGE *in )
if( im_incheck( in ) )
return( -1 );
if( in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_debugim: input must be uncoded" );
im_error( "im_debugim", "%s", _( "input must be uncoded" ) );
return( -1 );
}
@ -130,7 +130,7 @@ im_debugim( IMAGE *in )
case IM_BANDFMT_DPCOMPLEX: loopcmplx(double); break;
default:
im_errormsg("im_debugim: unknown input format");
im_error( "im_debugim", "%s", _( "unknown input format") );
return( -1 );
}

View File

@ -60,7 +60,7 @@ im_image( void *buffer, int width, int height, int bands, int format )
if( width <= 0 || height <= 0 || bands <= 0 ||
format < 0 || format > IM_BANDFMT_DPCOMPLEX ) {
im_errormsg( "im_image: bad parameters" );
im_error( "im_image", "%s", _( "bad parameters" ) );
return( NULL );
}

View File

@ -143,7 +143,7 @@ im_init_world( const char *argv0 )
*/
if( im_load_plugins( "%s/vips-%d.%d",
libdir, IM_MAJOR_VERSION, IM_MINOR_VERSION ) ) {
im_warn( "im_init_world", "%s", im_errorstring() );
im_warn( "im_init_world", "%s", im_error_buffer() );
im_error_clear();
}
@ -151,7 +151,7 @@ im_init_world( const char *argv0 )
* :-( kept for back compat convenience.
*/
if( im_load_plugins( "%s", libdir ) ) {
im_warn( "im_init_world", "%s", im_errorstring() );
im_warn( "im_init_world", "%s", im_error_buffer() );
im_error_clear();
}

View File

@ -62,7 +62,7 @@ im_makerw( IMAGE *im )
/* This will rewind im_openout() files, and generate im_partial() files.
*/
if( im_incheck( im ) ) {
im_errormsg( "im_makerw: unable to rewind file" );
im_error( "im_makerw", "%s", _( "unable to rewind file" ) );
return( -1 );
}
@ -78,7 +78,7 @@ im_makerw( IMAGE *im )
break;
default:
im_errormsg( "im_makerw: bad file type" );
im_error( "im_makerw", "%s", _( "bad file type" ) );
return( -1 );
}

View File

@ -89,7 +89,7 @@ im_pincheck( IMAGE *im )
/* Should have been written to.
*/
if( !im->data ) {
im_errormsg( "im_pincheck: no image data" );
im_error( "im_pincheck", "%s", _( "no image data" ) );
return( -1 );
}
@ -105,7 +105,7 @@ im_pincheck( IMAGE *im )
/* Should have had generate functions attached.
*/
if( !im->generate ) {
im_errormsg( "im_pincheck: no image data" );
im_error( "im_pincheck", "%s", _( "no image data" ) );
return( -1 );
}
@ -123,7 +123,8 @@ im_pincheck( IMAGE *im )
printf( "im_pincheck: auto-rewind of %s\n", im->filename );
#endif/*DEBUG_IO*/
if( im__close( im ) || im_openin( im ) ) {
im_errormsg( "im_pincheck: auto-rewind for %s failed",
im_error( "im_pincheck",
_( "auto-rewind for %s failed" ),
im->filename );
return( -1 );
}
@ -131,7 +132,7 @@ im_pincheck( IMAGE *im )
break;
default:
im_errormsg( "im_pincheck: image not readable" );
im_error( "im_pincheck", "%s", _( "image not readable" ) );
return( -1 );
}
@ -144,7 +145,7 @@ int
im_poutcheck( IMAGE *im )
{
if( !im ) {
im_errormsg( "im_poutcheck: null image descriptor" );
im_error( "im_poutcheck", "%s", _( "null image descriptor" ) );
return( -1 );
}
@ -157,7 +158,8 @@ im_poutcheck( IMAGE *im )
/* Check that it has not been im_setupout().
*/
if( im->data ) {
im_errormsg( "im_poutcheck: image already written" );
im_error( "im_poutcheck", "%s",
_( "image already written" ) );
return( -1 );
}
@ -167,7 +169,8 @@ im_poutcheck( IMAGE *im )
/* Make sure nothing is attached.
*/
if( im->generate ) {
im_errormsg( "im_poutcheck: image already written" );
im_error( "im_poutcheck", "%s",
_( "image already written" ) );
return( -1 );
}
@ -180,7 +183,7 @@ im_poutcheck( IMAGE *im )
break;
default:
im_errormsg( "im_poutcheck: image not writeable" );
im_error( "im_poutcheck", "%s", _( "image not writeable" ) );
return( -1 );
}

View File

@ -78,11 +78,11 @@ im_printlines( IMAGE *in )
if( im_incheck( in ) )
return( -1 );
if( in->Coding != IM_CODING_NONE ) {
im_errormsg( "im_printlines: input must be uncoded" );
im_error( "im_printlines", "%s", _( "input must be uncoded" ) );
return( -1 );
}
if( !in->data ) {
im_errormsg( "im_debugim: unsuitable image type" );
im_error( "im_debugim", "%s", _( "unsuitable image type" ) );
return( -1 );
}
@ -140,7 +140,8 @@ im_printlines( IMAGE *in )
switch( in->BandFmt ) {
im_for_all_types();
default: {
im_errormsg( "im_printlines: unknown input format" );
im_error( "im_printlines", "%s",
_( "unknown input format" ) );
return( -1 );
}
}

View File

@ -740,7 +740,7 @@ im_local( IMAGE *im,
void *obj;
if( !im ) {
im_errormsg( "im_local: NULL image descriptor" );
im_error( "im_local", "%s", _( "NULL image descriptor" ) );
return( NULL );
}

View File

@ -62,7 +62,7 @@ im_matcat( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name )
/* matrices must be same width
*/
if( in1->xsize != in2->xsize ) {
im_errormsg( "im_matcat: matrices must be same width" );
im_error( "im_matcat", "%s", _( "matrices must be same width" ) );
return( NULL );
}
@ -72,7 +72,7 @@ im_matcat( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name )
/* Allocate output matrix.
*/
if( !(mat = im_create_dmask( name, newxsize, newysize )) ) {
im_errormsg( "im_matcat: unable to allocate output matrix" );
im_error( "im_matcat", "%s", _( "unable to allocate output matrix" ) );
return( NULL );
}

View File

@ -65,14 +65,14 @@ im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name )
/* Check matrix sizes.
*/
if( in1->xsize != in2->ysize ) {
im_errormsg( "im_matmul: bad sizes" );
im_error( "im_matmul", "%s", _( "bad sizes" ) );
return( NULL );
}
/* Allocate output matrix.
*/
if( !(mat = im_create_dmask( name, in2->xsize, in1->ysize )) ) {
im_errormsg( "im_matmul: unable to allocate output mask" );
im_error( "im_matmul", "%s", _( "unable to allocate output mask" ) );
return( NULL );
}

View File

@ -63,7 +63,7 @@ im_mattrn( DOUBLEMASK *in, const char *name )
/* Allocate output matrix.
*/
if( !(mat = im_create_dmask( name, in->ysize, in->xsize )) ) {
im_errormsg( "im_mattrn: unable to allocate output matrix" );
im_error( "im_mattrn", "%s", _( "unable to allocate output matrix" ) );
return( NULL );
}

View File

@ -74,12 +74,14 @@ im_cntlines( IMAGE *im, double *nolines, int flag )
return( -1 );
if( im->Coding != IM_CODING_NONE || im->BandFmt != IM_BANDFMT_UCHAR ||
im->Bands != 1 ) {
im_errormsg( "im_cntlines: 1-band uchar uncoded only" );
im_error( "im_cntlines", "%s",
_( "1-band uchar uncoded only" ) );
return( -1 );
}
if( flag != 0 && flag != 1 ) {
im_errormsg( "im_cntlines: flag should be 0 (horizontal) "
"or 1 (vertical)" );
im_error( "im_cntlines", "%s",
_( "flag should be 0 (horizontal) )"
"or 1 (vertical)" ) );
return( -1 );
}

View File

@ -67,11 +67,12 @@ im_profile( IMAGE *in, IMAGE *out, int dir )
return( -1 );
if( in->Coding != IM_CODING_NONE || in->BandFmt != IM_BANDFMT_UCHAR ||
in->Bands != 1 ) {
im_errormsg( "im_profile: 1-band uchar uncoded only" );
im_error( "im_profile", "%s",
_( "1-band uchar uncoded only" ) );
return( -1 );
}
if( dir != 0 && dir != 1 ) {
im_errormsg( "im_profile: dir not 0 or 1" );
im_error( "im_profile", "%s", _( "dir not 0 or 1" ) );
return( -1 );
}

View File

@ -65,7 +65,7 @@ im__avgdxdy( TIE_POINTS *points, int *dx, int *dy )
int i;
if( points->nopoints == 0 ) {
im_errormsg( "im_avgdxdy: no points to average" );
im_error( "im_avgdxdy", "%s", _( "no points to average" ) );
return( -1 );
}

View File

@ -205,11 +205,11 @@ im__chkpair( IMAGE *ref, IMAGE *sec, TIE_POINTS *points )
return( -1 );
if( ref->Bands != sec->Bands || ref->BandFmt != sec->BandFmt ||
ref->Coding != sec->Coding ) {
im_errormsg( "im_chkpair: inputs incompatible");
im_error( "im_chkpair", "%s", _( "inputs incompatible" ) );
return( -1 );
}
if( ref->Bands != 1 || ref->BandFmt != IM_BANDFMT_UCHAR ) {
im_errormsg( "im_chkpair: help!" );
im_error( "im_chkpair", "%s", _( "help!" ) );
return( -1 );
}

View File

@ -142,7 +142,7 @@ im__clinear( TIE_POINTS *points )
if( im_invmat( mat, 4 ) ) {
im_free_dmat( mat, 0, 3, 0, 3 );
im_free_dvector( g, 0, 3 );
im_errormsg( "im_clinear: im_invmat failed" );
im_error( "im_clinear", "%s", _( "im_invmat failed" ) );
return( -1 );
}

View File

@ -203,8 +203,8 @@ im__find_best_contrast( IMAGE *im,
int x, y, i;
if( nacross <= 0 || ndown <= 0 ) {
im_errormsg( "im__lrcalcon: mosaicing overlap too small for "
"your search size" );
im_error( "im__lrcalcon", "%s",
_( "overlap too small for your search size" ) );
return( -1 );
}
@ -242,7 +242,8 @@ im__find_best_contrast( IMAGE *im,
/* Found enough tie-points?
*/
if( elms < nbest ) {
im_errormsg( "im_mosaic: found %d tie-points, need at least %d",
im_error( "im_mosaic",
_( "found %d tie-points, need at least %d" ),
elms, nbest );
im_free( pc );
return( -1 );
@ -287,7 +288,7 @@ im__lrcalcon( IMAGE *ref, TIE_POINTS *points )
if( im_incheck( ref ) )
return( -1 );
if( ref->Bands != 1 || ref->BandFmt != IM_BANDFMT_UCHAR ) {
im_errormsg( "im__lrcalcon: not 1-band uchar image" );
im_error( "im__lrcalcon", "%s", _( "not 1-band uchar image" ) );
return( -1 );
}

View File

@ -122,7 +122,7 @@ im__find_lroverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
if( ref_in->Bands != sec_in->Bands ||
ref_in->BandFmt != sec_in->BandFmt ||
ref_in->Coding != sec_in->Coding ) {
im_errormsg( "im_lrmosaic: input images incompatible" );
im_error( "im_lrmosaic", "%s", _( "input images incompatible" ) );
return( -1 );
}
@ -130,7 +130,7 @@ im__find_lroverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
*/
if( halfcorrelation < 0 || halfarea < 0 ||
halfarea < halfcorrelation ) {
im_errormsg( "im_lrmosaic: bad area parameters" );
im_error( "im_lrmosaic", "%s", _( "bad area parameters" ) );
return( -1 );
}
@ -150,7 +150,7 @@ im__find_lroverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
im_rect_intersectrect( &left, &right, &overlap );
if( overlap.width < 2*halfarea + 1 ||
overlap.height < 2*halfarea + 1 ) {
im_errormsg( "im_lrmosaic: overlap too small for search" );
im_error( "im_lrmosaic", "%s", _( "overlap too small for search" ) );
return( -1 );
}
@ -213,7 +213,7 @@ im__find_lroverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
return( -1 );
}
else {
im_errormsg( "im_lrmosaic: unknown Coding type" );
im_error( "im_lrmosaic", "%s", _( "unknown Coding type" ) );
return( -1 );
}
@ -327,7 +327,7 @@ im__balance( IMAGE *ref, IMAGE *sec, IMAGE *out,
/* Test balancetype.
*/
if( balancetype < 0 || balancetype > 3 ) {
im_errormsg( "im_mosaic: bad balancetype parameter" );
im_error( "im_mosaic", "%s", _( "bad balancetype parameter" ) );
return( -1 );
}
@ -344,7 +344,7 @@ im__balance( IMAGE *ref, IMAGE *sec, IMAGE *out,
*/
if( ref->Coding != IM_CODING_NONE ||
ref->BandFmt != IM_BANDFMT_UCHAR ) {
im_errormsg( "im_mosaic: uncoded uchar only for balancing" );
im_error( "im_mosaic", "%s", _( "uncoded uchar only for balancing" ) );
return( -1 );
}

View File

@ -103,7 +103,7 @@ im__tbcalcon( IMAGE *ref, TIE_POINTS *points )
if( im_incheck( ref ) )
return( -1 );
if( ref->Bands != 1 || ref->BandFmt != IM_BANDFMT_UCHAR ) {
im_errormsg( "im__tbcalcon: help!" );
im_error( "im__tbcalcon", "%s", _( "help!" ) );
return( -1 );
}
@ -117,7 +117,7 @@ im__tbcalcon( IMAGE *ref, TIE_POINTS *points )
area.width--;
area.height--;
if( area.width < 0 || area.height < 0 ) {
im_errormsg( "im__tbcalcon: overlap too small" );
im_error( "im__tbcalcon", "%s", _( "overlap too small" ) );
return( -1 );
}

View File

@ -99,7 +99,7 @@ im__find_tboverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
if( ref_in->Bands != sec_in->Bands ||
ref_in->BandFmt != sec_in->BandFmt ||
ref_in->Coding != sec_in->Coding ) {
im_errormsg( "im_tbmosaic: input images incompatible" );
im_error( "im_tbmosaic", "%s", _( "input images incompatible" ) );
return( -1 );
}
@ -107,7 +107,7 @@ im__find_tboverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
*/
if( halfcorrelation < 0 || halfarea < 0 ||
halfarea < halfcorrelation ) {
im_errormsg( "im_tbmosaic: bad area parameters" );
im_error( "im_tbmosaic", "%s", _( "bad area parameters" ) );
return( -1 );
}
@ -127,7 +127,7 @@ im__find_tboverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
im_rect_intersectrect( &top, &bottom, &overlap );
if( overlap.width < 2*halfarea + 1 ||
overlap.height < 2*halfarea + 1 ) {
im_errormsg( "im_tbmosaic: overlap too small for search" );
im_error( "im_tbmosaic", "%s", _( "overlap too small for search" ) );
return( -1 );
}
@ -190,7 +190,7 @@ im__find_tboverlap( IMAGE *ref_in, IMAGE *sec_in, IMAGE *out,
return( -1 );
}
else {
im_errormsg( "im_tbmosaic: unknown Coding type" );
im_error( "im_tbmosaic", "%s", _( "unknown Coding type" ) );
return( -1 );
}

View File

@ -53,10 +53,8 @@ im__coeff( int xr1, int yr1, int xs1, int ys1,
{
DOUBLEMASK *in, *out;
if( !(in = im_create_dmask( "in", 4, 4 )) ) {
im_errormsg( "im__coeff: unable to allocate matrix" );
if( !(in = im_create_dmask( "in", 4, 4 )) )
return( -1 );
}
in->coeff[0] = (double)xs1;
in->coeff[1] = (double)-ys1;
@ -77,7 +75,6 @@ im__coeff( int xr1, int yr1, int xs1, int ys1,
if( !(out = im_matinv( in, "out" )) ) {
im_free_dmask( in );
im_errormsg( "im__coeff: unable to invert matrix" );
return( -1 );
}
@ -119,7 +116,8 @@ im_match_linear( IMAGE *ref, IMAGE *sec, IMAGE *out,
/* Transform image!
*/
if( im_similarity_area( sec, out, a, b, dx, dy, x, y, w, h ) )
if( im_affinei( sec, out, vips_interpolate_bilinear_static(),
a, -b, b, a, dx, dy, x, y, w, h ) )
return( -1 );
return( 0 );

View File

@ -95,28 +95,29 @@ int dx, dy; /* displacements */
int norm;
if (im_iocheck(im, m) == -1)
{ im_errormsg("im_cooc_sym: im_iocheck failed"); return(-1);}
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR))
{
im_errormsg("im_cooc_sym: Unable to accept input");
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
im_error( "im_cooc_sym", "%s", _( "Unable to accept input") );
return(-1);
}
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) )
{ im_errormsg("im_cooc_sym: wrong args"); return(-1); }
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) ) {
im_error( "im_cooc_sym", "%s", _( "wrong args") );
return(-1); }
if (im_cp_desc(m, im) == -1)
{ im_errormsg("im_cooc_sym: im_cp_desc failed"); return(-1);}
return( -1 );
m->Xsize = 256;
m->Ysize = 256;
m->Bbits = IM_BBITS_DOUBLE;
m->BandFmt = IM_BANDFMT_DOUBLE;
m->Type = IM_TYPE_B_W;
if (im_setupout(m) == -1)
{im_errormsg("im_cooc_sym: im_setupout failed"); return(-1);}
return( -1 );
/* malloc space to keep the read values */
buf = (int *)calloc( (unsigned)m->Xsize*m->Ysize, sizeof(int) );
line = (double *)calloc( (unsigned)m->Xsize * m->Bands, sizeof(double));
if ( (buf == NULL) || (line == NULL) )
{ im_errormsg("im_cooc_sym: calloc failed"); return(-1); }
if ( (buf == NULL) || (line == NULL) ) {
im_error( "im_cooc_sym", "%s", _( "calloc failed") );
return(-1); }
input = (PEL*)im->data;
input += ( ypos * im->Xsize + xpos );
offset = dy * im->Xsize + dx;
@ -147,7 +148,7 @@ int dx, dy; /* displacements */
*cpline++ = (double)(*cpnt++)/(double)norm;
if (im_writeline( y, m, (PEL *) line ) == -1)
{
im_errormsg("im_cooc_sym: unable to im_writeline");
im_error( "im_cooc_sym", "%s", _( "unable to im_writeline") );
return(-1);
}
}
@ -172,27 +173,29 @@ int dx, dy; /* displacements */
int norm;
if (im_iocheck(im, m) == -1)
{ im_errormsg("im_cooc_ord: im_iocheck failed"); return(-1);}
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR))
{
im_errormsg("im_cooc_ord: Unable to accept input");
im_error( "im_cooc_ord", "%s", _( "Unable to accept input") );
return(-1);
}
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) )
{ im_errormsg("im_cooc_ord: wrong args"); return(-1); }
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) ) {
im_error( "im_cooc_ord", "%s", _( "wrong args") );
return(-1); }
if (im_cp_desc(m, im) == -1)
{ im_errormsg("im_cooc_ord: im_cp_desc failed"); return(-1);}
return( -1 );
m->Xsize = 256;
m->Ysize = 256;
m->Bbits = IM_BBITS_DOUBLE;
m->BandFmt = IM_BANDFMT_DOUBLE;
if (im_setupout(m) == -1)
{im_errormsg("im_cooc_ord: im_setupout failed"); return(-1);}
return( -1 );
/* malloc space to keep the read values */
buf = (int *)calloc( (unsigned)m->Xsize*m->Ysize, sizeof(int) );
line = (double *)calloc( (unsigned)m->Xsize * m->Bands, sizeof(double));
if ( (buf == NULL) || (line == NULL) )
{ im_errormsg("im_cooc_ord: calloc failed"); return(-1); }
if ( (buf == NULL) || (line == NULL) ) {
im_error( "im_cooc_ord", "%s", _( "calloc failed") );
return(-1); }
input = (PEL*)im->data;
input += ( ypos * im->Xsize + xpos );
offset = dy * im->Xsize + dx;
@ -221,7 +224,7 @@ int dx, dy; /* displacements */
*cpline++ = (double)(*cpnt++)/(double)norm;
if (im_writeline( y, m, (PEL *) line ) == -1)
{
im_errormsg("im_cooc_ord: unable to im_writeline");
im_error( "im_cooc_ord", "%s", _( "unable to im_writeline") );
return(-1);
}
}
@ -240,8 +243,9 @@ im_cooc_matrix( IMAGE *im, IMAGE *m,
return( im_cooc_ord(im, m, xp, yp, xs, ys, dx, dy) );
else if (flag == 1) /* symmetrical cooc */
return( im_cooc_sym(im, m, xp, yp, xs, ys, dx, dy) );
else
{ im_errormsg("im_cooc_matrix: wrong flag!"); return(-1); }
else {
im_error( "im_cooc_matrix", "%s", _( "wrong flag!") );
return(-1); }
}
/* Calculate contrast, asmoment, entropy and correlation
@ -258,7 +262,7 @@ im_cooc_asm( IMAGE *m, double *asmoment )
if (m->Xsize != 256 || m->Ysize != 256 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{
im_errormsg("im_cooc_asm: unable to accept input");
im_error( "im_cooc_asm", "%s", _( "unable to accept input") );
return(-1);
}
tmpasm = 0.0;
@ -284,7 +288,7 @@ im_cooc_contrast( IMAGE *m, double *contrast )
if (m->Xsize != 256 || m->Ysize != 256 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{
im_errormsg("im_cooc_contrast: unable to accept input");
im_error( "im_cooc_contrast", "%s", _( "unable to accept input") );
return(-1);
}
tmpcon = 0.0;
@ -357,14 +361,14 @@ im_cooc_correlation( IMAGE *m, double *correlation )
if (m->Xsize != 256 || m->Ysize != 256 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{
im_errormsg("im_cooc_correlation: unable to accept input");
im_error( "im_cooc_correlation", "%s", _( "unable to accept input") );
return(-1);
}
row = (double*)calloc( (unsigned)m->Ysize, sizeof(double));
col = (double*)calloc( (unsigned)m->Xsize, sizeof(double));
if ( row == NULL || col == NULL )
{
im_errormsg("im_cooc_correlation: unable to calloc");
im_error( "im_cooc_correlation", "%s", _( "unable to calloc") );
return(-1);
}
pbuf = (double*)m->data;
@ -417,7 +421,7 @@ mrow, stdrow, mcol, stdcol);
#endif
if ( (stdcol==0.0)||(stdrow==0) )
{
im_errormsg("im_cooc_correlation: zero std");
im_error( "im_cooc_correlation", "%s", _( "zero std") );
return(-1);
}
tmpcor = (tmpcor-(mcol*mrow))/(stdcol*stdrow);
@ -441,7 +445,7 @@ im_cooc_entropy( IMAGE *m, double *entropy )
if (m->Xsize != 256 || m->Ysize != 256 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{
im_errormsg("im_cooc_entropy: unable to accept input");
im_error( "im_cooc_entropy", "%s", _( "unable to accept input") );
return(-1);
}
pbufstart = (double*)m->data;

View File

@ -91,27 +91,30 @@ im_glds_matrix( IMAGE *im, IMAGE *m,
int norm;
if (im_iocheck(im, m) == -1)
{ im_errormsg("im_glds_matrix: im_iocheck failed"); return(-1);}
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR))
{ im_errormsg("im_glds_matrix: Wrong input"); return(-1); }
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
im_error( "im_glds_matrix", "%s", _( "Wrong input") );
return(-1); }
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) )
{ im_errormsg("im_glds_matrix: wrong args"); return(-1); }
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) ) {
im_error( "im_glds_matrix", "%s", _( "wrong args") );
return(-1); }
if (im_cp_desc(m, im) == -1)
{ im_errormsg("im_glds_matrix: im_cp_desc failed"); return(-1);}
return( -1 );
m->Xsize = 256; m->Ysize = 1;
m->Bbits = IM_BBITS_DOUBLE; m->BandFmt = IM_BANDFMT_DOUBLE;
m->Type = IM_TYPE_B_W;
if (im_setupout(m) == -1)
{ im_errormsg("im_glds_matrix: im_setupout failed");return(-1);}
return( -1 );
b = (int *)calloc( (unsigned)m->Xsize, sizeof(int) );
l = (double *)calloc( (unsigned)m->Xsize, sizeof(double));
if ( (b == NULL) || (l == NULL) )
{ im_errormsg("im_glds_matrix: calloc failed"); return(-1); }
if ( (b == NULL) || (l == NULL) ) {
im_error( "im_glds_matrix", "%s", _( "calloc failed") );
return(-1); }
in = (PEL*)im->data;
in += ( ypos * im->Xsize + xpos );
@ -135,7 +138,7 @@ im_glds_matrix( IMAGE *im, IMAGE *m,
for (x=0; x<m->Xsize; x++)
*pl++ = ((double)(*pb++))/(double)norm;
if (im_writeline( 0, m, (PEL *) l ) == -1)
{im_errormsg("im_glds_matrix: im_writeline failed");return(-1);}
return( -1 );
free((char*)b); free((char*)l);
return(0);
@ -153,8 +156,9 @@ im_glds_asm( IMAGE *m, double *asmoment )
return( -1 );
if (m->Xsize != 256 || m->Ysize != 1 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{im_errormsg("im_glds_asm: unable to accept input");return(-1);}
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE) {
im_error( "im_glds_asm", "%s", _( "unable to accept input") );
return(-1);}
tmpasm = 0.0;
in = (double*)m->data;
for(i=0; i<m->Xsize; i++)
@ -178,8 +182,9 @@ im_glds_contrast( IMAGE *m, double *contrast )
return( -1 );
if (m->Xsize != 256 || m->Ysize != 1 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{ im_errormsg("im_glds_contrast: wrong input"); return(-1); }
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE) {
im_error( "im_glds_contrast", "%s", _( "wrong input") );
return(-1); }
tmpcon = 0.0;
in = (double*)m->data;
for(i=0; i<m->Xsize; i++)
@ -204,8 +209,9 @@ im_glds_entropy( IMAGE *m, double *entropy )
return( -1 );
if (m->Xsize != 256 || m->Ysize != 1 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{ im_errormsg("im_glds_entropy: wrong input"); return(-1); }
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE) {
im_error( "im_glds_entropy", "%s", _( "wrong input") );
return(-1); }
tmpent = 0.0;
in = (double*)m->data;
for(i=0; i<m->Xsize; i++)
@ -233,8 +239,9 @@ im_glds_mean( IMAGE *m, double *mean )
return( -1 );
if (m->Xsize != 256 || m->Ysize != 1 ||
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE)
{ im_errormsg("im_glds_mean: wrong input"); return(-1); }
m->Bands != 1 || m->BandFmt != IM_BANDFMT_DOUBLE) {
im_error( "im_glds_mean", "%s", _( "wrong input") );
return(-1); }
tmpmean = 0.0;
in = (double*)m->data;
for(i=0; i<m->Xsize; i++)

View File

@ -208,9 +208,10 @@ benchmark( IMAGE *in, IMAGE *out )
/* Shrink by 10%, bilinear interp.
*/
im_affine( t[1], t[2],
0.9, 0, 0, 0.9, 0, 0,
0, 0, t[1]->Xsize * 0.9, t[1]->Ysize * 0.9 ) ||
im_affinei_all( t[1], t[2],
vips_interpolate_bilinear_static(),
0.9, 0, 0, 0.9,
0, 0 ) ||
/* Find L ~= 100 areas (white surround).
*/
@ -264,11 +265,11 @@ im_benchmarkn( IMAGE *in, IMAGE *out, int n )
* so if we chain many of them together the image gets
* too small.
*/
im_affine( t[0], t[1],
im_affinei_all( t[0], t[1],
vips_interpolate_bilinear_static(),
(double) in->Xsize / t[0]->Xsize, 0, 0,
(double) in->Ysize / t[0]->Ysize,
0, 0,
0, 0, in->Xsize, in->Ysize ) ||
0, 0 ) ||
im_benchmarkn( t[1], out, n - 1 ) );
}

View File

@ -66,15 +66,18 @@ double *pmean, *pstd;
if( im_incheck( im ) )
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR))
{im_errormsg("im_dif_std: Unable to accept input"); return(-1);}
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) )
{ im_errormsg("im_dif_std: wrong args"); return(-1); }
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
im_error( "im_dif_std", "%s", _( "Unable to accept input") );
return(-1);}
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) ) {
im_error( "im_dif_std", "%s", _( "wrong args") );
return(-1); }
bufsize = xsize * ysize;
buf = (int *)calloc( (unsigned)bufsize, sizeof(int) );
if ( buf == NULL )
{ im_errormsg("im_dif_std: calloc failed"); return(-1); }
if ( buf == NULL ) {
im_error( "im_dif_std", "%s", _( "calloc failed") );
return(-1); }
input = (PEL*)im->data;
input += ( ypos * im->Xsize + xpos );
ofst = dy * im->Xsize + dx;

View File

@ -75,7 +75,7 @@ im_feye( IMAGE *image, const int xsize, const int ysize, const double factor )
if( im_outcheck( image ) )
return( -1 );
if( factor > 1.0 || factor <= 0.0 ) {
im_errormsg( "im_feye: factor should be in [1,0)" );
im_error( "im_feye", "%s", _( "factor should be in [1,0)" ) );
return( -1 );
}

View File

@ -100,7 +100,7 @@ im_fgrey( IMAGE *out, const int xsize, const int ysize )
/* Check args.
*/
if( xsize <=0 || ysize <= 0 ) {
im_errormsg( "im_fgrey: bad size" );
im_error( "im_fgrey", "%s", _( "bad size" ) );
return( -1 );
}
if( im_poutcheck( out ) )

View File

@ -91,7 +91,7 @@ im_make_xy( IMAGE *out, const int xsize, const int ysize )
/* Check args.
*/
if( xsize <=0 || ysize <= 0 ) {
im_errormsg( "im_make_xy: bad size" );
im_error( "im_make_xy", "%s", _( "bad size" ) );
return( -1 );
}
if( im_poutcheck( out ) )

Some files were not shown because too many files have changed in this diff Show More