function data_out = yshear(data,shear,antialias)
% function data = xshear(data,shear)
%
% $Id: xshear.m,v 1.1 2002/07/06 17:38:37 tobin Exp $

the_size = size(data);
width = the_size(1);
height = the_size(2);

for x=1:width,
  skew = shear * y;            % how much to shift this line
  skewi = floor(skew);         % integer part
  skewf = skew - skewi;        % fractional part
  oleft = 0;
  for y=height:-1:1,            % from right to left...
    pixel = data(x, y);        % sample the pixel 
    if antialias,
      left = pixel * skewf;
    else
      left = 0;
    end
    
    pixel = (pixel - left) + oleft;
    if (x+skewi > 0),
      data_out(x+skewi,y) = pixel;
    end
    oleft = left;
  end
  if (skewi+1 > 0), 
    data_out(skewi+1,y) = oleft;
  end
end

