54 lines
1.7 KiB
Markdown
54 lines
1.7 KiB
Markdown
# Usage
|
|
|
|
The genplotting library use, as a backend, an external
|
|
[software](https://git.tetalab.org/tTh/libtthimage/src/branch/master/Tools/genplot2.c)
|
|
who can be installed with the [libtthimage](https://git.tetalab.org/tTh/libtthimage) and convert scratchfiles to
|
|
[Targa](https://en.wikipedia.org/wiki/Truevision_TGA) image file.
|
|
|
|
For drawing an *useless graphic*, you have to follow three steps:
|
|
initialize, use and terminating.
|
|
You can look at some [examples](exemples.md) and at a
|
|
[full page](http://maison.tth.netlib.re/dessins/numerique.html)
|
|
off UselessGraphics.
|
|
|
|
## Initialize
|
|
|
|
Call the subroutine `genp_init` with two parameters.
|
|
The first is an integer and must be 0. In the futur, it may be used for
|
|
setting some predefined configurations.
|
|
|
|
The second is the filename for recording the plottings instructions,
|
|
I'm using the `.scratch` extension for naming this file.
|
|
And if this filename is an empty string, *stdout* will be used, so
|
|
you can pipe the data for post-processing purpose.
|
|
**Be warned:** if you use this option, don't write anything to the
|
|
unit 6 **!**
|
|
|
|
## Use it
|
|
|
|
- `real xa, ya, xb, yb`
|
|
- `integer color`
|
|
- `call genp_move(xa, ya)`
|
|
- `call genp_draw(xa, ya, color)`
|
|
- `call genp_line(xa, ya, xb, yb, color)`
|
|
|
|
## Terminator
|
|
|
|
- `call genp_end(0)`
|
|
This procedure end the current plotting, add some *bells* to the *WIP*,
|
|
and close the output file, if an output file was specified.
|
|
|
|
## Rendering
|
|
|
|
- `subroutine genp_do_render(srcfile, tgafile, xsize, ysize)`
|
|
|
|
After doing all that useless computing graphics, you can call
|
|
the render, only if you have given a filename to `genp_init`.
|
|
The render engine that I use can only write Targa file, but
|
|
I'm going to add `PNG` to it output in a near futur.
|
|
|
|
|
|
|
|
|
|
|