forked from tTh/FloatImg
better random_blocks
This commit is contained in:
parent
bef5954b93
commit
1a185d05c5
|
@ -206,7 +206,7 @@ switch (idFx) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 26:
|
case 26:
|
||||||
retval = random_blocks(image, 80);
|
retval = random_blocks(image, 70);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
|
|
@ -100,13 +100,19 @@ int random_blocks(FloatImg *picture, int percent)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
for (y=0; y<picture->height; y+=8) {
|
if ( (picture->width%16) || (picture->height%8) )
|
||||||
for (x=0; x<picture->width; x+=8) {
|
{
|
||||||
|
fprintf(stderr, "%s: %d%d bad dims\n", __func__,
|
||||||
|
picture->width, picture->height);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y=0; y<picture->height; y+=16) {
|
||||||
|
for (x=0; x<picture->width; x+=16) {
|
||||||
if (percent < (rand()%100) ) {
|
if (percent < (rand()%100) ) {
|
||||||
|
un_petit_flou_8x8(picture, x, y);
|
||||||
un_petit_flou_8x8(picture,x, y);
|
un_petit_flou_8x8(picture, x+8, y);
|
||||||
|
un_petit_flou_8x8(picture, x, y+8);
|
||||||
|
un_petit_flou_8x8(picture, x+8, y+8);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue