This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: graphics in scheme?


> A graphics tool that allows me to create graphics in form of a program,
> maybe similar to the way graphics can be created in TeX, but hopefully
> more flexible.

You can generate GNU metafile format and then use the plot program
to translate that into (almost) whatever you want. I haven't tried
looking too carefully at GNU metafile format but it seems simple
enough that generating it from a program would not be difficult.

> I could work with a tool where this is the only way to
> create graphics, but it would even be nicer if it was an option in
> addition to interactive drawing.  I'd favor (obviously :-) a
> guile-extended tool or one that was programmable in scheme.
>  (But, that's not a strict requirement.)

Depends on how much interactivity you want, I had a try at generating
xfig files from scheme and it was easy enough since they are all
just ASCII numbers. You draw a few of the primitives in xfig, save
it, look at the result, write a program to make more like that, etc.

If you use GNU metafile then it will be difficult to edit with xfig
but you can move the whole object around as an item if you translate
it to postscript or something. Then you can put borders on it and
captions, label key parts of the drawing or whatever.

More and more often I'm just writing straight postscript for my
applications. I generally write a header by hand, then use the program
to dump all the numbers punctuated by single letter postscript
commands. With a little bit of a footer and some shuffle with
dictionaries it is easy to make this into an EPS file and drop
it into a document or something.

----------------------------------------------------------------------

I also had a go at adding guile to xfig and did get as far as a
popup console where you could interactively evaluate guile commands
in an xfig application. You could also make reference to xfig
objects from within guile but the whole deal had heaps of work
still to do:

	* xfig objects are all structs so you need some accessor
	  functions from guile to manipulate those structs
	  (not rocket science but some big tables to construct).

	* I don't know how xfig keyboard and mouse events work and
	  never figured out a good method for allowing guile to
	  steal some events (I was intending to just provide bindings
	  to all the function keys).

	* xfig and guile versions moved on, I didn't keep the momentum
	  up and found other methods of generating pictures to be easier.

<shrug> lots of projects have this happen to them.

	- Tel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]