From cdeeb9d92d4c8ef6b215357c671a40658fac9090 Mon Sep 17 00:00:00 2001 From: tonton th Date: Sun, 20 Dec 2020 11:12:43 +0100 Subject: [PATCH] + random blocks 8x8 --- Fonderie/crapulator.c | 5 +++++ Fonderie/glitches.c | 19 +++++++++++++++++++ Fonderie/glitches.h | 1 + 3 files changed, 25 insertions(+) diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 4e11dca..6266cc5 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -221,6 +221,11 @@ switch (idFx) { retval = vertical_singlitch(image, 290+rand()%45, fval, 0.19, 0); break; + + case 26: + retval = random_blocks(image, 80); + break; + default : fprintf(stderr, "%s : effect #%d invalid\n", __func__, idFx); diff --git a/Fonderie/glitches.c b/Fonderie/glitches.c index 21bc8a1..ab4778a 100644 --- a/Fonderie/glitches.c +++ b/Fonderie/glitches.c @@ -96,6 +96,25 @@ for (y=0; y<8; y++) { return 0; } /* -------------------------------------------------------------- */ +int random_blocks(FloatImg *picture, int percent) +{ +int x, y; + +for (y=0; yheight; y+=8) { + for (x=0; xwidth; x+=8) { + + if (percent < (rand()%100) ) { + + un_petit_flou_8x8(picture,x, y); + + } + + } + } + +return 0; +} +/* -------------------------------------------------------------- */ int un_moyen_flou_8x8(FloatImg *picture, int xpos, int ypos) { int i, j, x, y; diff --git a/Fonderie/glitches.h b/Fonderie/glitches.h index 7206a29..845de14 100644 --- a/Fonderie/glitches.h +++ b/Fonderie/glitches.h @@ -4,6 +4,7 @@ int kill_a_random_line(FloatImg *pvictime, float level, int bits); int kill_a_few_lines(FloatImg *who, float fval, int number); +int random_blocks(FloatImg *picture, int percent); int un_petit_flou_8x8(FloatImg *picture, int x, int y); int un_moyen_flou_8x8(FloatImg *picture, int x, int y);