[comp.windows.x] Question about XDrawArc

koon@oakhill.UUCP (Ming Lao) (07/08/89)

 
I tried to draw an arc using XDrawArc in the XLib, but I have trouble using it.
I am using X11 Release 3 on Sun 3/60.

The following information about XDrawArc comes from the Xlib manual:

	XDrawArc(dispaly, d, gc, x, y, width, height, angle1, angle2) 
		Display      *display;
		Drawable     d;
		GC           gc;
		int          x, y;
		unsigned int width, height;
		int          angle1, angle2;

	display     Specifies the connection to X server
	d           specifies the drawable
	gc          specifies the GC
	x, y        specifies the x and y coordinates, which are relative
	            to the origin of the drawable and specify the upper-left
	            corner of the bounding rectangle.
	width,
	height      specify the width and height, which are the major and
	            minor axes of the arc.
	angle1      specifies the start of the arc relative to the three o'clock
	            position from the center, in units of degrees * 64.
	angle2      specifies the path and extent fo the arc relative to the
	            start of the arc, in units of degrees * 64.


However, using this routine, I can draw either an ellipse or nothing.  When
angle2 is assigned to be 0, I got an ellipse, when angle is non-zero, nothing
is being drawn on the screen!!!  Angle1 is zero in both cases.   According to
the manual, if angle2 is 1, an arc should be drawn with extent of 64 degrees.

I wonder if I have misunderstood the manual or there is a bug in the 
XDrawArc routine ? 

Adrian

oakhill!maya!koon@cs.utexas.edu
adrian@ece.ece.utexas.edu

MAP@LCS.MIT.EDU (Michael A. Patton) (07/09/89)

   Date: 7 Jul 89 20:16:20 GMT
   From: usc!cs.utexas.edu!oakhill!koon@bloom-beacon.mit.edu  (Ming Lao)

	angle1      specifies the start of the arc relative to the three
		    o'clock position from the center, in units of degrees * 64.
	angle2      [same]

   [...] According to the manual, if angle2 is 1, an arc should be drawn
   with extent of 64 degrees.

   I wonder if I have misunderstood the manual or there is a bug in the 
   XDrawArc routine ? 

I think you misunderstood the manual, my reading of that text says that
angle2=1 gives 1/64 of a degree (so small you won't be able to see it,
the symptom you report).  In fact with other information around, this is
the only reasonable interpretation (you want to be able to position the
ends to more than 6 different angles don't you? :-) Try using much
larger numbers for angle2.  4096 should produce a 64 degree angle (if
that's what you really want).