montageh_rgb Tcl_Obj* imageLeftObj Tcl_Obj* imageRightObj /* * Place the two images adjacent to each other in the result, from left to * right. The images have to have the same height. */ crimp_image* result; crimp_image* imageLeft; crimp_image* imageRight; int x, y; crimp_input (imageLeftObj, imageLeft, rgb); crimp_input (imageRightObj, imageRight, rgb); if (!crimp_eq_height (imageLeft, imageRight)) { Tcl_SetResult(interp, "image heights do not match", TCL_STATIC); return TCL_ERROR; } result = crimp_new_rgb (imageLeft->w + imageRight->w, imageLeft->h); for (y = 0; y < result->h; y++) { for (x = 0; x < imageLeft->w; x++) { R (result, x, y) = R (imageLeft, x, y); G (result, x, y) = G (imageLeft, x, y); B (result, x, y) = B (imageLeft, x, y); } } for (y = 0; y < result->h; y++) { for (x = 0; x < imageRight->w; x++) { R (result, imageLeft->w + x, y) = R (imageRight, x, y); G (result, imageLeft->w + x, y) = G (imageRight, x, y); B (result, imageLeft->w + x, y) = B (imageRight, x, y); } } Tcl_SetObjResult(interp, crimp_new_image_obj (result)); return TCL_OK; /* vim: set sts=4 sw=4 tw=80 et ft=c: */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */