The rectangle defined by the upper-left and lower-right corners of a grid is its grid box. Drawing to a grid is confined to the grid-box.
The following program segment creates a window and grid, clears the grid to black, then draws red, green, and blue lines between its upper-left and lower-right corners.
XgrCreateWindow ( @win, 0, 0, 0, 600, 400, 0, "" )
XgrCreateGrid ( @grid, 0, 200, 200, 100, 100, win, 0, 0 )
XgrSetGridBoxGrid ( grid, -99, -99, 0, 0)
XgrSetGridBoxScaled ( grid, -320, +85, +14995, -40 )
XgrClearGrid ( grid, $$Black )
XgrDrawLine ( grid, $$Red, 0, 0, 99, 99 )
XgrDrawLineGrid ( grid, $$Green, -99, -99, 0, 0 )
XgrDrawLineScaled ( grid, $$Blue, -320, +85, +14495, -40 )
Grids can be positioned at any location within a graphics window. They can nest within each other, but should generally not overlap.
Grids obscure each other. Grids are analogous to opaque objects.
Grids simplify graphics applications considerably. Programs can compute in natural units, create grids of any size, position them anywhere, and define their dimensions in any convenient units. Drawing in grids is then scaled and positioned automatically, and drawn with the current attributes of the grid.