gliches++
This commit is contained in:
@@ -113,11 +113,26 @@ int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo)
|
||||
return -1;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
/*
|
||||
* used by vertical_singlitch()
|
||||
*/
|
||||
int x_delta(float dy, float phy)
|
||||
{
|
||||
float param, fv;
|
||||
param = dy + phy;
|
||||
fv = 9.999*sin(param) + 6.666*sin(param*3) + 3.333*sin(param*5);
|
||||
return (int)fv;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
/*
|
||||
* please explain arguments
|
||||
*/
|
||||
int vertical_singlitch(FloatImg *picz, int xpos, float fval,
|
||||
float omega, float phi)
|
||||
{
|
||||
int y, x, w, h;
|
||||
double dy;
|
||||
float dy;
|
||||
float fv;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz,
|
||||
@@ -125,21 +140,23 @@ fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz,
|
||||
#endif
|
||||
|
||||
h = picz->height; w = picz->width;
|
||||
#define BB 10
|
||||
#define BB 4
|
||||
for (y=BB; y<h-BB; y++) {
|
||||
|
||||
dy = (double)y * omega;
|
||||
dy = (float)y * omega; /* normalize vertical position */
|
||||
|
||||
x = xpos + (int)(10.9*sin(dy+phi)); /* add sinus deviation */
|
||||
x = xpos + x_delta(dy, phi); /* add sinus deviation */
|
||||
|
||||
/* compute bounding box */
|
||||
if ( (x>BB) && (x<w-BB) ) {
|
||||
/* an make the glitch */
|
||||
fimg_plot_rgb(picz, x, y, fval, fval, fval);
|
||||
fv = fval / 3.0;
|
||||
if (rand() & 8)
|
||||
fimg_plot_rgb(picz, x-1, y, 0.0, 0.0, 0.0);
|
||||
fimg_plot_rgb(picz, x-1, y, fv, fv, fv);
|
||||
if (rand() & 8)
|
||||
fimg_plot_rgb(picz, x+1, y, 0.0, 0.0, 0.0);
|
||||
// XXX else
|
||||
fimg_plot_rgb(picz, x+1, y, fv, fv, fv);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user