if (truecolor_p) {
if (Verbose)
fprintf(stderr, "%s: allocating a %dK TrueColor GD image\n",
- CmdName, ROUND(Viewport.x * Viewport.y * 4 / 1024.));
+ gvc->cmdname, ROUND(Viewport.x * Viewport.y * 4 / 1024.));
im = gdImageCreateTrueColor(Viewport.x, Viewport.y);
} else {
if (Verbose)
fprintf(stderr, "%s: allocating a %dK PaletteColor GD image\n",
- CmdName, ROUND(Viewport.x * Viewport.y / 1024.));
+ gvc->cmdname, ROUND(Viewport.x * Viewport.y / 1024.));
im = gdImageCreate(Viewport.x, Viewport.y);
}
if (!im) {
if (Config)
exit (0);
- CmdName = dotneato_basename(argv[0]);
- i = gvlayout_select(gvc, CmdName);
+ CmdName = gvc->cmdname = dotneato_basename(argv[0]);
+ i = gvlayout_select(gvc, gvc->cmdname);
if (i == NO_SUPPORT)
gvlayout_select(gvc, "dot");
PSinputscale = POINTS_PER_INCH;
break;
case 'v':
- Verbose = 1;
+ gvc->verbose = 1;
if (isdigit(*(unsigned char *) rest))
- Verbose = atoi(rest);
+ gvc->verbose = atoi(rest);
+ Verbose = gvc->verbose;
break;
case 'x':
Reduce = TRUE;
dotneato_usage(0);
break;
default:
- fprintf(stderr, "%s: option -%c unrecognized\n\n", CmdName,
+ fprintf(stderr, "%s: option -%c unrecognized\n\n", gvc->cmdname,
c);
dotneato_usage(1);
}
}
else {
while ((fn = gvc->input_filenames[fidx++]) && !(fp = fopen(fn, "r"))) {
- agerr(AGERR, "%s: can't open %s\n", CmdName, fn);
+ agerr(AGERR, "%s: can't open %s\n", gvc->cmdname, fn);
graphviz_errors++;
}
}
FORMAT_WBMP, FORMAT_XBM, } format_type;
extern int mapbool(char *);
-extern pointf Bezier(pointf *, int, double, pointf *, pointf *);
extern char *safefile(char *shapefilename);
#define BEZIERSUBDIVISION 10
static Dict_t *ImageDict;
+/* from Glassner's Graphics Gems */
+#define W_DEGREE 5
+
+/*
+ * Bezier :
+ * Evaluate a Bezier curve at a particular parameter value
+ * Fill in control points for resulting sub-curves if "Left" and
+ * "Right" are non-null.
+ *
+ */
+static pointf Bezier(pointf * V, int degree, double t, pointf * Left,
+ pointf * Right)
+{
+ int i, j; /* Index variables */
+ pointf Vtemp[W_DEGREE + 1][W_DEGREE + 1];
+
+ /* Copy control points */
+ for (j = 0; j <= degree; j++) {
+ Vtemp[0][j] = V[j];
+ }
+
+ /* Triangle computation */
+ for (i = 1; i <= degree; i++) {
+ for (j = 0; j <= degree - i; j++) {
+ Vtemp[i][j].x =
+ (1.0 - t) * Vtemp[i - 1][j].x + t * Vtemp[i - 1][j + 1].x;
+ Vtemp[i][j].y =
+ (1.0 - t) * Vtemp[i - 1][j].y + t * Vtemp[i - 1][j + 1].y;
+ }
+ }
+
+ if (Left != NULL)
+ for (j = 0; j <= degree; j++)
+ Left[j] = Vtemp[j][0];
+ if (Right != NULL)
+ for (j = 0; j <= degree; j++)
+ Right[j] = Vtemp[degree - j][j];
+
+ return (Vtemp[degree][0]);
+}
+
static void gdgen_resolve_color(GVJ_t * job, gvcolor_t * color)
{
gdImagePtr im = (gdImagePtr) job->surface;
// truecolor_p = TRUE; /* force truecolor */
if (job->external_surface) {
- if (Verbose)
- fprintf(stderr, "%s: using existing GD image\n", CmdName);
+ if (job->verbose)
+ fprintf(stderr, "%s: using existing GD image\n", job->cmdname);
im = (gdImagePtr) (job->output_file);
} else {
/* device size with margins all around */
width = ROUND(job->boundingBox.UR.x + job->boundingBox.LL.x);
height = ROUND(job->boundingBox.UR.y + job->boundingBox.LL.y);
if (truecolor_p) {
- if (Verbose)
+ if (job->verbose)
fprintf(stderr,
"%s: allocating a %dK TrueColor GD image\n",
- CmdName,
+ job->cmdname,
ROUND(width * height * 4 / 1024.));
im = gdImageCreateTrueColor(width, height);
} else {
- if (Verbose)
+ if (job->verbose)
fprintf(stderr,
"%s: allocating a %dK PaletteColor GD image\n",
- CmdName, ROUND(width * height / 1024.));
+ job->cmdname, ROUND(width * height / 1024.));
im = gdImageCreate(width, height);
}
}
job->surface = (void *) im;
if (!im) {
+#if 0
+/* FIXME - error function */
agerr(AGERR, "gdImageCreate returned NULL. Malloc problem?\n");
+#endif
return;
}