/* MX LIBRARY FUNCTION: mxip_image_s_copy_f2 * * PURPOSE: Make a copy of a mxip_image_s structure. * * USAGE EXAMPLE: * * struct mxip_image_s *old=NULL; * struct mxip_image_s *new=NULL; * int status; * * ! N.B. old must be open and *old!=NULL * * status = mxip_image_s_copy_f2 (old, &new); * * AUTHOR: K. J. Mighell (mighell@noao.edu) * * LANGUAGE: ANSI C * * DOCUMENTATION: http://www.noao.edu/staff/mighell/mx * * DATE: 20000313 * * MOD: 3 * * Copyleft (L) 2000 Kenneth John Mighell */ #include "mx.h" int mxip_image_s_copy_f2( struct mxip_image_s *in, struct mxip_image_s **out ) { char mxfunc[] = "mxip_image_s_copy_f2"; int status; struct mxip_image_s *image=NULL; int j0; status = 0; /* * Open the new mxip_image_s structure */ status = mxip_image_s_open_f7( &image, in->nxi, in->nyi, in->llx0i, in->lly0i, in->mpxi, in->comment ); if (status) { status = 1; goto error; } /* * The image->vectord was initialized to zero. * Now copy the pixel data. */ for (j0=0; j0<(in->npxi); ++j0) { image->vectord[j0] = in->vectord[j0]; } ok: status = 0; goto bye; error: mxp_errmsg_append_f3 (mxfunc, status, ""); goto bye; bye: *out = &*image; return (status); } /* end-of-file */