CRIMP
Artifact [1a6359d24c]
Not logged in

Artifact 1a6359d24c8e82e4ad79917bc5b6847e1161d2a5:


montageh_grey16
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,  grey16);
crimp_input (imageRightObj, imageRight, grey16);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey16_at (crimp_x (imageLeft), crimp_y (imageLeft),
			     crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	GREY16 (result, x, y) = GREY16 (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	GREY16 (result, crimp_w (imageLeft) + x, y) = GREY16 (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:
 */