From 54ee71119d4c7eb10f863db17a3cf71b3764ba03 Mon Sep 17 00:00:00 2001 From: le vieux Date: Fri, 20 Nov 2020 22:25:30 +0100 Subject: [PATCH] faire des bords sombres --- Fonderie/Makefile | 3 ++- Fonderie/crapulator.c | 13 ++++++++++++- Fonderie/fonctions.h | 1 + Fonderie/fonderie.c | 7 ++++++- Fonderie/interpolator.c | 6 +++--- Fonderie/sfx.c | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 56 insertions(+), 6 deletions(-) diff --git a/Fonderie/Makefile b/Fonderie/Makefile index 39a77106..194b8e03 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -1,5 +1,6 @@ # -# compilation de la fonderie +# compilation de la fonderie, du crapulator +# et de tout le crap... # COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 98f8946b..423c7602 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -53,6 +53,9 @@ return 0; * This is the main filter engine * used both for input and output */ + +#define DEBUG_THIS_CRAP 1 + int crapulator(FloatImg *image, int idFx, float fval) { int retval; @@ -67,11 +70,13 @@ fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__, retval = 0; +#if DEBUG_THIS_CRAP if (666==count) { flag_debug = 1; fprintf(stderr, "DEBUG PT 1 in %s:%d\n", __func__, __LINE__); fimg_save_as_png(image, "crap_before.png", 0); } +#endif switch (idFx) { case 0: /* DO NOTHING */ @@ -117,6 +122,9 @@ switch (idFx) { case 11: retval = trinarize(image, 0); break; + case 24: /* experiment ! */ + retval = des_bords_sombres_a(image, 260); + break; case 25: /* please make this function more tweakable */ retval = vertical_singlitch(image, 290+rand()%35, @@ -128,12 +136,15 @@ switch (idFx) { return -77; } +#if DEBUG_THIS_CRAP if (flag_debug) { fprintf(stderr, "DEBUG PT 2 in %s:%d\n", __func__, __LINE__); fimg_save_as_png(image, "crap_after.png", 0); + flag_debug = 0; } +#endif -count++; flag_debug = 0; +count++; return retval; } diff --git a/Fonderie/fonctions.h b/Fonderie/fonctions.h index e0e93a39..3a9baab3 100644 --- a/Fonderie/fonctions.h +++ b/Fonderie/fonctions.h @@ -40,6 +40,7 @@ int create_fifo(int nbslot, int w, int h, int t); * funcs in 'sfx.c' */ +int des_bords_sombres_a(FloatImg *pimg, int offset); int trinarize(FloatImg *pimg, int notused); int binarize(FloatImg *pimg, int notused); diff --git a/Fonderie/fonderie.c b/Fonderie/fonderie.c index 4ab6e4b3..c3a52b22 100644 --- a/Fonderie/fonderie.c +++ b/Fonderie/fonderie.c @@ -89,6 +89,11 @@ else fprintf(stderr, "\tno out fx\n"); memset(&globbuf, 0, sizeof(glob_t)); foo = glob(pattern, 0, NULL, &globbuf); +if (foo) { + fprintf(stderr, "glob failure %d\n", foo); + exit(1); + } + fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo, globbuf.gl_pathc); @@ -136,7 +141,7 @@ for (idx=0; idx %d WTF?\n", cptr, foo); break; } - fprintf(stderr, "\t%5d\r", idx); + fprintf(stderr, "\t%5d / %5ld\r", idx, globbuf.gl_pathc); } fputs("\n", stderr); diff --git a/Fonderie/interpolator.c b/Fonderie/interpolator.c index 427313ed..9ad0eff8 100644 --- a/Fonderie/interpolator.c +++ b/Fonderie/interpolator.c @@ -164,7 +164,7 @@ for (idx=0; idx>> %s ( %p %d )\n", __func__, pimg, offset); +#endif + +if (offset<0 || offset>pimg->width) { + fprintf(stderr, "%s offset %d is bad\n", __func__, offset); + return -66; + } + +for (y=0; yheight; y++) { + lidx = y * pimg->width; + for (xpos=0; xposR[xpos+lidx] *= coef; + pimg->G[xpos+lidx] *= coef; + pimg->B[xpos+lidx] *= coef; + pimg->R[(pimg->width-xpos)+lidx] *= coef; + pimg->G[(pimg->width-xpos)+lidx] *= coef; + pimg->B[(pimg->width-xpos)+lidx] *= coef; + } + } + +return 0; +} /* -------------------------------------------------------------- */ int trinarize(FloatImg *pimg, int notused) {