+ random blocks 8x8

This commit is contained in:
Tonton Th 2020-12-20 11:12:43 +01:00
parent 6bd95089f9
commit cdeeb9d92d
3 changed files with 25 additions and 0 deletions

View File

@ -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);

View File

@ -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; y<picture->height; y+=8) {
for (x=0; x<picture->width; 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;

View File

@ -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);