[comp.windows.x] R4 XDrawLine

rbd@lamont.ldgo.columbia.edu (roger davis) (01/13/90)

VERSION:
    R4

CLIENT MACHINE and OPERATING SYSTEM:
    Various Sun workstations running both 3.4 and 4.0.3

DISPLAY TYPE:
    bwtwo0, cgtwo0, cgfour0

WINDOW MANAGER:
    twm

AREA:
    Xlib

SYNOPSIS:
    XDrawLine

DESCRIPTION:
    Drawing a horizontal line from right to left causes the drawn line
    to be shifted one pixel too far to the right, i.e.,
    XDrawLine(dpy, win, gc, x0, y, x1, y) and
    XDrawLine(dpy, win, gc, x1, y, x0, y) do not draw the same line.

    Drawing a vertical line from bottom to top causes the drawn line
    to be shifted one pixel too far to the bottom.

    Haven't had time to test lines which are both non-horizontal and
    non-vertical, but someone probably should.

REPEAT BY:
    black= BlackPixel(dpy, DefaultScreen(dpy));
    white= WhitePixel(dpy, DefaultScreen(dpy));
    gcv.function= GXcopy;
    gcv.foreground= black;
    gcv.background= white;
    gc= XCreateGC(dpy, win, (GCFunction | GCForeground | GCBackground), &gcv);
    x= y= 10;
    XDrawLine(dpy, win, gc, x, y, x+10, y);
    XDrawLine(dpy, win, gc, x+10, y+1, x, y+1);

    This should draw two adjacent parallel horizontal lines which look like

	XXXXXXXXXXX
	XXXXXXXXXXX

    but which turn out to be

	XXXXXXXXXXX
	 XXXXXXXXXXX

-- 
Roger Davis
Lamont-Doherty Geological Observatory
rbd@lamont.ldgo.columbia.edu