Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: jackm@sparrow.pica.army.MIL (Jack Moskowitz) Newsgroups: comp.windows.x Subject: Re: XDrawRectangle w/ negative width/height? Message-ID: <9102060839.aa22533@sparrow.pica.army.mil> Date: 6 Feb 91 13:39:57 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 54 According to O'Reilly in "Xlib Reference Manual" under XDrawRectangle (p151), the declarations for width and height are unsigned. This implies that the values are positive. No negative widths or heights. What you have to do is keep track of the initial point and then if the pointer moves left or or above this point, you have to switch the "origin" and change sign of width or height. I do this all the time and it works fine. > Date: 6 Feb 91 01:19:56 GMT > From: mxh5795@cs.rit.edu (Michael X Houwers) > Organization: Rochester Institute of Technology, Rochester, NY > Subject: XDrawRectangle w/ negative width/height? > Message-Id: <2124@cs.rit.edu> > Newsgroups: comp.windows.x > Sender: xpert-request@expo.lcs.mit.edu > To: xpert@expo.lcs.mit.edu > > Hello. I was wondering if there are any known bugs in the function > XDrawRectangle in Xlib. I was attempting to write a limited drawing > program (boredom is a wonderful motivator...), which, at the moment > draws lines and rectangles with a "rubberbanding" effect. To draw a > line in the drawing window, you hold down the left mouse button and > move the mouse to the position you want for the other point. The > rectangle works in much the same way, by specifying one corner, then > moving the pointer to the opposite corner, rubberbanding until the > user releases the button. > > The strange behavior I noticed came when I attempted to rubberband a > rectangle in any direction which would cause the width or height to > be negative. If this happened, it appeared that a small corner of > the old rectangle (I am using GXxor to draw over the old rectangle) > is not getting redrawn correctly. So as a result, there are lots > of small corners of rectangles running around the screen. > > I looked at the Xlib Reference Manual (from O'Reilly) and found > no caveats regarding a negative width and/or height. > > So, the question is: can you specify a negative width or height for > a rectangle with no unexpected side effects, and, if that is legal, > are there any known bugs when doing this? > > Any help would be greatly appreciated.. > > Thanks, > mike houwers > -- > --------------------------------------------------------------------------- > Michael Houwers "I'm not sleazy, I"m morally challenged" > bitnet: MWH5795@RITVAXA > internet: mxh5795@cs.rit.edu