setalpha_rgba_rgba Tcl_Obj* imageObj Tcl_Obj* imageAlphaObj /* * Replace the input's alpha channel with the alpha channel of the second * image. IOW, copy the second image's alpha channel over into the first. */ crimp_image* result; crimp_image* image; crimp_image* imageA; int x, y; crimp_input (imageObj, image, rgba); crimp_input (imageAlphaObj, imageA, rgba); if (!crimp_eq_dim (image, imageA)) { Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC); return TCL_ERROR; } result = crimp_new_like (image); 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) = A (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: */