~ubuntu-branches/ubuntu/trusty/vips/trusty

« back to all changes in this revision

Viewing changes to libvips/iofuncs/error.c

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2014-03-29 12:29:29 UTC
  • mfrom: (1.1.21) (30.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20140329122929-fvxnaann32ex0gzk
Tags: 7.38.5-2
Enable dh-autoreconf. (Closes: #742872)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1013
1013
}
1014
1014
 
1015
1015
/**
 
1016
 * vips_check_oddsquare:
 
1017
 * @domain: the originating domain for the error message
 
1018
 * @im: image to check
 
1019
 *
 
1020
 * Check that the image is square and that the sides are odd. 
 
1021
 * If not, set an error message
 
1022
 * and return non-zero.
 
1023
 *
 
1024
 * See also: vips_error().
 
1025
 *
 
1026
 * Returns: 0 if OK, -1 otherwise.
 
1027
 */
 
1028
int
 
1029
vips_check_oddsquare( const char *domain, VipsImage *im )
 
1030
{
 
1031
        if( im->Xsize != im->Ysize || 
 
1032
                im->Xsize % 2 == 0 ) { 
 
1033
                vips_error( domain, 
 
1034
                        "%s", _( "images must be odd and square" ) );
 
1035
                return( -1 );
 
1036
        }
 
1037
 
 
1038
        return( 0 );
 
1039
}
 
1040
 
 
1041
/**
1016
1042
 * vips_check_bands_same:
1017
1043
 * @domain: the originating domain for the error message
1018
1044
 * @im1: first image to check
1241
1267
}
1242
1268
 
1243
1269
/**
 
1270
 * vips_check_separable:
 
1271
 * @domain: the originating domain for the error message
 
1272
 * @im: image to check 
 
1273
 *
 
1274
 * Separable matrix images must have width or height 1.
 
1275
 * Return 0 if the image will pass, or -1 and
 
1276
 * set an error message otherwise.
 
1277
 *
 
1278
 * See also: vips_error().
 
1279
 *
 
1280
 * Returns: 0 if OK, -1 otherwise.
 
1281
 */
 
1282
int
 
1283
vips_check_separable( const char *domain, VipsImage *im )
 
1284
{
 
1285
        if( im->Xsize != 1 && 
 
1286
                im->Ysize != 1 ) {
 
1287
                vips_error( domain, 
 
1288
                        "%s", _( "separable matrix images must have "
 
1289
                        "width or height 1" ) );
 
1290
                return( -1 );
 
1291
        }
 
1292
 
 
1293
        return( 0 );
 
1294
}
 
1295
 
 
1296
/**
1244
1297
 * vips_check_imask: (skip)
1245
1298
 * @domain: the originating domain for the error message
1246
1299
 * @mask: mask to check