|
From: Ethan A M. <merritt@u.washington.edu> - 2007-11-22 21:00:29
|
On Thursday 22 November 2007 08:19, Allin Cottrell wrote:
>
> I'm attaching a small patch to eval.c that implements
> GPVAL_GRAPH_XMIN, GPVAL_GRAPH_XMAX, GPVAL_GRAPH_YMIN and
> GPVAL_GRAPH_YMAX. In the context of bitmapped output, these values
> should represent the pixel coordinates of the actual graph area.
>
> Those more familiar than I with the gnuplot architecture will no
> doubt be able to see if there's a better way of doing this.
>--- eval.c.orig 2007-11-22 10:16:05.000000000 -0500
>+++ eval.c 2007-11-22 11:05:46.000000000 -0500
>@@ -733,6 +733,39 @@
> Gstring(&v->udv_value, gp_strdup(stringvalue));
> }
>
>+static void update_plot_bounds (void)
>+{
>+ int xl = plot_bounds.xleft;
>+ int xr = plot_bounds.xright;
>+ int yb = plot_bounds.ybot;
>+ int yt = plot_bounds.ytop;
I think that has to be
unsigned int xl, xr, yb, yt;
struct position bottom_left = {graph, graph, graph, 0., 0., 0.};
struct position upper_right = {graph, graph, graph, 1., 1., 1.};
map_position(&bottom_left, &xl, &yb, "");
map_position(&upper_right, &xr, &yt, "");
>+ if (term != NULL && !strcmp(term->name, "pngcairo")) {
>+ /* convert to pixels */
>+ xl /= 20;
>+ xr /= 20;
>+ yb /= 20;
>+ yt /= 20;
Where did the magic number 20 come from?
If we need terminal-specific code in core routines, this approach isn't
going to work. We would have to export addition information from the
terminals, probably from term->text(). But I'm not sure we need this at all.
--
Ethan A Merritt
|