diff --git a/Lib/combine3.c b/Lib/combine3.c index bfb77de..da480cd 100644 --- a/Lib/combine3.c +++ b/Lib/combine3.c @@ -13,42 +13,35 @@ /* * un kludge en chantier. programmation à la 'Gruiik' en vue. */ -int -Image_combine_waou(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst, +int Image_combine_waou(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst, int a, int b, int c, int d) { int x, y, foo; #if DEBUG_LEVEL -fprintf(stderr, "%s ( %p %p %p %d : %d %d (%d) )\n", +fprintf(stderr, ">>> %s ( %p %p %p %d : %d %d (%d) )\n", __func__, s1, s2, dst, a, b, c, d); #endif -if ( (foo=Image_compare_desc(s1, s2)) ) - { +if ( (foo=Image_compare_desc(s1, s2)) ) { fprintf(stderr, "%s : sources are differents %d\n", __func__, foo); return foo; } -if ( (foo=Image_compare_desc(s1, dst)) ) - { +if ( (foo=Image_compare_desc(s1, dst)) ) { fprintf(stderr, "%s : destination bad dims %d\n", __func__, foo); return foo; } -for (y=0; yheight; y++) - { - for (x=0; xwidth; x++) - { - if (d) - { +for (y=0; yheight; y++) { + for (x=0; xwidth; x++) { + if (d) { /* canonical function */ (dst->Rpix[y])[x] = (x & (s1->Rpix[y])[x]) | a; (dst->Gpix[y])[x] = x | b; (dst->Bpix[y])[x] = (y & (s2->Rpix[y])[x]) | c; } - else - { + else { /* new 9 mars 2010 - ave St Ex */ (dst->Rpix[y])[x] = (x & (s1->Rpix[y])[x]) ^ a; (dst->Gpix[y])[x] = x ^ b; @@ -62,9 +55,8 @@ return FUNC_IS_BETA; /*::------------------------------------------------------------------::*/ /* * un kludge en chantier. programmation à la 'Gruiik' en vue. - */ -int -Image_combine_wauo(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst, + */ +int Image_combine_wauo(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst, int flag) { int x, y, foo; @@ -72,31 +64,25 @@ int x, y, foo; if ( flag ) fprintf(stderr, "Combine Wauo: flag = %d ?\n", flag); -if ( (foo=Image_compare_desc(s1, s2)) ) - { +if ( (foo=Image_compare_desc(s1, s2)) ) { fprintf(stderr, "Combine Wauo: sources are differents %d\n", foo); return foo; } -if ( (foo=Image_compare_desc(s1, dst)) ) - { +if ( (foo=Image_compare_desc(s1, dst)) { fprintf(stderr, "Combine Wauo: destination bad dims %d\n", foo); return foo; } -for (y=1; yheight-1; y++) - { - for (x=1; xwidth-1; x++) - { +for (y=1; yheight-1; y++) { + for (x=1; xwidth-1; x++) { (dst->Rpix[y])[x] = (s1->Rpix[y][x] + s2->Rpix[y][x])/2; - if (s1->Rpix[y][x] > s2->Rpix[y][x]) - { + if (s1->Rpix[y][x] > s2->Rpix[y][x]) { (dst->Gpix[y])[x] = (s1->Gpix[y])[x]; (dst->Bpix[y])[x] = (s2->Bpix[y])[x]; } - else - { + else { (dst->Gpix[y])[x] = (s2->Gpix[y])[x]; (dst->Bpix[y])[x] = (s1->Bpix[y])[x]; } @@ -109,31 +95,26 @@ return OLL_KORRECT; /* * threshold values (sr, sg, sb) are in the pix range [0..255] */ -int -Image_combine_seuils(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst, +int Image_combine_seuils(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst, int sr, int sb, int sg) { int x, y, foo; int r, g, b; -if ( (foo=Image_compare_desc(s1, s2)) ) - { +if ( (foo=Image_compare_desc(s1, s2)) ) { fprintf(stderr, "Combine Seuils: sources are differents %d\n", foo); return foo; } -if ( (foo=Image_compare_desc(s1, dst)) ) - { +if ( (foo=Image_compare_desc(s1, dst)) ) { fprintf(stderr, "Combine Seuils: destination bad dims %d\n", foo); return foo; } sr*=2; sg*=2; sb*=2; -for (y=0; yheight; y++) - { - for (x=0; xwidth; x++) - { +for (y=0; yheight; y++) { + for (x=0; xwidth; x++) { if ( (s1->Rpix[y][x] + s2->Rpix[y][x]) > sr ) r = s1->Rpix[y][x]; else