* where the floats are optional, nonnegative, sum to <= 1.
* Store the values in an array of colorseg_t's and return the array in psegs.
* If nseg == 0, count the number of colors.
+ * If the sum of the floats does not equal 1, the remainder is equally distributed
+ * to all colors without an explicit float. If no such colors exist, the remainder
+ * is added to the last color.
* 0 => okay
* 1 => error without message
* 2 => error with message
return rval;
}
+#define THIN_LINE 0.5
+
/* wedgedEllipse:
* Fill an ellipse whose bounding box is given by 2 points in pf
* with multiple wedges determined by the color spec in clrs.
colorsegs_t* segs;
colorseg_t* s;
int rv;
- int save_penwidth = job->obj->penwidth;
+ double save_penwidth = job->obj->penwidth;
pointf ctr, semi;
Ppolyline_t* pp;
double angle0, angle1;
ctr.y = (pf[0].y + pf[1].y) / 2.;
semi.x = pf[1].x - ctr.x;
semi.y = pf[1].y - ctr.y;
- gvrender_set_penwidth(job, 0.5);
+ if (save_penwidth > THIN_LINE)
+ gvrender_set_penwidth(job, THIN_LINE);
angle0 = 0;
for (s = segs->segs; s->color; s++) {
freePath (pp);
}
- gvrender_set_penwidth(job, save_penwidth);
+ if (save_penwidth > THIN_LINE)
+ gvrender_set_penwidth(job, save_penwidth);
freeSegs (segs);
return rv;
}
double xdelta;
pointf pts[4];
double lastx;
- int save_penwidth = job->obj->penwidth;
+ double save_penwidth = job->obj->penwidth;
rv = parseSegs (clrs, 0, &segs);
if ((rv == 1) || (rv == 2)) return rv;
xdelta = (pts[1].x - pts[0].x);
pts[1].x = pts[2].x = pts[0].x;
- gvrender_set_penwidth(job, 0.5);
+ if (save_penwidth > THIN_LINE)
+ gvrender_set_penwidth(job, THIN_LINE);
for (s = segs->segs; s->color; s++) {
if (s->t == 0) continue;
gvrender_set_fillcolor (job, (s->color?s->color:DEFAULT_COLOR));
gvrender_polygon(job, pts, 4, FILL);
pts[0].x = pts[3].x = pts[1].x;
}
- gvrender_set_penwidth(job, save_penwidth);
+ if (save_penwidth > THIN_LINE)
+ gvrender_set_penwidth(job, save_penwidth);
freeSegs (segs);
return rv;
}
return rv;
}
+#define multicolor(f) (strchr(f,':'))
+
/* generic polygon gencode routine */
static void poly_gencode(GVJ_t * job, node_t * n)
{
}
else if (style & (STRIPED|WEDGED)) {
fillcolor = findFill (n);
+ gvrender_set_fillcolor(job, fillcolor);
filled = TRUE;
}
else {
/* lay down fill first */
if (filled && pfilled) {
if (sides <= 2) {
- if ((style & WEDGED) && (j == 0)) {
+ if ((style & WEDGED) && (j == 0) && multicolor(fillcolor)) {
int rv = wedgedEllipse (job, AF, fillcolor);
if (rv > 1)
agerr (AGPREV, "in node %s\n", agnameof(n));
AF[i].y = P.y * ysize + ND_coord(n).y;
}
if (sides <= 2) {
- if ((style & WEDGED) && (j == 0)) {
+ if ((style & WEDGED) && (j == 0) && multicolor(fillcolor)) {
int rv = wedgedEllipse (job, AF, fillcolor);
if (rv > 1)
agerr (AGPREV, "in node %s\n", agnameof(n));