Glimmr Drawing Commands

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Coordinates

    Drawings are located using coordinates measured from the upper left corner of the window. In other words, the x axis (horizontal) increases as we move right, while the y axis (vertical) increases as we move down. In most cases, coordinates can be specified in one of two ways.

    We can use "by" or "x" to separate the two coordinates (these are freely interchangeable, as the example suggests):

        draw a line (color g-White) in the graphics-window from 100 by 100 to 200 x 200 with 2 pixel line-weight

    More conveniently, we can use braces to define each coordinate pair:

        draw a line (color g-White) in the graphics-window from {100, 100} to {200, 200} with 2 pixel line-weight

    Whichever method we use, the x-coordinate is listed first in each pair, followed by the y-coordinate. For all commands, the coordinates are given in pixels; there is no scaling or other transformation involved. NOTE: for short-form commands (see below), only the brace form for specifying coordinates is allowed.

    It is important to note that coordinates can be drawn outside of the window bounds, either positively (coordinate greater than window dimension) or negatively (coordinate a negative number). This allows us a lot of flexibility for interesting effects.