tt = imread('/home/cepek/Desktop/matlab-img-demo/tvrz.png');

figure(1), imshow(tt);

L  = 3;   % line width
k  = 64;
t2 = imsubtract(tt, k); figure(2), imshow(t2);
t3 = imadd(tt, k);      figure(3), imshow(t3);


x  = 0:255;
y1 = x;
figure(4)
plot(x,y1, 'LineWidth', L);
axis([0 255 0 255]);
axis square;
set(gca, 'xTick', [0 255]);
set(gca, 'xTickLabel', {'0', '255'});
set(gca, 'yTick', [0 255]);
set(gca, 'yTickLabel', {'0', '255'});

x  = 0:255;
y2 = x+k;
y2(y2 > 255) = 255-1;
figure(5)
plot(x,y2, 'LineWidth', L);
axis([0 255 0 255]);
axis square;
set(gca, 'xTick', [0 255]);
set(gca, 'xTickLabel', {'0', '255'});
set(gca, 'yTick', [0 255]);
set(gca, 'yTickLabel', {'0', '255'});

x  = 0:255;
y3 = x-k;
y3(y3 <= 0) = 1;
figure(6)
plot(x,y3, 'LineWidth', L);
axis([0 255 0 255]);
axis square;
set(gca, 'xTick', [0 255]);
set(gca, 'xTickLabel', {'0', '255'});
set(gca, 'yTick', [0 255]);
set(gca, 'yTickLabel', {'0', '255'});