Changeset 3403


Ignore:
Timestamp:
02/21/09 15:26:58 (4 years ago)
Author:
sam
Message:

wave.c: better behaviour around image edges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/filter/wave.c

    r3397 r3403  
    5959            double t = cost * (x - w / 2) + sint * (y - h / 2); 
    6060            double step = sin(t * freq + phase); 
    61             double dx = xamp * step; 
    62             double dy = yamp * step; 
     61            double dx = xamp; 
     62            double dy = yamp; 
     63            int x2, y2; 
    6364 
    64             int x2 = x + dx; 
    65             int y2 = y + dy; 
     65            if(x < 32) dx = dx * x / 32; 
     66            if(x > w - 1 - 32) dx = dx * (w - 1 - x) / 32; 
     67            if(y < 32) dy = dy * y / 32; 
     68            if(y > h - 1 - 32) dy = dy * (h - 1 - y) / 32; 
    6669 
     70            x2 = x + dx * step; 
     71            y2 = y + dy * step; 
     72 
     73            /* Just in case... */ 
    6774            if(x2 < 0) x2 = 0; 
    6875            else if(x2 >= w) x2 = w - 1; 
Note: See TracChangeset for help on using the changeset viewer.