diff --git a/Fonderie/Makefile b/Fonderie/Makefile index a6079de8..5ac2f87f 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -4,8 +4,9 @@ COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses LIBS = -lfloatimg -lpnglite -lm -OBJS = fonctions.o sfx.o crapulator.o -DEPS = fonctions.h crapulator.h + +OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o +DEPS = fonctions.h crapulator.h metriques.h glitches.h all: fonderie interpolator @@ -29,7 +30,13 @@ sfx.o: sfx.c ${DEPS} Makefile # another way to brotch some pics... # -interpolator: interpolator.c ${OBJS} Makefile +metriques.o: metriques.[hc] Makefile + gcc ${COPT} -c $< + +glitches.o: glitches.[hc] Makefile + gcc ${COPT} -c $< + +interpolator: interpolator.c ${OBJS} Makefile gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ # --------------------------------------------------------- diff --git a/Fonderie/fonderie.c b/Fonderie/fonderie.c index fb316e08..4debfeed 100644 --- a/Fonderie/fonderie.c +++ b/Fonderie/fonderie.c @@ -155,7 +155,7 @@ else { fprintf(stderr, "\nelapsed %.2f seconds\n", fin); } -return 8; +return 8; /* why 9 ? */ } /* -------------------------------------------------------------- */ void help(void) diff --git a/Fonderie/glitches.c b/Fonderie/glitches.c new file mode 100644 index 00000000..a99d18d9 --- /dev/null +++ b/Fonderie/glitches.c @@ -0,0 +1,51 @@ +/* + * glitches.c + */ + +#include +#include + +#include "../floatimg.h" + +extern int verbosity; + +/* -------------------------------------------------------------- */ +int kill_a_random_line(FloatImg *pvictime, float fval, int notused) +{ +int line, xpos, offset; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, notused); +#endif + +line = rand() % pvictime->height; + +if (verbosity > 1) { + fprintf(stderr, "%s: try to kill line %d\n", __func__, line); + } + +offset = pvictime->width * line; + +for (xpos=offset; xposwidth; xpos++) { + pvictime->R[offset] = fval; + pvictime->G[offset] = 0.0; + pvictime->B[offset] = fval; + } + +return 0; +} +/* -------------------------------------------------------------- */ +int kill_a_few_lines(FloatImg *who, float fval, int number) +{ +int idx, foo; + +/* Frag the pixels */ +for (idx=0; idx %d\n", idx, foo); @@ -68,7 +67,7 @@ for (idx=0; idx \n"); exit(1); @@ -124,7 +144,7 @@ nbrsteps = atoi(argv[3]); foo = interpolator(argv[1], argv[2], nbrsteps); -fprintf(stderr, "interpolator -> %d\n", foo); +fprintf(stderr, "interpolator give a %d score\n", foo); return 0; } diff --git a/Fonderie/metriques.c b/Fonderie/metriques.c index d878b0c9..df03ae45 100644 --- a/Fonderie/metriques.c +++ b/Fonderie/metriques.c @@ -4,6 +4,8 @@ #include +#include "../floatimg.h" + extern int verbosity; /* -------------------------------------------------------------- */