39 static char setupLatin1;
41 static void psgen_begin_job(
GVJ_t * job)
43 gvputs(job,
"%!PS-Adobe-3.0");
45 gvputs(job,
" EPSF-3.0\n");
48 gvprintf(job,
"%%%%Creator: %s version %s (%s)\n",
52 static void psgen_end_job(
GVJ_t * job)
54 gvputs(job,
"%%Trailer\n");
59 gvprintf(job,
"%%%%BoundingBox: %d %d %d %d\n",
62 gvputs(job,
"end\nrestore\n");
66 static void psgen_begin_graph(
GVJ_t * job)
75 gvputs(job,
"%%Pages: (atend)\n");
77 gvputs(job,
"%%Pages: 1\n");
80 gvputs(job,
"%%BoundingBox: (atend)\n");
82 gvprintf(job,
"%%%%BoundingBox: %d %d %d %d\n",
86 gvputs(job,
"%%EndComments\nsave\n");
106 gvputs(job,
"setupLatin1\n");
111 gvprintf(job,
"[ {Catalog} << /URI << /Base %s >> >>\n"
115 static void psgen_begin_layer(
GVJ_t * job,
char *layername,
int layerNum,
int numLayers)
117 gvprintf(job,
"%d %d setlayer\n", layerNum, numLayers);
120 static void psgen_begin_page(
GVJ_t * job)
127 gvprintf(job,
"%%%%PageBoundingBox: %d %d %d %d\n",
129 gvprintf(job,
"%%%%PageOrientation: %s\n",
130 (job->
rotation ?
"Landscape" :
"Portrait"));
132 gvprintf(job,
"<< /PageSize [%d %d] >> setpagedevice\n",
134 gvprintf(job,
"%d %d %d beginpage\n",
137 gvprintf(job,
"gsave\n%d %d %d %d boxprim clip newpath\n",
139 gvprintf(job,
"%g %g set_scale %d rotate %g %g translate\n",
147 job->
common->
errorfn(
"canvas size (%d,%d) exceeds PDF limit (%d)\n"
148 "\t(suggest setting a bounding box size, see dot(1))\n",
150 gvprintf(job,
"[ /CropBox [%d %d %d %d] /PAGES pdfmark\n",
155 static void psgen_end_page(
GVJ_t * job)
158 gvputs(job,
"0 0 0 edgecolor\n");
164 gvputs(job,
"endpage\nshowpage\ngrestore\n");
165 gvputs(job,
"%%PageTrailer\n");
169 static void psgen_begin_cluster(
GVJ_t * job)
178 static void psgen_end_cluster(
GVJ_t * job)
180 gvputs(job,
"grestore\n");
183 static void psgen_begin_node(
GVJ_t * job)
188 static void psgen_end_node(
GVJ_t * job)
190 gvputs(job,
"grestore\n");
194 psgen_begin_edge(
GVJ_t * job)
199 static void psgen_end_edge(
GVJ_t * job)
201 gvputs(job,
"grestore\n");
204 static void psgen_begin_anchor(
GVJ_t *job,
char *url,
char *tooltip,
char *target,
char *
id)
209 gvputs(job,
"[ /Rect [ ");
212 gvprintf(job,
" /Border [ 0 0 0 ]\n"
213 " /Action << /Subtype /URI /URI %s >>\n"
221 ps_set_pen_style(
GVJ_t *job)
227 gvputs(job,
" setlinewidth\n");
229 while (s && (p = line = *s++)) {
230 if (strcmp(line,
"setlinewidth") == 0)
241 if (strcmp(line,
"invis") == 0)
267 gvprintf(job,
"%.5g %.5g %.5g %scolor\n",
283 switch (span->
just) {
292 p.
x -= span->
size.
x / 2.0;
299 gvprintf(job,
" %s alignedtext\n", str);
302 static void psgen_ellipse(
GVJ_t * job,
pointf * A,
int filled)
308 AA[1].
x = A[1].
x - A[0].
x;
309 AA[1].
y = A[1].
y - A[0].
y;
314 gvputs(job,
" ellipse_path fill\n");
317 ps_set_pen_style(job);
320 gvputs(job,
" ellipse_path stroke\n");
325 psgen_bezier(
GVJ_t * job,
pointf * A,
int n,
int arrow_at_start,
326 int arrow_at_end,
int filled)
335 for (j = 1; j < n; j += 3) {
337 gvputs(job,
" curveto\n");
339 gvputs(job,
"closepath fill\n");
342 ps_set_pen_style(job);
347 for (j = 1; j < n; j += 3) {
349 gvputs(job,
" curveto\n");
355 static void psgen_polygon(
GVJ_t * job,
pointf * A,
int n,
int filled)
364 for (j = 1; j < n; j++) {
368 gvputs(job,
"closepath fill\n");
371 ps_set_pen_style(job);
376 for (j = 1; j < n; j++) {
380 gvputs(job,
"closepath stroke\n");
384 static void psgen_polyline(
GVJ_t * job,
pointf * A,
int n)
389 ps_set_pen_style(job);
394 for (j = 1; j < n; j++) {
402 static void psgen_comment(
GVJ_t * job,
char *str)
409 static void psgen_library_shape(
GVJ_t * job,
char *name,
pointf * A,
int n,
int filled)
417 gvprintf(job,
" ] %d true %s\n", n, name);
420 ps_set_pen_style(job);
426 gvprintf(job,
" ] %d false %s\n", n, name);
490 {
FORMAT_PS,
"ps", 1, &psgen_engine, &render_features_ps},
gvplugin_installed_t gvdevice_ps_types[]
#define GVDEVICE_DOES_PAGES
void gvprintpointflist(GVJ_t *job, pointf *p, int n)
char * ps_string(char *ins, int chset)
#define GVRENDER_DOES_MAP_RECTANGLE
#define GVRENDER_DOES_TRANSFORM
int gvputs(GVJ_t *job, const char *s)
gvplugin_active_render_t render
#define GVDEVICE_DOES_LAYERS
void epsf_define(GVJ_t *job)
void cat_libfile(GVJ_t *job, const char **arglib, const char **stdlib)
CGRAPH_API char * agnameof(void *)
void gvprintpointf(GVJ_t *job, pointf p)
double yoffset_centerline
void(* errorfn)(const char *fmt,...)
#define GVRENDER_NO_WHITE_BG
void gvprintdouble(GVJ_t *job, double num)
#define GVRENDER_DOES_MAPS
gvplugin_installed_t gvrender_ps_types[]
void gvprintf(GVJ_t *job, const char *format,...)