Sfoglia il codice sorgente

wave.c: better behaviour around image edges.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3403 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam 16 anni fa
parent
commit
37a1e5606e
1 ha cambiato i file con 11 aggiunte e 4 eliminazioni
  1. +11
    -4
      pipi/filter/wave.c

+ 11
- 4
pipi/filter/wave.c Vedi File

@@ -58,12 +58,19 @@ pipi_image_t *pipi_wave(pipi_image_t *src, double freq, double phase,
{
double t = cost * (x - w / 2) + sint * (y - h / 2);
double step = sin(t * freq + phase);
double dx = xamp * step;
double dy = yamp * step;
double dx = xamp;
double dy = yamp;
int x2, y2;

int x2 = x + dx;
int y2 = y + dy;
if(x < 32) dx = dx * x / 32;
if(x > w - 1 - 32) dx = dx * (w - 1 - x) / 32;
if(y < 32) dy = dy * y / 32;
if(y > h - 1 - 32) dy = dy * (h - 1 - y) / 32;

x2 = x + dx * step;
y2 = y + dy * step;

/* Just in case... */
if(x2 < 0) x2 = 0;
else if(x2 >= w) x2 = w - 1;



Caricamento…
Annulla
Salva