VipsImage * vips__matrix_read_file( FILE *fp ) { char whitemap[256]; int i; char *p; int width; int height; double scale; double offset; VipsImage *out; for( i = 0; i < 256; i++ ) whitemap[i] = 0; for( p = WHITESPACE; *p; p++ ) whitemap[(int) *p] = 1; if( vips__matrix_header( whitemap, fp, &width, &height, &scale, &offset ) ) return( NULL ); if( !(out = vips_image_new_matrix( width, height )) ) return( NULL ); vips_image_set_double( out, "scale", scale ); vips_image_set_double( out, "offset", offset ); if( vips__matrix_body( whitemap, out, fp ) ) { g_object_unref( out ); return( NULL ); } return( out ); }
VImage VImage::new_matrix( int width, int height ) { return( VImage( vips_image_new_matrix( width, height ) ) ); }