diff --git a/Lib/equalhist.c b/Lib/equalhist.c new file mode 100644 index 0000000..6bdf34f --- /dev/null +++ b/Lib/equalhist.c @@ -0,0 +1,15 @@ +/* + * Egalisation par cumul d'histogramme + * =================================== + * + * new: Sat Aug 10 14:38:01 UTC 2024, aux Bourtoulots + */ + + +#include +#include +#include "../tthimage.h" + + +/*::------------------------------------------------------------------::*/ + diff --git a/Lib/pov_hf15e.c b/Lib/pov_hf15e.c index b0f0a82..d416935 100644 --- a/Lib/pov_hf15e.c +++ b/Lib/pov_hf15e.c @@ -2,7 +2,7 @@ pov_hf15e.c =========== - opérations de morphologie mathématique appliquées + operations de morphologie mathematique appliquees aux height-fields. */ @@ -18,40 +18,30 @@ static struct int x, y; } off[] = { - { -1, -1 }, - { 0, -1 }, - { 1, -1 }, - { -1, 0 }, - { 0, 0 }, - { 1, 0 }, - { -1, 1 }, - { 0, 1 }, - { 1, 1 } + { -1, -1 }, { 0, -1 }, { 1, -1 }, + { -1, 0 }, { 0, 0 }, { 1, 0 }, + { -1, 1 }, { 0, 1 }, { 1, 1 } }; /*::------------------------------------------------------------------::*/ /* - * le paramètre 'coef' n'est pas utilisé. D'ailleurs, je ne vois + * le parametre 'coef' n'est pas utilise. D'ailleurs, je ne vois * pas trop quoi y mettre ? */ -int -Image_hf15_dilate(Image_Desc *src, Image_Desc *dst, int coef) +int Image_hf15_dilate(Image_Desc *src, Image_Desc *dst, int coef) { +(void)coef; /* KILL WARNING */ int foo; int x, y, h, hmax; -if ( (foo=Image_compare_desc(src, dst)) ) - { +if ( (foo=Image_compare_desc(src, dst)) ) { fprintf(stderr, "Image hf15 dilate: images differents %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++) { hmax = -1664; - for (foo=0; foo<9; foo++) - { + for (foo=0; foo<9; foo++) { h = Image_hf15_height(src, x+off[foo].x, y+off[foo].y); if (h > hmax) hmax = h; } @@ -63,27 +53,23 @@ return FUNC_IS_BETA; } /*::------------------------------------------------------------------::*/ /* - * le paramètre 'coef' n'est pas utilisé. + * le parametre 'coef' n'est pas utilise. */ -int -Image_hf15_erode(Image_Desc *src, Image_Desc *dst, int coef) +int Image_hf15_erode(Image_Desc *src, Image_Desc *dst, int coef) { +(void)coef; /* KILL WARNING */ int foo; int x, y, h, hmin; -if ( (foo=Image_compare_desc(src, dst)) ) - { +if ( (foo=Image_compare_desc(src, dst)) ) { fprintf(stderr, "Image hf15 erode: images differents %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++) { hmin = 42042; - for (foo=0; foo<9; foo++) - { + for (foo=0; foo<9; foo++) { h = Image_hf15_height(src, x+off[foo].x, y+off[foo].y); if (h < hmin) hmin = h; } @@ -95,7 +81,7 @@ return FUNC_IS_BETA; } /*::------------------------------------------------------------------::*/ /* - * Et maintenant, il reste à coder le chapeau haut-de-forme + * Et maintenant, il reste a coder le chapeau haut-de-forme */ /*::------------------------------------------------------------------::*/ diff --git a/Lib/recurse.c b/Lib/recurse.c index f2d4222..4159eba 100644 --- a/Lib/recurse.c +++ b/Lib/recurse.c @@ -27,7 +27,8 @@ Image_Rect rect; int h1, h2, w1, w2, xx, yy, foo; int mr, mg, mb, dr, dg, db, s; -level++; +level++; /* pourquoi ? */ + if (level > maxlevel) maxlevel = level; @@ -37,10 +38,16 @@ fprintf(stderr, "%5d -> %3d %3d %3d %3d\n", #endif foo = Image_stats_zone_0(S, pRect, &mr, &mg, &mb, &dr, &dg, &db); +if (foo) { + fprintf(stderr, "%s: err stat zone %d\n", __func__, foo); + exit(1); + } + s = (dr + dg + db) / 3; -#if DEBUG_LEVEL > 1 -printf(" %7d V %3d %3d %3d D %3d %3d %3d S %3d (%d)\n", - pRect->w*pRect->h, mr, mg, mb, dr, dg, db, s, foo); + +#if 1 +printf(" %7d V %3d %3d %3d D %3d %3d %3d S %3d\n", + pRect->w*pRect->h, mr, mg, mb, dr, dg, db, s); #endif if ( (s < seuil) || (pRect->w < 6) || (pRect->h < 6) ) { @@ -118,6 +125,10 @@ int Image_call_recursion_0(Image_Desc *image, Image_Desc *dest, int param) Image_Rect rect; int foo; +#if 1 +fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, image, dest, param); +#endif + rect.x = rect.y = 0; rect.h = image->height; rect.w = image->width; @@ -137,7 +148,7 @@ fprintf(stderr, "-> fin recursion: %d, maxlevel=%d\n", foo, maxlevel); dest->modified = 1; -return FUNC_IS_ALPHA; +return FUNC_IS_BETA; } /*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/ diff --git a/Lib/sobel4.c b/Lib/sobel4.c index a60eb83..eb2f29d 100644 --- a/Lib/sobel4.c +++ b/Lib/sobel4.c @@ -9,8 +9,7 @@ #include "../tthimage.h" /*::------------------------------------------------------------------::*/ -int -Image_filtre_Sobel_4(Image_Desc *src, Image_Desc *dst, int rotation) +int Image_filtre_Sobel_4(Image_Desc *src, Image_Desc *dst, int rotation) { static int Sobel[] = { @@ -23,6 +22,8 @@ int filtre[11], foo; Image_Desc *tmp[4]; int x, y, r, g, b; +fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst,rotation); + memcpy(filtre, Sobel, 11*sizeof(int)); for (foo=0; foo<4; foo++) { @@ -50,7 +51,6 @@ for (x=0; xwidth; x++) { dst->Bpix[y][x] = b; } } - dst->modified = 1; for (foo=0; foo<4; foo++) { diff --git a/Lib/testbmp.c b/Lib/testbmp.c index 70d5e7e..3c33a8d 100644 --- a/Lib/testbmp.c +++ b/Lib/testbmp.c @@ -19,6 +19,8 @@ int w; Image_Desc *img; char filename[100], chaine[110]; +fprintf(stderr, "k is %d in %s\n", k, __func__); + Image_load_fnt8x8("libimage.fonte", NULL, 0); for (w=160; w<180; w++) diff --git a/Lib/text0.c b/Lib/text0.c index c82fa19..979f53d 100644 --- a/Lib/text0.c +++ b/Lib/text0.c @@ -220,7 +220,8 @@ posx = x; posy = y; for (foo=0; foo (im->width-8)) { - fprintf(stderr, "can't plot char '%c' at x=%d\n", octet, posx); + fprintf(stderr, "%s: can't plot char '%c' at x=%d\n", + __func__, octet, posx); break; } Image_trace_caractere_2(im, priv_fonte, posx, posy, octet, paper, ink); @@ -259,23 +260,19 @@ if ( (code < 0) || (code > 255)) { paper.r = paper.g = paper.b = 0; ink.r = ink.g = ink.b = 255; - rect.w = kx, rect.h = ky; /* * NEED BOUNDARY CHECK ! */ -for (foo=0; foo<8; foo++) /* 8 scan lines */ - { +for (foo=0; foo<8; foo++) { /* 8 scan lines */ octet = priv_fonte[(code*8)+foo]; rect.y = (foo * ky) + y; - for (bar=0; bar<8; bar++) - { + for (bar=0; bar<8; bar++) { rect.x = (bar * kx) + x; rect.x = ((8-bar)*kx) + x; - if (octet & 1) - { + if (octet & 1) { Image_paint_rect(im, &rect, 255, 198, 0); Image_draw_rect(im, &rect, 0, 0, 80); } diff --git a/Lib/tga.c b/Lib/tga.c index 97603d7..608dd58 100644 --- a/Lib/tga.c +++ b/Lib/tga.c @@ -12,7 +12,7 @@ #include "../tthimage.h" /*::------------------------------------------------------------------::*/ -#define LIBTGA_VERSION "0.2.42" +#define LIBTGA_VERSION "0.2.43" typedef struct { uint8_t text_size; @@ -27,6 +27,9 @@ typedef struct { } Tga_file_header; /*::------------------------------------------------------------------::*/ +/* + * + */ int Image_TGA_write_header(FILE *fp, Tga_file_header *head) { fwrite (&head->text_size, 1, 1, fp); @@ -423,6 +426,8 @@ return OLL_KORRECT; /* new 1er mai 2007 (la france qui bosse tout le temps) */ int Image_TGA_show_header(char *filename, int flag) { +(void)flag; /* WARNING KILLER */ + FILE *fp; Tga_file_header header; int foo; @@ -443,7 +448,7 @@ if (foo) { foo = Image_TGA_print_header(&header); if (foo) { - ; + fprintf(stderr, "%s: something is wrong\n", __func__); } return FUNC_NOT_FINISH; diff --git a/Lib/tiff.c b/Lib/tiff.c new file mode 100644 index 0000000..3d308d1 --- /dev/null +++ b/Lib/tiff.c @@ -0,0 +1,11 @@ +/* + * TIFF + * + * new Sun Jul 28 10:57:00 UTC 2024 + + */ + +#include + +/*::------------------------------------------------------------------::*/ +/*::------------------------------------------------------------------::*/