ECOO AT GRAMERCY 1999

Square

INPUT FILE: square.in

Given a number of rectangular boxes, draw them all, filled in blue in graphics mode, and draw the outline of the resulting shape in red. The outline should follow the edge between the blue shape and the black background, and be drawn on the blue shape. Use the 640 by 480, 16 colour VGA graphics mode.

INPUT
The input consists of a series lines each containing four integers x1 y1 x2 y2 indicating the coordinates of a box to be drawn.

OUTPUT
Output the blue boxes with the resulting shape(s) outlined in red.

NOTES
To access graphics mode use

var gd, gm: integer;
gd := detect;
InitGraph(gd, gm, 'c:\tp\bgi')

To draw a box filled in blue use

SetFillStyle(SolidFill, Blue);
...
Bar(x1, y1, x2, y2);

To put/get a pixel from the screen use

PutPixel(x, y);
GetPixel(x, y, colour);

Sample Input File

100 100 200 200
200 100 400 400

Output for Sample Input

Shown on the left is the inital shape, and shown on the right is the outlined shape (what your program should show. Note that all corners are outlined! Also note the blue area gets smaller after outlining.

Downloader failed! Response object 006~ASP 0159~Buffering Off~Buffering must be on.