=cut
*/
+#define IMAGER_NO_CONTEXT
+
#include "imager.h"
#include "imageri.h"
=cut
*/
-i_img *i_img_masked_new(i_img *targ, i_img *mask, i_img_dim x, i_img_dim y, i_img_dim w, i_img_dim h) {
+i_img *
+i_img_masked_new(i_img *targ, i_img *mask, i_img_dim x, i_img_dim y, i_img_dim w, i_img_dim h) {
i_img *im;
i_img_mask_ext *ext;
+ dIMCTXim(targ);
- i_clear_error();
+ im_clear_error(aIMCTX);
if (x >= targ->xsize || y >= targ->ysize) {
- i_push_error(0, "subset outside of target image");
+ im_push_error(aIMCTX, 0, "subset outside of target image");
return NULL;
}
if (mask) {
if (y+h > targ->ysize)
h = targ->ysize - y;
- im = mymalloc(sizeof(i_img));
+ im = im_img_alloc(aIMCTX);
+
memcpy(im, &IIM_base_masked, sizeof(i_img));
+ i_tags_new(&im->tags);
im->xsize = w;
im->ysize = h;
im->channels = targ->channels;
ext->samps = mymalloc(sizeof(i_sample_t) * im->xsize);
im->ext_data = ext;
+ im_img_init(aIMCTX, im);
+
return im;
}
return result;
}
else {
+ dIMCTXim(im);
i_push_error(0, "Image position outside of image");
return -1;
}
return result;
}
else {
+ dIMCTXim(im);
i_push_error(0, "Image position outside of image");
return -1;
}