int imProcessResize(const imImage* src_image, imImage* dst_image, int order) { int ret = 0; int counter = imProcessCounterBegin("Resize"); const char* int_msg = (order == 3)? "Bicubic Interpolation": (order == 1)? "Bilinear Interpolation": "Zero Order Interpolation"; int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth; imCounterTotal(counter, src_depth*dst_image->height, int_msg); for (int i = 0; i < src_depth; i++) { switch(src_image->data_type) { case IM_BYTE: ret = iResize(src_image->width, src_image->height, (const imbyte*)src_image->data[i], dst_image->width, dst_image->height, (imbyte*)dst_image->data[i], float(0), order, counter); break; case IM_SHORT: ret = iResize(src_image->width, src_image->height, (const short*)src_image->data[i], dst_image->width, dst_image->height, (short*)dst_image->data[i], float(0), order, counter); break; case IM_USHORT: ret = iResize(src_image->width, src_image->height, (const imushort*)src_image->data[i], dst_image->width, dst_image->height, (imushort*)dst_image->data[i], float(0), order, counter); break; case IM_INT: ret = iResize(src_image->width, src_image->height, (const int*)src_image->data[i], dst_image->width, dst_image->height, (int*)dst_image->data[i], float(0), order, counter); break; case IM_FLOAT: ret = iResize(src_image->width, src_image->height, (const float*)src_image->data[i], dst_image->width, dst_image->height, (float*)dst_image->data[i], float(0), order, counter); break; case IM_CFLOAT: ret = iResize(src_image->width, src_image->height, (const imcfloat*)src_image->data[i], dst_image->width, dst_image->height, (imcfloat*)dst_image->data[i], imcfloat(0,0), order, counter); break; } } imProcessCounterEnd(counter); return ret; }
int imProcessRotateRef(const imImage* src_image, imImage* dst_image, double cos0, double sin0, int x, int y, int to_origin, int order) { int ret = 0; int counter = imCounterBegin("RotateRef"); int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth; imCounterTotal(counter, src_depth*dst_image->height, "Processing..."); /* size of the destiny image */ if (src_image->color_space == IM_MAP) { ret = Rotate(src_image->width, src_image->height, (imbyte*)src_image->data[0], dst_image->width, dst_image->height, (imbyte*)dst_image->data[0], cos0, sin0, x, y, to_origin, counter, float(0), 0); } else { for (int i = 0; i < src_depth; i++) { switch(src_image->data_type) { case IM_BYTE: ret = Rotate(src_image->width, src_image->height, (imbyte*)src_image->data[i], dst_image->width, dst_image->height, (imbyte*)dst_image->data[i], cos0, sin0, x, y, to_origin, counter, float(0), order); break; case IM_USHORT: ret = Rotate(src_image->width, src_image->height, (imushort*)src_image->data[i], dst_image->width, dst_image->height, (imushort*)dst_image->data[i], cos0, sin0, x, y, to_origin, counter, float(0), order); break; case IM_INT: ret = Rotate(src_image->width, src_image->height, (int*)src_image->data[i], dst_image->width, dst_image->height, (int*)dst_image->data[i], cos0, sin0, x, y, to_origin, counter, float(0), order); break; case IM_FLOAT: ret = Rotate(src_image->width, src_image->height, (float*)src_image->data[i], dst_image->width, dst_image->height, (float*)dst_image->data[i], cos0, sin0, x, y, to_origin, counter, float(0), order); break; case IM_CFLOAT: ret = Rotate(src_image->width, src_image->height, (imcfloat*)src_image->data[i], dst_image->width, dst_image->height, (imcfloat*)dst_image->data[i], cos0, sin0, x, y, to_origin, counter, imcfloat(0,0), order); break; } if (!ret) break; } } imCounterEnd(counter); return ret; }
int imProcessSwirl(const imImage* src_image, imImage* dst_image, float k, int order) { int ret = 0; int counter = imCounterBegin("Swirl Distort"); int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth; imCounterTotal(counter, src_depth*dst_image->height, "Processing..."); /* size of the destiny image */ for (int i = 0; i < src_depth; i++) { switch(src_image->data_type) { case IM_BYTE: ret = Swirl(src_image->width, src_image->height, (imbyte*)src_image->data[i], (imbyte*)dst_image->data[i], k, counter, float(0), order); break; case IM_USHORT: ret = Swirl(src_image->width, src_image->height, (imushort*)src_image->data[i], (imushort*)dst_image->data[i], k, counter, float(0), order); break; case IM_INT: ret = Swirl(src_image->width, src_image->height, (int*)src_image->data[i], (int*)dst_image->data[i], k, counter, float(0), order); break; case IM_FLOAT: ret = Swirl(src_image->width, src_image->height, (float*)src_image->data[i], (float*)dst_image->data[i], k, counter, float(0), order); break; case IM_CFLOAT: ret = Swirl(src_image->width, src_image->height, (imcfloat*)src_image->data[i], (imcfloat*)dst_image->data[i], k, counter, imcfloat(0,0), order); break; } if (!ret) break; } imCounterEnd(counter); return ret; }