[comp.windows.x] Problems with XDraw to draw a curve...

lmiguel@hpsmtc1.HP.COM (Luis Miguel) (09/27/89)

I am trying to draw a curve between 3 points using
XDraw (I know this is slow, but XDrawArc is not what
I want because it would be very hard to fit these 3 points
in a rectangle and know where to start and end the arc).
XDraw is kept for "compatibility" with X10.

The problem: XDraw draws 2 straight lines, from vlist[0]
to vlist[1] to vlist[2]. (See code fragment below).

How do I set the flags argument so that the line drawn is curved?
(I have tried setting vlist[0].flags = vlist[2].flags = 0 and
get same result).

Here is the code fragment:

	  vlist[0].x = (int) x1;
	  vlist[0].y = (int) y1;;
	  vlist[0].flags = VertexCurved;
	  vlist[1].x = (int) Xm;
	  vlist[1].y = (int) Ym;
	  vlist[1].flags = VertexCurved;
	  vlist[2].x = (int) x2;
	  vlist[2].y = (int) y2;
	  vlist[2].flags = VertexCurved;

	  /* draw the arc */
	  XDraw (XtDisplay (w->core.parent), XtWindow (w->core.parent),
		 w->arc.current_gc, vlist, 3);
		  


Thanks a bunch,

/Luis
lmiguel@hpsmtc1.hp.com

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (09/28/89)

    The problem: XDraw draws 2 straight lines, from vlist[0]
    to vlist[1] to vlist[2].

One of the features of X10 is that the graphics were very ill-defined,
and this survives today in the compatibility functions.  I'm half-guessing,
but I think you need at least four points for a curve to work.  (If you
really on have three points, you can try cheating by replicating the
last point.)