threshold_rgb_rgb
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj
crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int x, y;
crimp_input (imageObj, image, rgb);
crimp_input (thresholdObj, threshold, rgb);
result = crimp_new_like (image);
for (y = 0; y < image->h; y++) {
for (x = 0; x < image->w; x++) {
R (result, x, y) = R (image, x, y) >= R (threshold, x, y) ? BLACK : WHITE;
G (result, x, y) = G (image, x, y) >= G (threshold, x, y) ? BLACK : WHITE;
B (result, x, y) = B (image, x, y) >= B (threshold, x, y) ? BLACK : WHITE;
}
}
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:
*/