Your prior questions suggest that you already have an image to start with. A crude way to add lines to it is to just use edge finding methods. In this example, I'm just using an RGB image. You can do the same with an indexed image, but if you want it to display neatly with distinct colors, you'll have to figure out a colormap that does so (e.g. colorcube or a custom map).
inpict = imread('vdiag.png');
emap = any(edgemap(inpict),3);
emap(:,[1:3 end-2:end]) = 1;
emap([1:3 end-2:end],:) = 1;
emap = imdilate(bwmorph(emap,'thin','Inf'),ones(3));
outpict = inpict.*uint8(~emap);
The function edgemap() is from MIMT:
If you don't want to use that, you can use any other method for edgefinding by gradient approximation. That can be done with fspecial+imfilter and some math, or you can use edge().
emap = zeros(size(inpict));
emap(:,:,c) = edge(inpict(:,:,c),'sobel');
Of course, that still requires IPT, where MIMT does not. If IPT is truly an issue, MIMT also has alternatives for imdilate() and bwmorph().