Artifact 676de4ef0a73ca624f3f9cdab0103339db0cff16:
- File
cop/binop_rgb_grey8.c
— part of check-in
[2c2c0c2211]
at
2010-07-16 03:49:37
on branch ak-experimental
— Moved the support code for the binary operators to their own directory.
Added template code for all the missing directions between rgb, rgba, and grey8.
Added the missing operator implementations. For the commutative operators we are leaving out half of the missing, and handle them through commutation in the Tcl level. (user: andreask size: 821) [more...]
crimp_image* result; crimp_image* imageA; crimp_image* imageB; int x, y; crimp_input (imageAObj, imageA, rgb); crimp_input (imageBObj, imageB, grey8); if (!crimp_eq_dim (imageA, imageB)) { Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC); return TCL_ERROR; } result = crimp_new_like (imageA); for (y = 0; y < result->h; y++) { for (x = 0; x < result->w; x++) { R (result, x, y) = BINOP (R (imageA, x, y), GREY8 (imageB, x, y)); G (result, x, y) = BINOP (G (imageA, x, y), GREY8 (imageB, x, y)); B (result, x, y) = BINOP (B (imageA, x, y), GREY8 (imageB, 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: */