[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

Two functions are associated with line drawing: Move() and Draw(). Move()
simply moves the cursor to a new position.  It is like picking up a
drawing pen and placing it at a new location. This function is executed by
the statement:

    Move(&rastPort, x, y);

Draw() draws a line from the current x,y position to a new x,y position
specified in the statement itself. The drawing pen is left at the new
position. This is done by the statement:

    Draw(&rastPort, x, y);

Draw() uses the pen color specified for FgPen. Here is a sample sequence
that draws a line from location (0,0) to (100,50).

    SetAPen(&rastPort, COLOR1);    /* Set A pen color. */
    Move(&rastPort, 0, 0);    /* Move to this location. */
    Draw(&rastPort, 100,50);    /* Draw to a this location. */


    Caution:
    --------
    If you attempt to draw a line outside the bounds of the BitMap,
    using the basic initialized RastPort, you may crash the system.
    You must either do your own software clipping to assure that the line
    is in range, or use the layers library. Software clipping means that
    you need to determine if the line will fall outside your BitMap
    before you draw it, and render only the part which falls inside
    the BitMap.