XForms: XDrawPoints, Scrolled Canvas

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 20 Oct 99 06:28:11 PDT

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

> can anyone tell me how to run Xlib functions like XDrawPoints..etc on a
> Xforms window. I tried to use freeobjects and then later canvas but have
> problems passing the correct arguments to them. Please can somebody help
> using simple words! ...

The simplest advice I can give you is to get a copy of the O'Reilly
and Associates _Xlib Programming Manual_. It will tell you how to use
almost all the raw Xlib functions.

If you are using a Free object, I suggest you use the XForms drawing
function rather than raw Xlib.

To draw to a Canvas object, all you need to do is get the Canvas's
window ID, create an appropriate GC (Graphics Context), and use the
functions as normal.

For example:

Window canvas_window = FL_ObjWin( canvas );
GC my_gc;
XPoints *your_point_array = created_however_you_wish();

[...]

/* Create a default GC */

my_gc = XCreateGC( fl_get_display(), canvas_window, 0, NULL );

[... set up the GC to your liking ...]

XDrawPoints( fl_get_display(), canvas_window, gc,
your_point_array, n_points, CoordModeOrigin );

[...]

Setting the color of the points is done by manipulating the GC in the
standard manner.

> ... and does anyone know how to use a 'scrolled
> canvas'.

That's easy. According to the manual, it is not implemented yet. :-(

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