% default border is white all around and then black around that
%
% preserves size
%
% Example: Y = border(X);
%        : Y = border(X,5);    % defines width of black border
%        : Y = border(X,5,2);  % defines width of black and white regions
%        :                     % (black is 5 pixels; inside that 2 of white
%        : % default border widths are each 1 pixel

function Y=steve(X,black_width,white_width);

if nargin==1
  black_width=1;
  white_width=1;
end%if
if nargin==2
  white_width=1;
end%if

if max2nan(X) > 255
  disp('borderb: ***WARNING: image contains values > 255; white won''t be max ***')
end%if
if min2nan(X) < 0
  disp('borderb: ***WARNING: image contains negative values; black won''t be min ***')
end%if

[M,N]=size(X);

disp('borderb: assuming image on interval 0..255 (setting black=0, white=255')

rowpad  = [0*ones(black_width,N);255*ones(white_width,N)];
colpad  = [0*ones(M,black_width) 255*ones(M,white_width)];
rowpad2 = [255*ones(white_width,N);0*ones(black_width,N)];
colpad2 = [255*ones(M,white_width) 0*ones(M,black_width)];
Y = X;
border_thickness=black_width+white_width;
Y(:,1:border_thickness)=colpad;
Y(:,N-(border_thickness-1):N)=colpad2;

Y(1:border_thickness,:)=rowpad;
Y(M-(border_thickness-1):M,:)=rowpad2;

% redo black columns overwritten by white rows
Y(:,1:black_width)=0*ones(M,black_width);
Y(:,N-(black_width-1):N)=0*ones(M,black_width);


