setalpha_rgb_grey8 Tcl_Obj* imageObj Tcl_Obj* imageAlphaObj /* * Extend the input with an alpha channel holding the data of the second * image. */ crimp_image* result; crimp_image* image; crimp_image* imageA; int x, y; crimp_input (imageObj, image, rgb); crimp_input (imageAlphaObj, imageA, grey8); if (!crimp_eq_dim (image, imageA)) { Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC); return TCL_ERROR; } result = crimp_new_rgba (image->w, image->h); for (y = 0; y < result->h; y++) { for (x = 0; x < result->w; x++) { R (result, x, y) = R (image, x, y); G (result, x, y) = G (image, x, y); B (result, x, y) = B (image, x, y); A (result, x, y) = GREY8 (imageA, 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: */