1
// postscript.h -- by Thatcher Ulrich <tu@tulrich.com>
3
// This source code has been donated to the Public Domain. Do
4
// whatever you want with it.
6
// Some helpers for generating Postscript graphics.
12
#include "tu_config.h"
14
// Loosely translated into C++ from:
16
// -- lua interface to postscript
17
// -- Luiz Henrique de Figueiredo (lhf@csg.uwaterloo.ca)
20
// From the Lua 4.0.1 distribution, see http://www.lua.org
26
// Postscript units are 72 per inch.
28
// @@ TODO all these functions need to take floats, not ints...
30
class DSOEXPORT postscript
33
postscript(tu_file* out, const char* title, bool encapsulated = true);
36
void clear(); // New page
37
void comment(const char* s);
38
void rgbcolor(float r, float g, float b);
40
void gray(float amount); // 0 == black, 1 == white
42
void line(float x0, float y0, float x1, float y1);
43
void moveto(float x0, float y0);
44
void lineto(float x0, float y0);
45
void linewidth(float w);
48
void fill(); // after a sequence of moveto/lineto
50
void font(const char* name, float size);
51
void printf(float x, float y, const char* fmt, ...); // printf-style output
53
void circle(float x, float y, float radius);
54
void disk(float x, float y, float radius);
55
void dot(float x, float y);
57
void rectangle(float x0, float x1, float y0, float y1);
58
void box(float x0, float x1, float y0, float y1);
61
void update(float x0, float y0); // enlarge the bounding box if necessary.
65
float m_x0, m_x1, m_y0, m_y1; // bounding box
70
#endif // POSTSCRIPT_H
78
// indent-tabs-mode: t