diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index af46fc3..1d32ed7 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -92,6 +92,7 @@ FimgFilter3x3 lowpass = { }; FimgFilter3x3 hipass = { + /* there was a bug with this filter */ { -1.0, -1.0, -1.0, -1.0, 9.0, -1.0, @@ -101,6 +102,7 @@ FimgFilter3x3 hipass = { }; FimgFilter3x3 diagonal = { + /* there was a bug with this filter */ { 4.0, 1.0, 0.0, 1.0, 0.0, -1.0, @@ -354,8 +356,9 @@ switch (idFx) { retval = des_bords_sombres_a(image, 160); break; case CR_bsombrb: /* experiment ! */ - retval = des_bords_sombres_b(image, 160); + retval = des_bords_sombres_b(image, 100); break; + case CR_vsglitch: /* please make this function more tweakable */ retval = vertical_singlitch(image, 290+rand()%45, diff --git a/Fonderie/sfx.c b/Fonderie/sfx.c index dc7efda..a826eaa 100644 --- a/Fonderie/sfx.c +++ b/Fonderie/sfx.c @@ -56,7 +56,13 @@ int x, y, pline, off; for (y=pos[1]; ywidth; - for (x=pos[0]+2; xR[off]=pimg->G[off]=pimg->B[off]=0.0; + } +#endif + for (x=pos[0]+2; x<(pos[0]+pos[2]-2); x++) { off = pline + x; /* wtf i'm doing here ? */ pimg->R[off] = fvals[0]; @@ -320,21 +326,39 @@ return 0; /* -------------------------------------------------------------- */ /* nouveau Mon 10 May 2021 08:46:02 PM CEST * chez Eric 1KA */ -int des_bords_sombres_b(FloatImg *pimg, int offset) +int des_bords_sombres_b(FloatImg *pimg, int nbre) { - +int idx, x, foo; +float coef, *fptr; #if DEBUG_LEVEL fprintf(stderr, ">>> %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 (idx=0; idxR + (idx*pimg->width); + for (x=0; xwidth; x++) *fptr++ *= coef; + fptr = pimg->G + (idx*pimg->width); + for (x=0; xwidth; x++) *fptr++ *= coef; + fptr = pimg->B + (idx*pimg->width); + for (x=0; xwidth; x++) *fptr++ *= coef; + + foo = (pimg->height-idx) - 1; + fptr = pimg->R + (foo*pimg->width); + // fprintf(stderr, "%5d %9.3f %p\n", foo, coef, fptr); + for (x=0; xwidth; x++) *fptr++ *= coef; + fptr = pimg->G + (foo*pimg->width); + for (x=0; xwidth; x++) *fptr++ *= coef; + fptr = pimg->B + (foo*pimg->width); + for (x=0; xwidth; x++) *fptr++ *= coef; + } -fprintf(stderr, "ERROR: %s not implemented\n", __func__); +// fprintf(stderr, "WARNING: %s badly implemented\n", __func__); -return -1; +return 0; } /* -------------------------------------------------------------- */ /* diff --git a/floatimg.h b/floatimg.h index 5aec108..d836480 100644 --- a/floatimg.h +++ b/floatimg.h @@ -4,7 +4,7 @@ * http://la.buvette.org/photos/cumul */ -#define FIMG_VERSION 157 +#define FIMG_VERSION 158 /* * in memory descriptor diff --git a/funcs/Makefile b/funcs/Makefile index cc66522..b2ec18f 100644 --- a/funcs/Makefile +++ b/funcs/Makefile @@ -7,7 +7,7 @@ COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0 DEPS = ../floatimg.h Makefile OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ - fimg-libpnm.o rampes.o \ + fimg-libpnm.o rampes.o rectangle.o \ sfx0.o sfx1.o sfx2.o sfx3.o sfx4.o \ geometry.o rotate.o fimg-openexr.o \ equalize.o fimg-fits.o saturation.o histogram.o \ @@ -37,6 +37,9 @@ tests.o: tests.c tests.h $(DEPS) # ### +rectangle.o: rectangle.c $(DEPS) + gcc $(COPT) -c $< + decomprgb.o: decomprgb.c $(DEPS) gcc $(COPT) -c $< diff --git a/funcs/rectangle.c b/funcs/rectangle.c new file mode 100644 index 0000000..83da174 --- /dev/null +++ b/funcs/rectangle.c @@ -0,0 +1,32 @@ +/* + * R E C T A N G L E + * This is an eternal WIP, sorry... + */ + +#include +#include +#include +#include + +#include "../floatimg.h" + +/* --------------------------------------------------------------------- */ +int fimg_clear_rectangle(FloatImg *pi, int coo[4]) +{ +int line, off; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %p )\n", __func__, pi, coo); +#endif + + /* please add boudary checks */ + +for (line=0; linewidth + coo[0]; + fprintf(stderr, "line %d off %d\n", line, off); + } + +return -1; +} +/* --------------------------------------------------------------------- */ +