rendered paste body#define SINE_MAX_X (4)
#define SINE_OMEGA_X (0.1386)
#define SINE_PHI_X (0)
#define SINE_MAX_Y (4)
#define SINE_OMEGA_Y (0.1248)
#define SINE_PHI_Y (0)
void catcha_reverse_sine_transform(catcha* cat) {
int x,y,shift;
// transform in x-direction
for(y=0; y<CATCHA_H; y++) {
shift = -(int)(SINE_MAX_X*sin(SINE_OMEGA_X*y+SINE_PHI_X));
if(shift > 0) {
for(x=0; x<CATCHA_W; x++)
cat->image[x][y] = (x+shift<CATCHA_W)?cat->image[x+shift][y]:0xFF;
} else {
for(x=CATCHA_W-1; x>=0; x--)
cat->image[x][y] = (x+shift>=0)?cat->image[x+shift][y]:0xFF;
}
cat->image[(CATCHA_W-6)-shift][y] = 0x01;
}
// transform in y-direction
for(x=0; x<CATCHA_W; x++) {
shift = -(int)(SINE_MAX_Y*sin(SINE_OMEGA_Y*x+SINE_PHI_Y));
if(shift > 0) {
for(y=0; y<CATCHA_H; y++)
cat->image[x][y] = (y+shift<CATCHA_H)?cat->image[x][y+shift]:0xFF;
} else {
for(y=CATCHA_H-1; y>=0; y--)
cat->image[x][y] = (y+shift>=0)?cat->image[x][y+shift]:0xFF;
}
cat->image[x][(CATCHA_H-4)-shift] = 0x01;
}
}