// set the pen
var colors = new Object();
colors.penColor = new Object();
colors.penColor.index = 1; // blue 0..31
colors.fillColor = new Object();
colors.fillColor.index = 31; // golden 0..31

// fillshade and fillpattern are exclusive. Only one of them will be used
colors.fillShade = 30; // -1..40 (-1 is unfilled)

var pen = new Object();
pen.width = 10;
pen.colors = colors;

var rectangle1 = new Object();

rectangle1.pen = pen;

rectangle1.p1 = new Object();
rectangle1.p1.x = 2000;
rectangle1.p1.y = 2500;

rectangle1.p2 = new Object();
rectangle1.p2.x = 6000;
rectangle1.p2.y = 4000;
winfig.drawRectangle(rectangle1);

// this time we use a custom RGB color
colors.penColor = new Object();
colors.penColor.rgb = new Object();
colors.penColor.rgb.r = 100;
colors.penColor.rgb.g = 200;
colors.penColor.rgb.b = 250;

// fillshade and fillpattern are exclusive. Only one of them will be used. Therefore we have
// to set the fillshade to undefined if it was set before. The alternative would be to create a new color object
// like we create a new rectangle.
colors.fillShade = undefined;
colors.fillPattern = 4; // 0..21

var rectangle2 = new Object();

rectangle2.pen = pen;

rectangle2.p1 = new Object();
rectangle2.p1.x = 3000;
rectangle2.p1.y = 3500;

rectangle2.p2 = new Object();
rectangle2.p2.x = 7000;
rectangle2.p2.y = 5000;
winfig.drawRectangle(rectangle2);

