int arrow_at_start, int arrow_at_end, int);
void (*polyline) (GVJ_t * job, pointf * A, int n);
void (*comment) (GVJ_t * job, char *comment);
+ void (*library_shape) (GVJ_t * job, char *name, pointf * A, int n, int filled);
};
#ifdef __cplusplus
#include "gvcproc.h"
extern int emit_once(char *str);
+extern shape_desc *find_user_shape(char *name);
/* storage for temporary hacks until client API is FP */
static pointf *AF;
int i;
pointf *af;
- if (! (us = gvusershape_find(name)))
+ if (! (us = gvusershape_find(name))) {
+ if (find_user_shape(name)) {
+ if (gvre && gvre->library_shape)
+ gvre->library_shape(job, name, a, n, filled);
+ }
return;
+ }
if (job->flags & GVRENDER_DOES_TRANSFORM)
af = a;
dpi = POINTS_PER_INCH;
/* no shape file, no shape size */
- if (!name || (*name == '\0')) {
+ if (!name || (*name == '\0') || !(us = gvusershape_open (name))) {
rv.x = rv.y = -1;
- return rv;
}
-
- if ((us = gvusershape_open (name))) {
+ else {
rv.x = us->w * dpi / us->dpi;
rv.y = us->h * dpi / us->dpi;
}
- else {
- rv.x = rv.y = -1;
- }
-
return rv;
}
xdot_bezier,
xdot_polyline,
0, /* xdot_comment */
+ 0, /* xdot_library_shape */
};
gvrender_features_t canon_features = {
fig_polygon,
fig_bezier,
fig_polyline,
- fig_comment
+ fig_comment,
+ 0, /* fig_library_shape */
};
0, /* map_bezier */
0, /* map_polyline */
0, /* map_comment */
+ 0, /* map_library_shape */
};
static gvrender_features_t map_features = {
if (job->common->show_boxes == NULL)
core_fputs(job, "%%BoundingBox: (atend)\n");
core_fputs(job, "%%EndComments\nsave\n");
+ /* include shape library */
cat_preamble(job, job->common->lib);
+ /* include epsf */
epsf_define(job->output_file);
}
isLatin1 = (GD_charset(obj->u.g) == CHAR_LATIN1);
core_fputs(job, "\n");
}
+static void psgen_library_shape(GVJ_t * job, char *name, pointf * A, int n, int filled)
+{
+ int j;
+
+ if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
+ ps_set_color(job, &(job->obj->fillcolor));
+ core_fputs(job, "[ ");
+ for (j = 0; j < n; j++)
+ core_printf(job, "%g %g ", A[j].x, A[j].y);
+ core_printf(job, "%g %g ", A[0].x, A[0].y);
+ core_printf(job, "] %d true %s\n", n, name);
+ }
+ if (job->obj->pencolor.u.HSVA[3] > .5) {
+ ps_set_pen_style(job);
+ ps_set_color(job, &(job->obj->pencolor));
+ core_fputs(job, "[ ");
+ for (j = 0; j < n; j++)
+ core_printf(job, "%g %g ", A[j].x, A[j].y);
+ core_printf(job, "%g %g ", A[0].x, A[0].y);
+ core_printf(job, "] %d false %s\n", n, name);
+ }
+}
+
static gvrender_engine_t psgen_engine = {
psgen_begin_job,
psgen_end_job,
psgen_bezier,
psgen_polyline,
psgen_comment,
+ psgen_library_shape,
};
static gvrender_features_t psgen_features = {
svg_bezier,
svg_polyline,
svg_comment,
+ 0, /* svg_library_shape */
};
gvrender_features_t svg_features = {
gdgen_bezier,
gdgen_polyline,
0, /* gdgen_comment */
+ 0, /* gdgen_library_shape */
};
static gvrender_features_t gdgen_features_tc = {
vrml_bezier,
vrml_polyline,
0, /* vrml_comment */
+ 0, /* vrml_library_shape */
};
static gvrender_features_t vrml_features = {
ming_bezier,
ming_polyline,
0, /* ming_comment */
+ 0, /* ming_library_shape */
};
static gvrender_features_t ming_features = {
cairogen_bezier,
cairogen_polyline,
0, /* cairogen_comment */
+ 0, /* cairogen_library_shape */
};
static gvrender_features_t cairogen_features = {