/* Call im_copy_morph via arg vector. */ static int copy_morph_vec( im_object *argv ) { int Bands = *((int *) argv[2]); int BandFmt = *((int *) argv[3]); int Coding = *((int *) argv[4]); return( im_copy_morph( argv[0], argv[1], Bands, BandFmt, Coding ) ); }
/* Read a ppm/pgm file using mmap(). */ static int read_mmap( FILE *fp, const char *filename, int msb_first, IMAGE *out ) { const int header_offset = ftell( fp ); IMAGE *t[2]; if( im_open_local_array( out, t, 2, "im_ppm2vips", "p" ) || im_raw2vips( filename, t[0], out->Xsize, out->Ysize, IM_IMAGE_SIZEOF_PEL( out ), header_offset ) || im_copy_morph( t[0], t[1], out->Bands, out->BandFmt, out->Coding ) || im_copy_native( t[1], out, msb_first ) ) return( -1 ); return( 0 ); }