Re: XForms: Canvases

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 25 Jul 97 11:14:32 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I have a new application requiring that I draw lines, numbers, nodes
> etc. on a canvas. I need to be able to change the color & thickness
> of the lines, and otherwise manage the display. Does anybody have any
> sample xforms/X code that I could "borrow" to help get me started?

If you're going to use a plain old Canvas, you'll be drawing in
straight X, using Xlib calls. Basically, just create the Canvas, get
its Window XID with FL_ObjWin() and do your thing. Not much to it.

I generally only use Canvas objects for display of images and such.

You may want to consider two alternatives:

Use an OpenGL canvas with either SGI's OpenGL on a real SGI or MesaGL
if you're running some other system not supported by honest to Pete
OpenGL. This gives you a much nicer API than Xlib. The file gl.c in
the FORMS directory should be of help getting you started there.

The other alternative is to use a Free object rather than a Canvas.
If your drawing is limited to what you describe, the XForms supplied
drawing routines may suffice. There's a piece of code in DEMOS that
should be useful.

What do you need to do that the XForms drawing routines won't do?

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/