JSEGMENT(3L)

NAME
jsegment, jline, jlineto - draw line on display

SYNOPSIS
#include <dmd.h>

void jsegment (p, q, f)

void jline (p, f)

void jlineto (p, f)

Point p, q;
Code f;

DESCRIPTION
The jline function draws a line in the display bitmap with Code f from the current window point (initially (0, 0) in window coordinates) along the relative vector p which is in window coordinates.

The jlineto function draws a line in the display bitmap from the current window point to the absolute window coordinate p with Code f.

The jsegment function draws a line in the diplay bitmap from the window coordinate p to the window coordinate q with Code f.

The line functions jline, jlineto, and jsegment leave the current window point at the end of the line.

PtCurrent is the global used to refer to the current window point.

EXAMPLE
The following program draws three boxes on the screen using three different methods.

    #include <dmd.h>
    main()
    {
       box(Rect(400,100,600,300));
       rbox(Rect(0,0,200,200),Pt(0,300));
       sbox(Rect(400,700,600,900));
       request(KBD);
       wait(KBD);
    }
    /* draw absolute */
    box(r)
    Rectangle r;
    {
       jmoveto (r.origin);
       jlineto (Pt (r.corner.x, r.origin.y), F_XOR);
       jlineto (r.corner, F_XOR);
       jlineto (Pt (r.origin.x, r.corner.y), F_XOR);
       jlineto (r.origin, F_XOR);
    }
    /* draw relative */
    rbox(r, p)
    Rectangle r;
    Point p;
    {
       jmove (p);
       jline (Pt (r.corner.x - r.origin.x, 0), F_XOR);
       jline (Pt (0, r.corner.y - r.origin.y), F_XOR);
       jline (Pt (r.origin.x - r.corner.x, 0), F_XOR);
       jline (Pt (0, r.origin.y - r.corner.y), F_XOR);
    }
    /* draw with segments */
    sbox(r)
    Rectangle r;
    {
       jsegment (r.origin, Pt(r.corner.x,
                 r.origin.y), F_XOR);
       jsegment (Pt(r.corner.x, r.origin.y),
                 r.corner, F_XOR);
       jsegment (r.corner, Pt(r.origin.x,
                 r.corner.y), F_XOR);
       jsegment (Pt(r.origin.x, r.corner.y),
                 r.origin, F_XOR);
    }

SEE ALSO
globals(3R), pt(3L), segment(3R), structures(3R), transform(3R/3L).