sunday cosmetic commit

This commit is contained in:
tTh 2024-08-11 11:21:23 +02:00
parent ce04418ef1
commit 38173616ba
8 changed files with 78 additions and 51 deletions

15
Lib/equalhist.c Normal file
View File

@ -0,0 +1,15 @@
/*
* Egalisation par cumul d'histogramme
* ===================================
*
* new: Sat Aug 10 14:38:01 UTC 2024, aux Bourtoulots
*/
#include <stdio.h>
#include <math.h>
#include "../tthimage.h"
/*::------------------------------------------------------------------::*/

View File

@ -2,7 +2,7 @@
pov_hf15e.c pov_hf15e.c
=========== ===========
opérations de morphologie mathématique appliquées operations de morphologie mathematique appliquees
aux height-fields. aux height-fields.
*/ */
@ -18,40 +18,30 @@ static struct
int x, y; int x, y;
} off[] = } off[] =
{ {
{ -1, -1 }, { -1, -1 }, { 0, -1 }, { 1, -1 },
{ 0, -1 }, { -1, 0 }, { 0, 0 }, { 1, 0 },
{ 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 ? * pas trop quoi y mettre ?
*/ */
int int Image_hf15_dilate(Image_Desc *src, Image_Desc *dst, int coef)
Image_hf15_dilate(Image_Desc *src, Image_Desc *dst, int coef)
{ {
(void)coef; /* KILL WARNING */
int foo; int foo;
int x, y, h, hmax; 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); fprintf(stderr, "Image hf15 dilate: images differents %d\n", foo);
return foo; return foo;
} }
for (y=1; y<dst->height-1; y++) for (y=1; y<dst->height-1; y++) {
{ for (x=1; x<dst->width-1; x++) {
for (x=1; x<dst->width-1; x++)
{
hmax = -1664; 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); h = Image_hf15_height(src, x+off[foo].x, y+off[foo].y);
if (h > hmax) hmax = h; 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 int Image_hf15_erode(Image_Desc *src, Image_Desc *dst, int coef)
Image_hf15_erode(Image_Desc *src, Image_Desc *dst, int coef)
{ {
(void)coef; /* KILL WARNING */
int foo; int foo;
int x, y, h, hmin; 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); fprintf(stderr, "Image hf15 erode: images differents %d\n", foo);
return foo; return foo;
} }
for (y=1; y<dst->height-1; y++) for (y=1; y<dst->height-1; y++) {
{ for (x=1; x<dst->width-1; x++) {
for (x=1; x<dst->width-1; x++)
{
hmin = 42042; 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); h = Image_hf15_height(src, x+off[foo].x, y+off[foo].y);
if (h < hmin) hmin = h; 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
*/ */
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/

View File

@ -27,7 +27,8 @@ Image_Rect rect;
int h1, h2, w1, w2, xx, yy, foo; int h1, h2, w1, w2, xx, yy, foo;
int mr, mg, mb, dr, dg, db, s; int mr, mg, mb, dr, dg, db, s;
level++; level++; /* pourquoi ? */
if (level > maxlevel) if (level > maxlevel)
maxlevel = level; maxlevel = level;
@ -37,10 +38,16 @@ fprintf(stderr, "%5d -> %3d %3d %3d %3d\n",
#endif #endif
foo = Image_stats_zone_0(S, pRect, &mr, &mg, &mb, &dr, &dg, &db); 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; s = (dr + dg + db) / 3;
#if DEBUG_LEVEL > 1
printf(" %7d V %3d %3d %3d D %3d %3d %3d S %3d (%d)\n", #if 1
pRect->w*pRect->h, mr, mg, mb, dr, dg, db, s, foo); 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 #endif
if ( (s < seuil) || (pRect->w < 6) || (pRect->h < 6) ) { 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; Image_Rect rect;
int foo; int foo;
#if 1
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, image, dest, param);
#endif
rect.x = rect.y = 0; rect.x = rect.y = 0;
rect.h = image->height; rect.h = image->height;
rect.w = image->width; rect.w = image->width;
@ -137,7 +148,7 @@ fprintf(stderr, "-> fin recursion: %d, maxlevel=%d\n", foo, maxlevel);
dest->modified = 1; dest->modified = 1;
return FUNC_IS_ALPHA; return FUNC_IS_BETA;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/

View File

@ -9,8 +9,7 @@
#include "../tthimage.h" #include "../tthimage.h"
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_filtre_Sobel_4(Image_Desc *src, Image_Desc *dst, int rotation)
Image_filtre_Sobel_4(Image_Desc *src, Image_Desc *dst, int rotation)
{ {
static int Sobel[] = static int Sobel[] =
{ {
@ -23,6 +22,8 @@ int filtre[11], foo;
Image_Desc *tmp[4]; Image_Desc *tmp[4];
int x, y, r, g, b; int x, y, r, g, b;
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst,rotation);
memcpy(filtre, Sobel, 11*sizeof(int)); memcpy(filtre, Sobel, 11*sizeof(int));
for (foo=0; foo<4; foo++) { for (foo=0; foo<4; foo++) {
@ -50,7 +51,6 @@ for (x=0; x<src->width; x++) {
dst->Bpix[y][x] = b; dst->Bpix[y][x] = b;
} }
} }
dst->modified = 1; dst->modified = 1;
for (foo=0; foo<4; foo++) { for (foo=0; foo<4; foo++) {

View File

@ -19,6 +19,8 @@ int w;
Image_Desc *img; Image_Desc *img;
char filename[100], chaine[110]; char filename[100], chaine[110];
fprintf(stderr, "k is %d in %s\n", k, __func__);
Image_load_fnt8x8("libimage.fonte", NULL, 0); Image_load_fnt8x8("libimage.fonte", NULL, 0);
for (w=160; w<180; w++) for (w=160; w<180; w++)

View File

@ -220,7 +220,8 @@ posx = x; posy = y;
for (foo=0; foo<t_texte; foo++) { for (foo=0; foo<t_texte; foo++) {
octet = ptrtxt[foo]; octet = ptrtxt[foo];
if (posx > (im->width-8)) { if (posx > (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; break;
} }
Image_trace_caractere_2(im, priv_fonte, posx, posy, octet, paper, ink); 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; paper.r = paper.g = paper.b = 0;
ink.r = ink.g = ink.b = 255; ink.r = ink.g = ink.b = 255;
rect.w = kx, rect.h = ky; rect.w = kx, rect.h = ky;
/* /*
* NEED BOUNDARY CHECK ! * 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]; octet = priv_fonte[(code*8)+foo];
rect.y = (foo * ky) + y; rect.y = (foo * ky) + y;
for (bar=0; bar<8; bar++) for (bar=0; bar<8; bar++) {
{
rect.x = (bar * kx) + x; rect.x = (bar * kx) + x;
rect.x = ((8-bar)*kx) + x; rect.x = ((8-bar)*kx) + x;
if (octet & 1) if (octet & 1) {
{
Image_paint_rect(im, &rect, 255, 198, 0); Image_paint_rect(im, &rect, 255, 198, 0);
Image_draw_rect(im, &rect, 0, 0, 80); Image_draw_rect(im, &rect, 0, 0, 80);
} }

View File

@ -12,7 +12,7 @@
#include "../tthimage.h" #include "../tthimage.h"
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
#define LIBTGA_VERSION "0.2.42" #define LIBTGA_VERSION "0.2.43"
typedef struct { typedef struct {
uint8_t text_size; uint8_t text_size;
@ -27,6 +27,9 @@ typedef struct {
} Tga_file_header; } Tga_file_header;
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
/*
*
*/
int Image_TGA_write_header(FILE *fp, Tga_file_header *head) int Image_TGA_write_header(FILE *fp, Tga_file_header *head)
{ {
fwrite (&head->text_size, 1, 1, fp); 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) */ /* new 1er mai 2007 (la france qui bosse tout le temps) */
int Image_TGA_show_header(char *filename, int flag) int Image_TGA_show_header(char *filename, int flag)
{ {
(void)flag; /* WARNING KILLER */
FILE *fp; FILE *fp;
Tga_file_header header; Tga_file_header header;
int foo; int foo;
@ -443,7 +448,7 @@ if (foo) {
foo = Image_TGA_print_header(&header); foo = Image_TGA_print_header(&header);
if (foo) if (foo)
{ {
; fprintf(stderr, "%s: something is wrong\n", __func__);
} }
return FUNC_NOT_FINISH; return FUNC_NOT_FINISH;

11
Lib/tiff.c Normal file
View File

@ -0,0 +1,11 @@
/*
* TIFF
*
* new Sun Jul 28 10:57:00 UTC 2024
*/
#include <stdio.h>
/*::------------------------------------------------------------------::*/
/*::------------------------------------------------------------------::*/