pointf imageSize; /* image size on one page of the graph - points */
pointf margin; /* margin for a page of the graph - points */
+ margin = job->margin;
+
/* unpaginated image size in device units */
imageSize = job->view;
if (job->rotation)
/* determine pagination */
if (gvc->graph_sets_pageSize) {
/* page was set by user */
- pageSize = gvc->pageSize;
+ pageSize.x = gvc->pageSize.x - 2 * margin.x;
+ pageSize.y = gvc->pageSize.y - 2 * margin.y;
/* we don't want graph page to exceed its bounding box */
pageSize.x = MIN(pageSize.x, imageSize.x);
}
job->numPages = job->pagesArraySize.x * job->pagesArraySize.y;
- /* find the drawable size in device coords */
+ /* find the drawable size in points */
imageSize.x = MIN(imageSize.x, pageSize.x);
imageSize.y = MIN(imageSize.y, pageSize.y);
} else {
/* page not set by user, assume default when centering,
but allow infinite page for any other interpretation */
- pageSize.x = DEFAULT_PAGEWD;
- pageSize.y = DEFAULT_PAGEHT;
+ pageSize.x = DEFAULT_PAGEWD - 2 * margin.x;
+ pageSize.y = DEFAULT_PAGEHT - 2 * margin.y;
job->pagesArraySize.x = job->pagesArraySize.y = job->numPages = 1;
}
- /* size of one page in graph units */
- job->pageSize.x = imageSize.x / job->zoom;
- job->pageSize.y = imageSize.y / job->zoom;
-
- PF2P(job->margin, margin);
-
/* determine page box including centering */
if (GD_drawing(g)->centered) {
if (pageSize.x > imageSize.x)
margin.y += (pageSize.y - imageSize.y) / 2;
}
+ /* canvas area, centered if necessary */
job->canvasBox.LL.x = margin.x;
job->canvasBox.LL.y = margin.y;
job->canvasBox.UR.x = margin.x + imageSize.x;
job->canvasBox.UR.y = margin.y + imageSize.y;
+ /* size of one page in graph units */
+ job->pageSize.x = imageSize.x / job->zoom;
+ job->pageSize.y = imageSize.y / job->zoom;
+
/* set up pagedir */
job->pagesArrayMajor.x = job->pagesArrayMajor.y
= job->pagesArrayMinor.x = job->pagesArrayMinor.y = 0;
pen_type pen;
fill_type fill;
double penwidth;
+ char **rawstyle;
} gvstyle_t;
#define EMIT_SORTED (1<<0)
bool external_surface; /* surface belongs to caller */
gvstyle_t *style; /* active style from gvc->styles[] */
- char **rawstyle;
int flags; /* emit_graph flags */
int rotation; /* viewport rotation (degrees) 0=portrait, 90=landscape */
pointf view; /* viewport size - points */
- box canvasBox; /* drawing area - points */
+ boxf canvasBox; /* drawing area - points */
pointf margin; /* job-specific margin - points */
pointf dpi; /* device resolution device-units-per-inch */
#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
+ box canvas;
+
+ BF2B(job->canvasBox, canvas);
if (cg && cg->begin_graph)
- cg->begin_graph(gvc, g, job->canvasBox, gvc->pb);
+ cg->begin_graph(gvc, g, canvas, gvc->pb);
}
#endif
}
char *line, *p;
gvstyle_t *style = job->style;
- job->rawstyle = s;
+ job->style->rawstyle = s;
if (gvre) {
while ((p = line = *s++)) {
if (streq(line, "solid"))