[comp.windows.x] negative Xlib drawing coordinates

rbd@lamont.ldgo.columbia.edu (roger davis) (04/18/91)

Is it safe to use negative pixel coordinates as arguments to
Xlib drawing routines, e.g.,

	XDrawLine(dpy, drw, gc, -20, -80, 100, 200);

and does Xlib or the server properly clip such operations at
the boundaries of the drawable? Is this behavior well-defined
for all server/Xlib implementations?

My immediate problem is that I need to draw arbitrarily rotated
rectangles which may be partially off the drawable, and I'd
rather not compute the clipping myself.

I'm hopeful that this is guaranteed to work since the arguments
are not declared as unsigned, but I can't find any explicit mention
of this in any of my FMs. Can anyone in the know comment on this?

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

klee@wsl.dec.com (Ken Lee) (04/19/91)

In article <3644@lamont.ldgo.columbia.edu>, rbd@lamont.ldgo.columbia.edu (roger davis) writes:
|> Is it safe to use negative pixel coordinates as arguments to
|> Xlib drawing routines, e.g.,
|> 
|> 	XDrawLine(dpy, drw, gc, -20, -80, 100, 200);
|> 
|> and does Xlib or the server properly clip such operations at
|> the boundaries of the drawable? Is this behavior well-defined
|> for all server/Xlib implementations?

Yes.  Yes.  It is well defined for non-buggy implementations.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee