# Glimmr Drawing Commands

## version 2/101030 by Erik Temple

Section - Stroked Rectangle

To strectdraw (hue - a number) in (win - a g-window) from (x1 - a number) by (y1 - a number) to (x2 - a number) by (y2 - a number) with (wgt - a number) stroke of (color - a number):
(- DrawStrokedRect({hue}, {wgt}, {win}, {x1}, {y1}, {x2}, {y2}, {color}); -)

To draw/display a/-- rectangle/rect (hue - a number) in (win - a g-window) from (x1 - a number) by/x (y1 - a number) to (x2 - a number) by/x (y2 - a number) with (wgt - a number) pixel/pixels/px/-- line-weight/stroke (color - a number):
strectdraw (hue) in (win) from (x1) by (y1) to (x2) by (y2) with (wgt) stroke of (color);
#if utilizing Glimmr debugging;
say "[>console][DC]Drawing a stroked rectangle of color [hue] in [i][win][/i] with upper left ([x1], [y1]) and lower right ([x2], [y2]); stroke of line-weight [wgt] pixels (color [color]) drawn inside the bounds of the box.[<]";
#end if;

To draw/display a/-- rectangle/rect (hue - a number) in (win - a g-window) from (coord1 - a list of numbers) to (coord2 - a list of numbers) with (wgt - a number) pixel/pixels/px/-- line-weight/stroke (color - a number):
let x1 be entry 1 of coord1;
let y1 be entry 2 of coord1;
let x2 be entry 1 of coord2;
let y2 be entry 2 of coord2;
strectdraw (hue) in (win) from (x1) by (y1) to (x2) by (y2) with (wgt) stroke of (color).

To stroked/str/stroke rect/rectangle (coord1 - a list of numbers) to (coord2 - a list of numbers) at (wgt - a number) px/pixels/pixel:
if the type of the current graphics window is not g-graphics:
#if utilizing Glimmr debugging;
say "*** Error: Short-form rectangle-drawing directive ignored. The current graphics window global was not correctly specified.";
#end if;
rule fails;
let x1 be entry 1 of coord1;
let y1 be entry 2 of coord1;
let x2 be entry 1 of coord2;
let y2 be entry 2 of coord2;
strectdraw (current foreground-color) in (current graphics window) from (x1) by (y1) to (x2) by (y2) with (wgt) stroke of (current background-color).

Include (-

[ DrawStrokedRect hue wgt win x1 y1 x2 y2 color;
if (win.ref_number) {
glk_window_fill_rect(win.ref_number, color, x1, y1, x2 - x1, y2 - y1 );
glk_window_fill_rect(win.ref_number, hue, x1 + wgt, y1 + wgt, (x2 - x1) - (wgt * 2), (y2 - y1) - (wgt * 2) );
}
];

-).