N = 256;
h = 1/N;
xx = linspace(h/2,1-h/2,N);
yy = xx;
[x,y] = meshgrid(xx,yy);
%u = 1 - x==y;
u = double(x==y).*double(x>0.2).*double(x<0.75);
r = 0.2;
c = [0.3 0.7];
v = (x-c(1)).*(x-c(1)) + (y-c(2)).*(y-c(2)) <= r^2;
w1 = x - 0.6 >= y - 0.2;
w2 = x - 0.8 <= -0.5*(y-0.4);
w3 = y >= 0.2;
w = w1.*w2.*w3;
u = v + 0.76*w + 0.45*(1-u-v-w);
U = uint8(round(255*u));
imagesc(xx,yy,U)
%axis image, colormap gray
axis image xy
colormap default
%set(gca,'ydir','nor')
