tryng to really glitch my picz
parent
905c61628f
commit
e7c726320a
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* glitches.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int kill_a_random_line(FloatImg *pvictime, float fval, int notused)
|
||||
{
|
||||
int line, xpos, offset;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, notused);
|
||||
#endif
|
||||
|
||||
line = rand() % pvictime->height;
|
||||
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "%s: try to kill line %d\n", __func__, line);
|
||||
}
|
||||
|
||||
offset = pvictime->width * line;
|
||||
|
||||
for (xpos=offset; xpos<pvictime->width; xpos++) {
|
||||
pvictime->R[offset] = fval;
|
||||
pvictime->G[offset] = 0.0;
|
||||
pvictime->B[offset] = fval;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int kill_a_few_lines(FloatImg *who, float fval, int number)
|
||||
{
|
||||
int idx, foo;
|
||||
|
||||
/* Frag the pixels */
|
||||
for (idx=0; idx<number; idx++) {
|
||||
foo = kill_a_random_line(who, fval, 0);
|
||||
if (foo) abort();
|
||||
}
|
||||
|
||||
return foo;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* glitches.h
|
||||
*/
|
||||
|
||||
int kill_a_random_line(FloatImg *pvictime, float level, int notused);
|
||||
int kill_a_few_lines(FloatImg *who, float fval, int number);
|
||||
|
||||
|
||||
/* this is a wtf file */
|
Loading…
Reference in New Issue