algorithm to find the contour for the connected rectangles



HI all,

I had collection of rectangles in a list. I want to draw the
contour for these rectangles removing the lines in between them. can u
guys give me an good algorithm to do this
functionality.....................


Regards

.