[GRASS-SVN] r33054 - in grass/trunk: display/d.barscale
display/d.colortable display/d.geodesic display/d.graph
display/d.grid display/d.legend display/d.linegraph
display/d.path display/d.rast.num display/d.rhumbline
display/d.text display/d.thematic.area display/d.vect
display/d.vect.chart include lib/display
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 24 20:24:23 EDT 2008
Author: glynn
Date: 2008-08-24 20:24:22 -0400 (Sun, 24 Aug 2008)
New Revision: 33054
Removed:
grass/trunk/display/d.graph/allocation.c
Modified:
grass/trunk/display/d.barscale/draw_scale.c
grass/trunk/display/d.colortable/main.c
grass/trunk/display/d.geodesic/main.c
grass/trunk/display/d.geodesic/plot.c
grass/trunk/display/d.graph/do_graph.c
grass/trunk/display/d.graph/main.c
grass/trunk/display/d.grid/plot.c
grass/trunk/display/d.grid/plotborder.c
grass/trunk/display/d.legend/main.c
grass/trunk/display/d.linegraph/main.c
grass/trunk/display/d.path/select.c
grass/trunk/display/d.rast.num/main.c
grass/trunk/display/d.rhumbline/plot.c
grass/trunk/display/d.text/main.c
grass/trunk/display/d.thematic.area/plot1.c
grass/trunk/display/d.vect.chart/bar.c
grass/trunk/display/d.vect.chart/pie.c
grass/trunk/display/d.vect/plot1.c
grass/trunk/include/display.h
grass/trunk/lib/display/cnversions.c
grass/trunk/lib/display/draw2.c
grass/trunk/lib/display/icon.c
grass/trunk/lib/display/setup.c
Log:
Eliminate R_* functions in favour of D_* equivalents (part 1)
Modified: grass/trunk/display/d.barscale/draw_scale.c
===================================================================
--- grass/trunk/display/d.barscale/draw_scale.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.barscale/draw_scale.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -74,11 +74,12 @@
const struct scale *scales = all_scales[use_feet];
/* Establish text size */
- D_get_dst(&t, &b, &l, &r);
- R_set_window(t, b, l, r);
size = 14;
R_text_size(size, size);
+ D_setup_unity(0);
+ D_get_src(&t, &b, &l, &r);
+
x_pos = (int)(east * (r - l) / 100.);
y_pos = (int)(north * (b - t) / 100.);
@@ -95,29 +96,23 @@
if (do_background) {
D_raster_use_color(color1);
-
- R_box_abs(pl, pt, pr, pb);
+ D_box_abs(pl, pt, pr, pb);
}
/* Draw legend */
D_raster_use_color(color2);
- R_move_abs(pl + w / 2 + 1, pt + 17 + 1);
- xarr[0] = 0;
- yarr[0] = 0;
- xarr[1] = -w / 2;
- yarr[1] = 2 * w;
- xarr[2] = w / 2;
- yarr[2] = -w / 2;
- xarr[3] = 0;
- yarr[3] = -1.5 * w;
- R_polyline_rel(xarr, yarr, 4);
+ D_move_abs(pl + w / 2 + 1, pt + 17 + 1);
+ D_cont_rel(-0.5 * w, 2.0 * w);
+ D_cont_rel( 0.5 * w, -0.5 * w);
+ D_cont_rel( 0 , -1.5 * w);
- xarr[1] = -xarr[1];
- xarr[2] = -xarr[2];
- R_polygon_rel(xarr, yarr, 4);
+ D_move_abs(pl + w / 2 + 1, pt + 17 + 1);
+ D_cont_rel( 0.5 * w, 2.0 * w);
+ D_cont_rel(-0.5 * w, -0.5 * w);
+ D_cont_rel( 0 , -1.5 * w);
/* actual text width is 81% of size? from d.legend */
- R_move_abs((int)(pl + w / 2 - 7 * .81), pt + 14);
+ D_move_abs(pl + w / 2 - 7 * .81, pt + 14);
R_text("N");
return 0;
@@ -166,83 +161,78 @@
if (do_background) {
D_raster_use_color(color1);
-
- R_box_abs(pl, pt, pr, pb);
+ D_box_abs(pl, pt, pr, pb);
}
/* Draw legend */
D_raster_use_color(color2);
if (draw != 2) {
- R_move_abs(x_pos + 5, y_pos + 20);
- R_cont_rel(0, -10);
- R_cont_rel(10, 10);
- R_cont_rel(0, -10);
- R_move_rel(-5, 14);
- R_cont_rel(0, -17);
- R_cont_rel(-2, -0);
- R_cont_rel(2, -2);
- R_cont_rel(2, 2);
- R_cont_rel(-2, -0);
+ D_move_abs(x_pos + 5, y_pos + 20);
+ D_cont_rel(0, -10);
+ D_cont_rel(10, 10);
+ D_cont_rel(0, -10);
+ D_move_rel(-5, 14);
+ D_cont_rel(0, -17);
+ D_cont_rel(-2, -0);
+ D_cont_rel(2, -2);
+ D_cont_rel(2, 2);
+ D_cont_rel(-2, -0);
}
if (draw == 2) {
- R_move_abs(x_pos + 25 - draw * 10, y_pos + 17);
+ D_move_abs(x_pos + 25 - draw * 10, y_pos + 17);
/* actual width is line_len-1+1=line_len and height is 7+1=8 */
- R_cont_rel((int)line_len - 1, 0);
- R_cont_rel(0, -7);
- R_cont_rel((int)(line_len * -1 + 1), 0);
- R_cont_rel(0, 7);
- R_move_rel(0, 1 - 4);
+ D_cont_rel(line_len - 1, 0);
+ D_cont_rel(0, -7);
+ D_cont_rel(line_len * -1 + 1, 0);
+ D_cont_rel(0, 7);
+ D_move_rel(0, 1 - 4);
for (i = 1; i <= scales[incr].seg; i++) {
- xarr[0] = 0;
- yarr[0] = 0;
- xarr[1] = (int)seg_len;
- yarr[1] = 0;
- xarr[2] = 0;
- yarr[2] = (i % 2 ? -4 : 4);
- xarr[3] = (int)-seg_len;
- yarr[3] = 0;
- xarr[4] = 0;
- yarr[4] = (i % 2 ? 4 : -4);
+ xarr[0] = 0; yarr[0] = 0;
+ xarr[1] = seg_len; yarr[1] = 0;
+ xarr[2] = 0; yarr[2] = (i % 2 ? -4 : 4);
+ xarr[3] = -seg_len; yarr[3] = 0;
+ xarr[4] = 0; yarr[4] = (i % 2 ? 4 : -4);
/* width is seg_len and height is 4 */
- R_polygon_rel(xarr, yarr, 4);
- R_move_rel((int)seg_len, 0);
+ D_polygon_rel(xarr, yarr, 4);
+ D_move_rel(seg_len, 0);
}
}
else if (do_bar) {
- R_move_abs(x_pos + 25, y_pos + 17);
+ D_move_abs(x_pos + 25, y_pos + 17);
/* actual width is line_len-1+1=line_len and height is 4+1=5 */
- R_cont_rel((int)line_len - 1, 0);
- R_cont_rel(0, -4);
- R_cont_rel((int)(line_len * -1 + 1), 0);
- R_cont_rel(0, 4);
- R_move_rel(0, 1);
+ D_cont_rel((int)line_len - 1, 0);
+ D_cont_rel(0, -4);
+ D_cont_rel((int)(line_len * -1 + 1), 0);
+ D_cont_rel(0, 4);
+ D_move_rel(0, 1);
for (i = 1; i <= scales[incr].seg; i += 2) {
/* width is seg_len and height is 5 */
- R_box_rel((int)seg_len, -5);
- R_move_rel((int)(seg_len * 2), 0);
+ D_box_rel(seg_len, -5);
+ D_move_rel(seg_len * 2, 0);
}
}
else { /* draw simple line scale */
- R_move_abs(x_pos + 25, y_pos + 5);
- R_cont_abs(x_pos + 25, y_pos + 25);
- R_move_abs(x_pos + 25, y_pos + 15);
- R_cont_abs(x_pos + 25 + (int)line_len, y_pos + 15);
- R_move_abs(x_pos + 25 + (int)line_len, y_pos + 5);
- R_cont_abs(x_pos + 25 + (int)line_len, y_pos + 25);
+ D_move_abs(x_pos + 25, y_pos + 5);
+ D_cont_abs(x_pos + 25, y_pos + 25);
+ D_move_abs(x_pos + 25, y_pos + 15);
+ D_cont_abs(x_pos + 25 + line_len, y_pos + 15);
+ D_move_abs(x_pos + 25 + line_len, y_pos + 5);
+ D_cont_abs(x_pos + 25 + line_len, y_pos + 25);
}
if (toptext) {
- R_move_abs(x_pos + 25 - draw * 10 +
- (int)(line_len / 2. -
- strlen(scales[incr].name) * size * 0.81 / 2), y_pos);
+ D_move_abs(x_pos + 25 - draw * 10 + line_len / 2.
+ - strlen(scales[incr].name) * size * 0.81 / 2,
+ y_pos);
R_text(scales[incr].name);
}
else {
- R_move_abs(x_pos + 35 - draw * 10 + (int)line_len, y_pos + 20);
+ D_move_abs(x_pos + 35 - draw * 10 + line_len, y_pos + 20);
R_text(scales[incr].name);
}
return (0);
}
+
Modified: grass/trunk/display/d.colortable/main.c
===================================================================
--- grass/trunk/display/d.colortable/main.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.colortable/main.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -146,8 +146,8 @@
if (R_open_driver() != 0)
G_fatal_error("No graphics device selected");
- /* Figure out where to put boxes */
- R_get_window(&t, &b, &l, &r);
+ D_setup_unity(0);
+ D_get_src(&t, &b, &l, &r);
G_get_fp_range_min_max(&fp_range, &dmin, &dmax);
if (G_is_d_null_value(&dmin) || G_is_d_null_value(&dmax))
@@ -176,16 +176,11 @@
dots_per_line = (b - t) / lines;
dots_per_col = (r - l) / cols;
- x_box[0] = 0;
- y_box[0] = 0;
- x_box[1] = 0;
- y_box[1] = (6 - dots_per_line);
- x_box[2] = (dots_per_col - 6);
- y_box[2] = 0;
- x_box[3] = 0;
- y_box[3] = (dots_per_line - 6);
- x_box[4] = (6 - dots_per_col);
- y_box[4] = 0;
+ x_box[0] = 0; y_box[0] = 0;
+ x_box[1] = 0; y_box[1] = (6 - dots_per_line);
+ x_box[2] = (dots_per_col - 6); y_box[2] = 0;
+ x_box[3] = 0; y_box[3] = (dots_per_line - 6);
+ x_box[4] = (6 - dots_per_col); y_box[4] = 0;
white = D_translate_color("white");
black = D_translate_color("black");
@@ -199,22 +194,22 @@
cur_dot_row += dots_per_line;
/* Draw white box */
R_standard_color(color);
- R_move_abs(cur_dot_col + 2, (cur_dot_row - 1));
- R_cont_rel(0, (2 - dots_per_line));
- R_cont_rel((dots_per_col - 2), 0);
- R_cont_rel(0, (dots_per_line - 2));
- R_cont_rel((2 - dots_per_col), 0);
+ D_move_abs(cur_dot_col + 2, (cur_dot_row - 1));
+ D_cont_rel(0, (2 - dots_per_line));
+ D_cont_rel((dots_per_col - 2), 0);
+ D_cont_rel(0, (dots_per_line - 2));
+ D_cont_rel((2 - dots_per_col), 0);
/* Draw black box */
R_standard_color(black);
- R_move_abs(cur_dot_col + 3, (cur_dot_row - 2));
- R_cont_rel(0, (4 - dots_per_line));
- R_cont_rel((dots_per_col - 4), 0);
- R_cont_rel(0, (dots_per_line - 4));
- R_cont_rel((4 - dots_per_col), 0);
+ D_move_abs(cur_dot_col + 3, (cur_dot_row - 2));
+ D_cont_rel(0, (4 - dots_per_line));
+ D_cont_rel((dots_per_col - 4), 0);
+ D_cont_rel(0, (dots_per_line - 4));
+ D_cont_rel((4 - dots_per_col), 0);
/* Color box */
D_color((CELL) atcat, &colors);
- R_move_abs(cur_dot_col + 4, (cur_dot_row - 3));
- R_polygon_rel(x_box, y_box, 5);
+ D_move_abs(cur_dot_col + 4, (cur_dot_row - 3));
+ D_polygon_rel(x_box, y_box, 5);
count++;
/* first cat number is null value */
@@ -233,18 +228,18 @@
cur_dot_col = l;
/* Draw white box */
R_standard_color(color);
- R_move_abs(cur_dot_col + 2, (cur_dot_row - 1));
- R_cont_rel(0, (2 - dots_per_line));
- R_cont_rel((dots_per_col - 2), 0);
- R_cont_rel(0, (dots_per_line - 2));
- R_cont_rel((2 - dots_per_col), 0);
+ D_move_abs(cur_dot_col + 2, (cur_dot_row - 1));
+ D_cont_rel(0, (2 - dots_per_line));
+ D_cont_rel((dots_per_col - 2), 0);
+ D_cont_rel(0, (dots_per_line - 2));
+ D_cont_rel((2 - dots_per_col), 0);
/* Draw black box */
R_standard_color(black);
- R_move_abs(cur_dot_col + 3, (cur_dot_row - 2));
- R_cont_rel(0, (4 - dots_per_line));
- R_cont_rel((dots_per_col - 4), 0);
- R_cont_rel(0, (dots_per_line - 4));
- R_cont_rel((4 - dots_per_col), 0);
+ D_move_abs(cur_dot_col + 3, (cur_dot_row - 2));
+ D_cont_rel(0, (4 - dots_per_line));
+ D_cont_rel((dots_per_col - 4), 0);
+ D_cont_rel(0, (dots_per_line - 4));
+ D_cont_rel((4 - dots_per_col), 0);
/* Color ramp box */
/* get separate color for each pixel */
@@ -259,8 +254,8 @@
dval =
dmin + (r - 1) * (dmax - dmin) / (dots_per_line - 6 - 5);
D_d_color(dval, &colors);
- R_move_abs(cur_dot_col + 4, (cur_dot_row - 3) - r);
- R_polygon_rel(x_box, y_box, 5);
+ D_move_abs(cur_dot_col + 4, (cur_dot_row - 3) - r);
+ D_polygon_rel(x_box, y_box, 5);
}
}
Modified: grass/trunk/display/d.geodesic/main.c
===================================================================
--- grass/trunk/display/d.geodesic/main.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.geodesic/main.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -31,7 +31,6 @@
int line_color;
int text_color;
double lon1, lat1, lon2, lat2;
- char msg[100];
char *deftcolor;
struct GModule *module;
struct
Modified: grass/trunk/display/d.geodesic/plot.c
===================================================================
--- grass/trunk/display/d.geodesic/plot.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.geodesic/plot.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -18,20 +18,15 @@
int setup_plot(void)
{
double a, e2;
- double t, b, l, r;
/* establish the current graphics window */
- D_setup(0);
-
- D_get_dst(&t, &b, &l, &r);
- D_set_src(t, b, l, r);
- D_update_conversions();
- /* set D clip window */
+ D_setup_unity(0);
D_clip_to_map();
/* setup the G plot to use the D routines */
- G_setup_plot(D_get_d_north(),
- D_get_d_south(), D_get_d_west(), D_get_d_east(), move, cont);
+ G_setup_plot(D_get_d_north(), D_get_d_south(),
+ D_get_d_west(), D_get_d_east(),
+ move, cont);
G_get_ellipsoid_parameters(&a, &e2);
G_begin_geodesic_distance(a, e2);
@@ -72,7 +67,7 @@
text_y = D_get_d_north() - 10;
if (text_x + 10 * strlen(buf) >= D_get_d_east())
text_x = D_get_d_east() - 10 * strlen(buf);
- R_move_abs(text_x, text_y);
+ D_move_abs(text_x, text_y);
R_standard_color(text_color);
R_text(buf);
R_flush();
Deleted: grass/trunk/display/d.graph/allocation.c
===================================================================
--- grass/trunk/display/d.graph/allocation.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.graph/allocation.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -1,11 +0,0 @@
-#include <grass/gis.h>
-
-void *falloc(int nelem, int elsize)
-{
- return G_calloc(nelem, elsize);
-}
-
-void *frealloc(void *oldptr, int nelem, int elsize)
-{
- return G_realloc(oldptr, nelem * elsize);
-}
Modified: grass/trunk/display/d.graph/do_graph.c
===================================================================
--- grass/trunk/display/d.graph/do_graph.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.graph/do_graph.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -22,15 +22,23 @@
static RGBA_Color last_color;
+static double t, b, l, r;
+
int set_graph_stuff(void)
{
- xincr = (float)(r - l) / 100.;
- if (xincr < 0.0)
- xincr = -xincr; /* mod: shapiro 13 jun 1991 */
- yincr = (float)(b - t) / 100.;
- if (yincr < 0.0)
- yincr = -yincr; /* mod: shapiro 13 jun 1991 */
+ D_get_dst(&t, &b, &l, &r);
+ if (mapunits) {
+ xincr = (r - l) / 100.;
+ if (xincr < 0.0)
+ xincr = -xincr; /* mod: shapiro 13 jun 1991 */
+ yincr = (b - t) / 100.;
+ if (yincr < 0.0)
+ yincr = -yincr; /* mod: shapiro 13 jun 1991 */
+ }
+ else
+ xincr = yincr = 1;
+
rotation = 0.0; /* init */
return 0;
@@ -55,21 +63,7 @@
return (-1);
}
- if (mapunits) {
- /* skip check: clips segments if map coordinate is out of region.
- if( xper < D_get_u_west() ||
- yper < D_get_u_south() ||
- xper > D_get_u_east() ||
- yper > D_get_u_north() )
- return(-1);
- */
- D_cont_abs(xper, yper);
- }
- else {
- if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
- return (-1);
- R_cont_abs(l + xper * xincr, b - yper * yincr);
- }
+ D_cont_abs(xper, yper);
return (0);
}
@@ -83,13 +77,7 @@
return (-1);
}
- if (mapunits)
- D_move_abs(xper, yper);
- else {
- if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
- return (-1);
- R_move_abs(l + xper * xincr, b - yper * yincr);
- }
+ D_move_abs(xper, yper);
return (0);
}
@@ -169,20 +157,10 @@
break;
}
- if (!mapunits) {
- if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
- break;
- }
check_alloc(num + 1);
- if (mapunits) {
- xarray[num] = D_u_to_d_col(xper);
- yarray[num] = D_u_to_d_row(yper);
- }
- else {
- xarray[num] = l + xper * xincr;
- yarray[num] = b - yper * yincr;
- }
+ xarray[num] = xper;
+ yarray[num] = yper;
num++;
}
@@ -191,9 +169,9 @@
/* this check is here so you can use the "polyline" command
to make an unfilled polygon */
if (!strcmp(origcmd, "polygon"))
- R_polygon_abs(xarray, yarray, num);
+ D_polygon_abs(xarray, yarray, num);
else
- R_polyline_abs(xarray, yarray, num);
+ D_polyline_abs(xarray, yarray, num);
}
return (to_return);
@@ -232,7 +210,7 @@
return (-1);
}
- R_text_rotation((float)rotation);
+ R_text_rotation(rotation);
G_debug(3, "rotation set to %.1f degrees", rotation);
return (0);
@@ -259,17 +237,11 @@
return 0;
to_alloc = coors_allocated;
- while (num >= to_alloc)
- to_alloc += CHUNK;
+ if (num >= to_alloc)
+ to_alloc = num + CHUNK;
- if (coors_allocated == 0) {
- xarray = falloc(to_alloc, sizeof(double));
- yarray = falloc(to_alloc, sizeof(double));
- }
- else {
- xarray = frealloc(xarray, to_alloc, sizeof(double));
- yarray = frealloc(yarray, to_alloc, sizeof(double));
- }
+ xarray = G_realloc(xarray, to_alloc * sizeof(double));
+ yarray = G_realloc(yarray, to_alloc * sizeof(double));
coors_allocated = to_alloc;
@@ -288,40 +260,30 @@
return (-1);
}
- if (mapunits) {
- ix = D_u_to_d_col(xper);
- iy = D_u_to_d_row(yper);
- /* size in map units too? currently in percentage.
- use "size * D_get_u_to_d_yconv()" to convert? */
- }
- else {
- if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
- return (-1);
+ ix = xper;
+ iy = yper;
+ size *= yincr;
- ix = l + xper * xincr;
- iy = b - yper * yincr;
- }
-
switch (type & 0177) {
case 'o':
- R_move_abs(ix - size, iy - size);
- R_cont_abs(ix - size, iy + size);
- R_cont_abs(ix + size, iy + size);
- R_cont_abs(ix + size, iy - size);
- R_cont_abs(ix - size, iy - size);
+ D_move_abs(ix - size, iy - size);
+ D_cont_abs(ix - size, iy + size);
+ D_cont_abs(ix + size, iy + size);
+ D_cont_abs(ix + size, iy - size);
+ D_cont_abs(ix - size, iy - size);
break;
case 'x':
- R_move_abs(ix - size, iy - size);
- R_cont_abs(ix + size, iy + size);
- R_move_abs(ix - size, iy + size);
- R_cont_abs(ix + size, iy - size);
+ D_move_abs(ix - size, iy - size);
+ D_cont_abs(ix + size, iy + size);
+ D_move_abs(ix - size, iy + size);
+ D_cont_abs(ix + size, iy - size);
break;
case '+':
default:
- R_move_abs(ix, iy - size);
- R_cont_abs(ix, iy + size);
- R_move_abs(ix - size, iy);
- R_cont_abs(ix + size, iy);
+ D_move_abs(ix, iy - size);
+ D_cont_abs(ix, iy + size);
+ D_move_abs(ix - size, iy);
+ D_cont_abs(ix + size, iy);
break;
}
return (0);
@@ -359,18 +321,9 @@
return (-1);
}
- if (mapunits) {
- ix = D_u_to_d_col(xper);
- iy = D_u_to_d_row(yper);
- /* consider size in map units too? maybe as percentage of display?
- perhaps use "size * D_get_u_to_d_yconv()" to convert */
- }
- else {
- if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
- return (-1);
- ix = l + xper * xincr;
- iy = b - yper * yincr;
- }
+ ix = D_u_to_d_col(xper);
+ iy = D_u_to_d_row(yper);
+ size *= yincr;
/* parse line color */
ret = G_str_to_color(line_color_str, &R, &G, &B);
Modified: grass/trunk/display/d.graph/main.c
===================================================================
--- grass/trunk/display/d.graph/main.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.graph/main.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -40,7 +40,6 @@
float hsize;
float vsize;
-double t, b, l, r;
int mapunits;
FILE *infile;
@@ -114,22 +113,20 @@
set_last_color(0, 0, 0, RGBA_COLOR_NONE);
}
- if (mapcoords->answer)
+ if (mapcoords->answer) {
mapunits = TRUE;
- else
+ D_setup(0);
+ }
+ else {
+ D_setup2(0, 0, 0, 100, 0, 100);
mapunits = FALSE;
+ }
- D_setup(0);
- D_get_dst(&t, &b, &l, &r);
-
/* Do the graphics */
set_graph_stuff();
set_text_size();
graphics(infile);
- R_text_rotation(0.0); /* reset */
- R_line_width(0); /* reset */
-
R_close_driver();
exit(EXIT_SUCCESS);
Modified: grass/trunk/display/d.grid/plot.c
===================================================================
--- grass/trunk/display/d.grid/plot.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.grid/plot.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -38,7 +38,7 @@
if (mark_type == MARK_GRID) {
D_raster_use_color(gcolor);
- D_line(x, window.north, x, window.south);
+ D_line_abs(x, window.north, x, window.south);
}
if (do_text) {
@@ -52,9 +52,9 @@
y: End of text is 7 pixels up from bottom of screen, +.5 rounding.
fontsize*.81 = actual text width FOR DEFAULT FONT (NOT FreeType)
*/
- R_move_abs((int)(D_u_to_d_col(x) + 4 + .5),
- (int)(D_get_d_south() -
- (strlen(text) * fontsize * 0.81) - 7 + 0.5));
+ D_move_abs(x + 4.5 * D_get_d_to_u_xconv(),
+ D_get_u_south()
+ - D_get_d_to_u_yconv() * (strlen(text) * fontsize * 0.81) - 7.5);
R_text(text);
}
@@ -80,9 +80,9 @@
while (y <= window.north) {
if (mark_type == MARK_GRID) {
D_raster_use_color(gcolor);
- D_line(window.east, y, e1, y);
- D_line(e1, y, e2, y);
- D_line(e2, y, window.west, y);
+ D_line_abs(window.east, y, e1, y);
+ D_line_abs(e1, y, e2, y);
+ D_line_abs(e2, y, window.west, y);
}
if (do_text) {
@@ -95,9 +95,10 @@
fontsize*.81 = actual text width FOR DEFAULT FONT (NOT FreeType)
y: 4 pixels above each grid line, +.5 rounding.
*/
- R_move_abs((int)
- (D_get_d_east() - (strlen(text) * fontsize * 0.81) -
- 7 + 0.5), (int)(D_u_to_d_row(y) - 4 + .5));
+ D_move_abs(
+ D_get_u_east()
+ - D_get_d_to_u_xconv() * (strlen(text) * fontsize * 0.81 - 7.5),
+ y + D_get_d_to_u_yconv() * 4.5);
R_text(text);
}
@@ -199,7 +200,7 @@
start_coord = n1;
font_angle = get_heading((e1 - e2), (n1 - n2));
}
- D_line(e1, n1, e2, n2);
+ D_line_abs(e1, n1, e2, n2);
}
if (do_text) {
@@ -209,8 +210,8 @@
G_format_northing(g, text, PROJECTION_LL);
R_text_rotation(font_angle);
R_text_size(fontsize, fontsize);
- R_move_abs((int)(D_get_d_west() + border_off),
- (int)(D_u_to_d_row(start_coord) - grid_off));
+ D_move_abs(D_get_u_west() + D_get_d_to_u_xconv() * border_off,
+ start_coord - D_get_d_to_u_yconv() * grid_off);
R_text(text);
}
}
@@ -252,7 +253,7 @@
start_coord = e1;
}
- D_line(e1, n1, e2, n2);
+ D_line_abs(e1, n1, e2, n2);
}
if (do_text) {
/* Set text color */
@@ -261,8 +262,8 @@
G_format_easting(g, text, PROJECTION_LL);
R_text_rotation(font_angle);
R_text_size(fontsize, fontsize);
- R_move_abs((int)(D_u_to_d_col(start_coord) + grid_off + 1.5),
- (int)(D_get_d_north() + border_off));
+ D_move_abs(start_coord + D_get_d_to_u_xconv() * (grid_off + 1.5),
+ D_get_u_north() + D_get_d_to_u_yconv() * border_off);
R_text(text);
}
}
Modified: grass/trunk/display/d.grid/plotborder.c
===================================================================
--- grass/trunk/display/d.grid/plotborder.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.grid/plotborder.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -25,12 +25,12 @@
/* plot boundary lines: */
/* horizontal : */
- D_line(window.west, window.south, window.east, window.south);
- D_line(window.west, window.north, window.east, window.north);
+ D_line_abs(window.west, window.south, window.east, window.south);
+ D_line_abs(window.west, window.north, window.east, window.north);
/* vertical : */
- D_line(window.west, window.south, window.west, window.north);
- D_line(window.east, window.south, window.east, window.north);
+ D_line_abs(window.west, window.south, window.west, window.north);
+ D_line_abs(window.east, window.south, window.east, window.north);
/* Draw vertical border marks */
if (window.west < east)
@@ -42,16 +42,16 @@
loop = 0;
for (i = 0; i <= grid_size; i = i + steps) {
if (loop == 0) {
- D_line(x + i, window.south + (window.north - window.south) / longmark, x + i, window.south);
- D_line(x + i, window.north, x + i, window.north - (window.north - window.south) / longmark);
+ D_line_abs(x + i, window.south + (window.north - window.south) / longmark, x + i, window.south);
+ D_line_abs(x + i, window.north, x + i, window.north - (window.north - window.south) / longmark);
}
if (loop == 5) {
- D_line(x + i,window.south + (window.north - window.south) / middlemark, x + i, window.south);
- D_line(x + i, window.north, x + i, window.north - (window.north - window.south) / middlemark);
+ D_line_abs(x + i,window.south + (window.north - window.south) / middlemark, x + i, window.south);
+ D_line_abs(x + i, window.north, x + i, window.north - (window.north - window.south) / middlemark);
}
else {
- D_line(x + i, window.south + (window.north - window.south) / shortmark, x + i, window.south);
- D_line(x + i, window.north, x + i, window.north - (window.north - window.south) / shortmark);
+ D_line_abs(x + i, window.south + (window.north - window.south) / shortmark, x + i, window.south);
+ D_line_abs(x + i, window.north, x + i, window.north - (window.north - window.south) / shortmark);
}
loop++;
}
@@ -69,16 +69,16 @@
loop = 0;
for (i = 0; i <= grid_size; i = i + steps) {
if (loop == 0) {
- D_line(window.west, y + i, window.west + (window.east - window.west) / longmark, y + i);
- D_line(window.east - (window.east - window.west) / longmark, y + i, window.east, y + i);
+ D_line_abs(window.west, y + i, window.west + (window.east - window.west) / longmark, y + i);
+ D_line_abs(window.east - (window.east - window.west) / longmark, y + i, window.east, y + i);
}
if (loop == 5) {
- D_line(window.west, y + i, window.west + (window.east - window.west) / middlemark, y + i);
- D_line(window.east - (window.east - window.west) / middlemark, y + i, window.east, y + i);
+ D_line_abs(window.west, y + i, window.west + (window.east - window.west) / middlemark, y + i);
+ D_line_abs(window.east - (window.east - window.west) / middlemark, y + i, window.east, y + i);
}
else {
- D_line(window.west, y + i, window.west + (window.east - window.west) / shortmark, y + i);
- D_line(window.east - (window.east - window.west) / shortmark, y + i, window.east, y + i);
+ D_line_abs(window.west, y + i, window.west + (window.east - window.west) / shortmark, y + i);
+ D_line_abs(window.east - (window.east - window.west) / shortmark, y + i, window.east, y + i);
}
loop++;
}
Modified: grass/trunk/display/d.legend/main.c
===================================================================
--- grass/trunk/display/d.legend/main.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.legend/main.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -271,8 +271,8 @@
black = D_translate_color(DEFAULT_BG_COLOR);
/* Figure out where to put text */
- D_setup(0);
- D_get_dst(&t, &b, &l, &r);
+ D_setup_unity(0);
+ D_get_src(&t, &b, &l, &r);
if (opt7->answer != NULL) {
sscanf(opt7->answers[0], "%lf", &Y1);
@@ -583,10 +583,10 @@
}
if (dx < dy)
- R_box_abs(x0 + k, y0, x0 + k + (dx ? -dx : 1),
+ D_box_abs(x0 + k, y0, x0 + k + (dx ? -dx : 1),
y0 - (dy ? -dy : 1));
else
- R_box_abs(x0, y0 + k, x0 - (dx ? -dx : 1),
+ D_box_abs(x0, y0 + k, x0 - (dx ? -dx : 1),
y0 + k + (dy ? -dy : 1));
}
@@ -668,23 +668,23 @@
if (!horiz) {
if (!k) /* first */
- R_move_abs(x1 + 4, y0 + txsiz);
+ D_move_abs(x1 + 4, y0 + txsiz);
else if (k == steps - 1) /* last */
- R_move_abs(x1 + 4, y1);
+ D_move_abs(x1 + 4, y1);
else
- R_move_abs(x1 + 4, y0 + ppl * k + txsiz / 2);
+ D_move_abs(x1 + 4, y0 + ppl * k + txsiz / 2);
}
else {
/* text width is 0.81 of text height? so even though we set width
to txsiz with R_text_size(), we still have to reduce.. hmmm */
if (!k) /* first */
- R_move_abs(x0 - (strlen(buff) * txsiz * .81 / 2),
+ D_move_abs(x0 - (strlen(buff) * txsiz * .81 / 2),
y1 + 4 + txsiz);
else if (k == steps - 1) /* last */
- R_move_abs(x1 - (strlen(buff) * txsiz * .81 / 2),
+ D_move_abs(x1 - (strlen(buff) * txsiz * .81 / 2),
y1 + 4 + txsiz);
else
- R_move_abs(x0 + ppl * k -
+ D_move_abs(x0 + ppl * k -
(strlen(buff) * txsiz * .81 / 2),
y1 + 4 + txsiz);
}
@@ -698,19 +698,19 @@
/* Black box */
R_standard_color(black);
- R_move_abs(x0 + 1, y0 + 1);
- R_cont_rel(0, lleg - 2);
- R_cont_rel(wleg - 2, 0);
- R_cont_rel(0, 2 - lleg);
- R_cont_rel(2 - wleg, 0);
+ D_move_abs(x0 + 1, y0 + 1);
+ D_cont_rel(0, lleg - 2);
+ D_cont_rel(wleg - 2, 0);
+ D_cont_rel(0, 2 - lleg);
+ D_cont_rel(2 - wleg, 0);
/* White box */
R_standard_color(white);
- R_move_abs(x0, y0);
- R_cont_rel(0, lleg);
- R_cont_rel(wleg, 0);
- R_cont_rel(0, -lleg);
- R_cont_rel(-wleg, 0);
+ D_move_abs(x0, y0);
+ D_cont_rel(0, lleg);
+ D_cont_rel(wleg, 0);
+ D_cont_rel(0, -lleg);
+ D_cont_rel(-wleg, 0);
}
else { /* non FP, no smoothing */
@@ -726,7 +726,7 @@
r = x1;
b = y1;
- R_move_abs(x0, y0);
+ D_move_abs(x0, y0);
/* figure out box height */
if (do_cats == cats_num)
@@ -797,19 +797,19 @@
/* White box */
R_standard_color(white);
cur_dot_row += dots_per_line;
- R_move_abs(l + 2, (cur_dot_row - 1));
- R_cont_rel(0, (2 - dots_per_line));
- R_cont_rel((dots_per_line - 2), 0);
- R_cont_rel(0, (dots_per_line - 2));
- R_cont_rel((2 - dots_per_line), 0);
+ D_move_abs(l + 2, (cur_dot_row - 1));
+ D_cont_rel(0, (2 - dots_per_line));
+ D_cont_rel((dots_per_line - 2), 0);
+ D_cont_rel(0, (dots_per_line - 2));
+ D_cont_rel((2 - dots_per_line), 0);
/* Black box */
R_standard_color(black);
- R_move_abs(l + 3, (cur_dot_row - 2));
- R_cont_rel(0, (4 - dots_per_line));
- R_cont_rel((dots_per_line - 4), 0);
- R_cont_rel(0, (dots_per_line - 4));
- R_cont_rel((4 - dots_per_line), 0);
+ D_move_abs(l + 3, (cur_dot_row - 2));
+ D_cont_rel(0, (4 - dots_per_line));
+ D_cont_rel((dots_per_line - 4), 0);
+ D_cont_rel(0, (dots_per_line - 4));
+ D_cont_rel((4 - dots_per_line), 0);
/* Color solid box */
if (!fp) {
@@ -826,8 +826,8 @@
D_d_color(catlist[catlistCount - i - 1], &colors);
}
- R_move_abs(l + 4, (cur_dot_row - 2));
- R_polygon_rel(x_box, y_box, 5);
+ D_move_abs(l + 4, (cur_dot_row - 2));
+ D_polygon_rel(x_box, y_box, 5);
/* Draw text */
R_standard_color(color);
@@ -855,7 +855,7 @@
sprintf(buff, DispFormat, catlist[catlistCount - i - 1]);
}
- R_move_abs((l + 3 + dots_per_line), (cur_dot_row) - 3);
+ D_move_abs((l + 3 + dots_per_line), (cur_dot_row) - 3);
R_text(buff);
}
@@ -877,7 +877,7 @@
R_text_size(txsiz, txsiz);
}
R_standard_color(white);
- R_move_abs((l + 3 + dots_per_line), (cur_dot_row));
+ D_move_abs((l + 3 + dots_per_line), (cur_dot_row));
R_text(buff);
}
}
Modified: grass/trunk/display/d.linegraph/main.c
===================================================================
--- grass/trunk/display/d.linegraph/main.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.linegraph/main.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -51,10 +51,10 @@
int main(int argc, char **argv)
{
- int xoffset; /* offset for x-axis */
- int yoffset; /* offset for y-axis */
- int text_height;
- int text_width;
+ double xoffset; /* offset for x-axis */
+ double yoffset; /* offset for y-axis */
+ double text_height;
+ double text_width;
int i;
int j;
int c;
@@ -65,8 +65,8 @@
int tic_unit;
double t, b, l, r;
double tt, tb, tl, tr;
- int prev_x, prev_y[11];
- int new_x, new_y[11];
+ double prev_x, prev_y[11];
+ double new_x, new_y[11];
int line;
double x_line[3];
double y_line[3];
@@ -249,18 +249,18 @@
/* get coordinates of current screen window, in pixels */
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- D_setup(0);
- D_get_dst(&t, &b, &l, &r);
+ D_setup_unity(0);
+ D_get_src(&t, &b, &l, &r);
/* create axis lines, to be drawn later */
height = b - t;
width = r - l;
- x_line[0] = x_line[1] = l + (int)(ORIGIN_X * width);
- x_line[2] = l + (int)(XAXIS_END * width);
- y_line[0] = b - (int)(YAXIS_END * height);
- y_line[1] = y_line[2] = b - (int)(ORIGIN_Y * height);
- text_height = (int)(b - t) * TEXT_HEIGHT;
- text_width = (int)(r - l) * TEXT_WIDTH;
+ x_line[0] = x_line[1] = l + (ORIGIN_X * width);
+ x_line[2] = l + (XAXIS_END * width);
+ y_line[0] = b - (YAXIS_END * height);
+ y_line[1] = y_line[2] = b - (ORIGIN_Y * height);
+ text_height = (b - t) * TEXT_HEIGHT;
+ text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
/* read thru each data file in turn, find max and min values for
@@ -380,18 +380,18 @@
if (min_y >= 0)
new_y[i] =
- (int)(yoffset - yscale * (in[i].value - min_y));
+ (yoffset - yscale * (in[i].value - min_y));
/* if our minimum value of y is negative, then we have two
cases: our current value to plot is pos or neg */
else {
if (in[i].value < 0)
- new_y[i] = (int)(yoffset - yscale * (-1 *
+ new_y[i] = (yoffset - yscale * (-1 *
(min_y -
in[i].value)));
else
- new_y[i] = (int)(yoffset - yscale * (in[i].value +
+ new_y[i] = (yoffset - yscale * (in[i].value +
(min_y * -1)));
}
@@ -400,8 +400,8 @@
prev_x = xoffset;
prev_y[i] = yoffset;
}
- R_move_abs(prev_x, prev_y[i]);
- R_cont_abs(new_x, new_y[i]);
+ D_move_abs(prev_x, prev_y[i]);
+ D_cont_abs(new_x, new_y[i]);
prev_y[i] = new_y[i];
}
}
@@ -414,9 +414,9 @@
/* draw a numbered tic-mark */
R_standard_color(title_color);
- R_move_abs((int)(xoffset + line * xscale),
- (int)(b - ORIGIN_Y * (b - t)));
- R_cont_rel((int)0, (int)(BIG_TIC * (b - t)));
+ D_move_abs((xoffset + line * xscale),
+ (b - ORIGIN_Y * (b - t)));
+ D_cont_rel(0, (BIG_TIC * (b - t)));
if ((in[0].value >= 1) || (in[0].value <= -1) ||
(in[0].value == 0))
sprintf(txt, "%.0f", (in[0].value / tic_unit));
@@ -432,8 +432,8 @@
R_text_size(text_width, text_height);
R_get_text_box(txt, &tt, &tb, &tl, &tr);
}
- R_move_abs((int)(xoffset + (line * xscale - (tr - tl) / 2)),
- (int)(b - XNUMS_Y * (b - t)));
+ D_move_abs((xoffset + (line * xscale - (tr - tl) / 2)),
+ (b - XNUMS_Y * (b - t)));
R_text(txt);
}
else if (rem(line, tic_unit) == (float)0) {
@@ -441,9 +441,9 @@
/* draw a tic-mark */
R_standard_color(title_color);
- R_move_abs((int)(xoffset + line * xscale),
- (int)(b - ORIGIN_Y * (b - t)));
- R_cont_rel((int)0, (int)(SMALL_TIC * (b - t)));
+ D_move_abs((xoffset + line * xscale),
+ (b - ORIGIN_Y * (b - t)));
+ D_cont_rel(0, (SMALL_TIC * (b - t)));
}
}
@@ -461,8 +461,8 @@
text_width = (r - l) * TEXT_WIDTH * 1.5;
R_text_size(text_width, text_height);
R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
- R_move_abs((int)(l + (r - l) / 2 - (tr - tl) / 2),
- (int)(b - LABEL_1 * (b - t)));
+ D_move_abs((l + (r - l) / 2 - (tr - tl) / 2),
+ (b - LABEL_1 * (b - t)));
R_standard_color(title_color);
R_text(xlabel);
@@ -492,8 +492,8 @@
if (rem(i, tic_every) == (float)0) {
/* draw a tic-mark */
- R_move_abs((int)x_line[0], (int)(yoffset - yscale * (i - min_y)));
- R_cont_rel((int)(-(r - l) * BIG_TIC), (int)0);
+ D_move_abs(x_line[0], (yoffset - yscale * (i - min_y)));
+ D_cont_rel((-(r - l) * BIG_TIC), 0);
/* draw a tic-mark number */
@@ -508,16 +508,16 @@
R_text_size(text_width, text_height);
R_get_text_box(txt, &tt, &tb, &tl, &tr);
}
- R_move_abs((int)(l + (r - l) * YNUMS_X - (tr - tl) / 2),
- (int)(yoffset -
+ D_move_abs((l + (r - l) * YNUMS_X - (tr - tl) / 2),
+ (yoffset -
(yscale * (i - min_y) + 0.5 * (tt - tb))));
R_text(txt);
}
else if (rem(i, tic_unit) == (float)0) {
/* draw a tic-mark */
- R_move_abs((int)x_line[0], (int)(yoffset - yscale * (i - min_y)));
- R_cont_rel((int)(-(r - l) * SMALL_TIC), (int)0);
+ D_move_abs(x_line[0], (yoffset - yscale * (i - min_y)));
+ D_cont_rel((-(r - l) * SMALL_TIC), 0);
}
}
@@ -530,8 +530,8 @@
text_width = (r - l) * TEXT_WIDTH * 1.5;
R_text_size(text_width, text_height);
R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
- R_move_abs((int)(l + (r - l) / 2 - (tr - tl) / 2),
- (int)(b - LABEL_2 * (b - t)));
+ D_move_abs((l + (r - l) / 2 - (tr - tl) / 2),
+ (b - LABEL_2 * (b - t)));
R_standard_color(title_color);
R_text(xlabel);
@@ -545,8 +545,8 @@
R_move_abs((int)(((r-l)/2)-(tr-tl)/2),
(int) (t+ (b-t)*.07) );
*/
- R_move_abs((int)(l + (r - l) / 2 - (tr - tl) / 2),
- (int)(t + (b - t) * .07));
+ D_move_abs((l + (r - l) / 2 - (tr - tl) / 2),
+ (t + (b - t) * .07));
R_standard_color(title_color);
R_text(xlabel);
Modified: grass/trunk/display/d.path/select.c
===================================================================
--- grass/trunk/display/d.path/select.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.path/select.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -31,7 +31,7 @@
if (be_bold)
D_line_width(2);
- D_polyline(&Points->x[from], &Points->y[from], to - from);
+ D_polyline_abs(&Points->x[from], &Points->y[from], to - from);
if (be_bold)
R_line_width(0);
Modified: grass/trunk/display/d.rast.num/main.c
===================================================================
--- grass/trunk/display/d.rast.num/main.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.rast.num/main.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -271,9 +271,9 @@
R_move_abs(D_x+(int)(D_ew*0.1),D_y+(int)(D_ns*0.5)) ;
R_move_abs(D_x,D_y+(int)(dots_per_line - 1)) ;
*/
- x = D_a_to_d_col(col + 0.5);
- y = D_a_to_d_row(row + 0.7);
- R_move_abs(x - (tr - tl) / 2, y);
+ x = D_a_to_u_col(col + 0.5);
+ y = D_a_to_u_row(row + 0.7);
+ D_move_abs(x - (tr - tl) / 2, y);
R_text(no);
return 0;
Modified: grass/trunk/display/d.rhumbline/plot.c
===================================================================
--- grass/trunk/display/d.rhumbline/plot.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.rhumbline/plot.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -12,7 +12,7 @@
int setup_plot(void)
{
/* establish the current graphics window */
- D_setup(0);
+ D_setup_unity(0);
/* setup the G plot to use the D routines */
G_setup_plot(D_get_d_north(),
@@ -46,14 +46,14 @@
static int cont(int x, int y)
{
- R_cont_abs(x, y);
+ D_cont_abs(x, y);
return 0;
}
static int move(int x, int y)
{
- R_move_abs(x, y);
+ D_move_abs(x, y);
return 0;
}
Modified: grass/trunk/display/d.text/main.c
===================================================================
--- grass/trunk/display/d.text/main.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.text/main.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -288,10 +288,10 @@
if (opt.charset->answer)
R_encoding(opt.charset->answer);
- D_setup(0);
+ D_setup_unity(0);
/* figure out where to put text */
- D_get_dst(&win.t, &win.b, &win.l, &win.r);
+ D_get_src(&win.t, &win.b, &win.l, &win.r);
if (flag.s->answer)
size = atof(opt.size->answer);
@@ -648,13 +648,13 @@
}
}
- R_move_abs(*x, *y);
+ D_move_abs(*x, *y);
R_text(text);
if (bold) {
- R_move_abs(*x, *y + 1);
+ D_move_abs(*x, *y + 1);
R_text(text);
- R_move_abs(*x + 1, *y);
+ D_move_abs(*x + 1, *y);
R_text(text);
}
Modified: grass/trunk/display/d.thematic.area/plot1.c
===================================================================
--- grass/trunk/display/d.thematic.area/plot1.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.thematic.area/plot1.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -45,13 +45,13 @@
{
switch (render) {
case RENDER_DP:
- D_polyline(xf, yf, n);
+ D_polyline_abs(xf, yf, n);
break;
case RENDER_DPC:
- D_polyline_clip(xf, yf, n);
+ D_polyline_abs_clip(xf, yf, n);
break;
case RENDER_DPL:
- D_polyline_cull(xf, yf, n);
+ D_polyline_abs_cull(xf, yf, n);
break;
}
}
@@ -63,13 +63,13 @@
{
switch (render) {
case RENDER_DP:
- D_polygon(xf, yf, n);
+ D_polygon_abs(xf, yf, n);
break;
case RENDER_DPC:
- D_polygon_clip(xf, yf, n);
+ D_polygon_abs_clip(xf, yf, n);
break;
case RENDER_DPL:
- D_polygon_cull(xf, yf, n);
+ D_polygon_abs_cull(xf, yf, n);
break;
}
}
@@ -447,7 +447,7 @@
/* Plot the lines */
if (Points->n_points == 1) /* line with one coor */
- D_polydots_clip(x, y, Points->n_points);
+ D_polydots_abs_clip(x, y, Points->n_points);
else /*use different user defined render methods */
plot_polyline(x, y, Points->n_points);
}
Modified: grass/trunk/display/d.vect/plot1.c
===================================================================
--- grass/trunk/display/d.vect/plot1.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.vect/plot1.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -45,13 +45,13 @@
{
switch (render) {
case RENDER_DP:
- D_polyline(xf, yf, n);
+ D_polyline_abs(xf, yf, n);
break;
case RENDER_DPC:
- D_polyline_clip(xf, yf, n);
+ D_polyline_abs_clip(xf, yf, n);
break;
case RENDER_DPL:
- D_polyline_cull(xf, yf, n);
+ D_polyline_abs_cull(xf, yf, n);
break;
}
}
@@ -63,13 +63,13 @@
{
switch (render) {
case RENDER_DP:
- D_polygon(xf, yf, n);
+ D_polygon_abs(xf, yf, n);
break;
case RENDER_DPC:
- D_polygon_clip(xf, yf, n);
+ D_polygon_abs_clip(xf, yf, n);
break;
case RENDER_DPL:
- D_polygon_cull(xf, yf, n);
+ D_polygon_abs_cull(xf, yf, n);
break;
}
}
@@ -466,7 +466,7 @@
/* Plot the lines */
if (Points->n_points == 1) /* line with one coor */
- D_polydots_clip(x, y, Points->n_points);
+ D_polydots_abs_clip(x, y, Points->n_points);
else /*use different user defined render methods */
plot_polyline(x, y, Points->n_points);
}
Modified: grass/trunk/display/d.vect.chart/bar.c
===================================================================
--- grass/trunk/display/d.vect.chart/bar.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.vect.chart/bar.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -60,7 +60,7 @@
/* the outline color : default is black */
R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
- D_polyline(max_Points->x, max_Points->y, max_Points->n_points);
+ D_polyline_abs(max_Points->x, max_Points->y, max_Points->n_points);
}
}
@@ -77,11 +77,11 @@
if (!colors[i].none) {
R_RGB_color(colors[i].r, colors[i].g, colors[i].b);
- D_polygon(Points->x, Points->y, Points->n_points);
+ D_polygon_abs(Points->x, Points->y, Points->n_points);
}
R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
- D_polyline(Points->x, Points->y, Points->n_points);
+ D_polyline_abs(Points->x, Points->y, Points->n_points);
}
/* tidy up */
Modified: grass/trunk/display/d.vect.chart/pie.c
===================================================================
--- grass/trunk/display/d.vect.chart/pie.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/display/d.vect.chart/pie.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -54,11 +54,11 @@
if (!colors[i].none) {
R_RGB_color(colors[i].r, colors[i].g, colors[i].b);
- D_polygon(Points->x, Points->y, Points->n_points);
+ D_polygon_abs(Points->x, Points->y, Points->n_points);
}
R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
- D_polyline(Points->x, Points->y, Points->n_points);
+ D_polyline_abs(Points->x, Points->y, Points->n_points);
}
Vect_destroy_line_struct(Points);
Modified: grass/trunk/include/display.h
===================================================================
--- grass/trunk/include/display.h 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/include/display.h 2008-08-25 00:24:22 UTC (rev 33054)
@@ -78,29 +78,44 @@
int D_cont_abs_cull(double, double);
int D_cont_rel_cull(double, double);
-int D_line_cull(double, double, double, double);
-void D_polydots_cull(const double *, const double *, int);
-void D_polyline_cull(const double *, const double *, int);
-void D_polygon_cull(const double *, const double *, int);
-void D_box_cull(double, double, double, double);
+int D_line_abs_cull(double, double, double, double);
+int D_line_rel_cull(double, double, double, double);
+void D_polydots_abs_cull(const double *, const double *, int);
+void D_polydots_rel_cull(const double *, const double *, int);
+void D_polyline_abs_cull(const double *, const double *, int);
+void D_polyline_rel_cull(const double *, const double *, int);
+void D_polygon_abs_cull(const double *, const double *, int);
+void D_polygon_rel_cull(const double *, const double *, int);
+void D_box_abs_cull(double, double, double, double);
+void D_box_rel_cull(double, double);
int D_cont_abs_clip(double, double);
int D_cont_rel_clip(double, double);
-int D_line_clip(double, double, double, double);
-void D_polydots_clip(const double *, const double *, int);
-void D_polyline_clip(const double *, const double *, int);
-void D_polygon_clip(const double *, const double *, int);
-void D_box_clip(double, double, double, double);
+int D_line_abs_clip(double, double, double, double);
+int D_line_rel_clip(double, double, double, double);
+void D_polydots_abs_clip(const double *, const double *, int);
+void D_polydots_rel_clip(const double *, const double *, int);
+void D_polyline_abs_clip(const double *, const double *, int);
+void D_polyline_rel_clip(const double *, const double *, int);
+void D_polygon_abs_clip(const double *, const double *, int);
+void D_polygon_rel_clip(const double *, const double *, int);
+void D_box_abs_clip(double, double, double, double);
+void D_box_rel_clip(double, double);
void D_move_abs(double, double);
void D_move_rel(double, double);
void D_cont_abs(double, double);
void D_cont_rel(double, double);
-void D_line(double, double, double, double);
-void D_polydots(const double *, const double *, int);
-void D_polyline(const double *, const double *, int);
-void D_polygon(const double *, const double *, int);
-void D_box(double, double, double, double);
+void D_line_abs(double, double, double, double);
+void D_line_rel(double, double, double, double);
+void D_polydots_abs(const double *, const double *, int);
+void D_polydots_rel(const double *, const double *, int);
+void D_polyline_abs(const double *, const double *, int);
+void D_polyline_rel(const double *, const double *, int);
+void D_polygon_abs(const double *, const double *, int);
+void D_polygon_rel(const double *, const double *, int);
+void D_box_abs(double, double, double, double);
+void D_box_rel(double, double);
/* icon.c */
void D_plot_icon(double, double, int, double, double);
@@ -127,6 +142,8 @@
/* setup.c */
void D_setup(int);
+void D_setup_unity(int);
+void D_setup2(int, int, double, double, double, double);
/* symbol.c */
void D_symbol(const SYMBOL *, double, double, const RGBA_Color *,
Modified: grass/trunk/lib/display/cnversions.c
===================================================================
--- grass/trunk/lib/display/cnversions.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/lib/display/cnversions.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -273,57 +273,89 @@
}
/*!
- * \brief earth to array (north)
+ * \brief screen to array (y)
*
* Returns a <i>row</i> value in the array coordinate system when provided the
- * corresponding <b>north</b> value in the earth coordinate system.
+ * corresponding <b>y</b> value in the screen coordinate system.
*
- * \param north
+ * \param y
* \return double
*/
-double D_u_to_a_row(double U_row)
+double D_d_to_a_row(double D_row)
{
- return A.north + (U_row - U.north) / A_to_U_conv.y;
+ return A.north + (D_row - D.north) * D_to_A_conv.y;
}
/*!
- * \brief earth to array (east
+ * \brief screen to array (x)
*
* Returns a <i>column</i> value in the array coordinate system when provided the
- * corresponding <b>east</b> value in the earth coordinate system.
+ * corresponding <b>x</b> value in the screen coordinate system.
*
- * \param east
+ * \param x
* \return double
*/
-double D_u_to_a_col(double U_col)
+double D_d_to_a_col(double D_col)
{
- return A.west + (U_col - U.west) / A_to_U_conv.x;
+ return A.west + (D_col - D.west) * D_to_A_conv.x;
}
/*!
- * \brief array to screen (row)
+ * \brief screen to earth (y)
*
- * Returns a <i>y</i> value in the screen coordinate system when provided the
+ * Returns a <i>north</i> value in the earth coordinate system when provided the
+ * corresponding <b>y</b> value in the screen coordinate system.
+ *
+ * \param y
+ * \return double
+ */
+
+double D_d_to_u_row(double D_row)
+{
+ return U.north + (D_row - D.north) / U_to_D_conv.y;
+}
+
+
+/*!
+ * \brief screen to earth (x)
+ *
+ * Returns an <i>east</i> value in the earth coordinate system when provided the
+ * corresponding <b>x</b> value in the screen coordinate system.
+ *
+ * \param x
+ * \return double
+ */
+
+double D_d_to_u_col(double D_col)
+{
+ return U.west + (D_col - D.west) / U_to_D_conv.x;
+}
+
+
+/*!
+ * \brief array to earth (row)
+ *
+ * Returns a <i>y</i> value in the earth coordinate system when provided the
* corresponding <b>row</b> value in the array coordinate system.
*
* \param row
* \return double
*/
-double D_a_to_d_row(double A_row)
+double D_a_to_u_row(double A_row)
{
- return D.north + (A_row - A.north) / D_to_A_conv.y;
+ return U.north + (A_row - A.north) * A_to_U_conv.y;
}
/*!
- * \brief array to screen (column)
+ * \brief array to earth (column)
*
- * Returns an <i>x</i> value in the screen coordinate system when
+ * Returns an <i>x</i> value in the earth coordinate system when
* provided the corresponding <b>column</b> value in the array coordinate
* system.
*
@@ -331,103 +363,104 @@
* \return double
*/
-double D_a_to_d_col(double A_col)
+double D_a_to_u_col(double A_col)
{
- return D.west + (A_col - A.west) / D_to_A_conv.x;
+ return U.west + (A_col - A.west) * A_to_U_conv.x;
}
/*!
- * \brief earth to screen (north)
+ * \brief array to screen (row)
*
* Returns a <i>y</i> value in the screen coordinate system when provided the
- * corresponding <b>north</b> value in the earth coordinate system.
+ * corresponding <b>row</b> value in the array coordinate system.
*
- * \param north
+ * \param row
* \return double
*/
-double D_u_to_d_row(double U_row)
+double D_a_to_d_row(double A_row)
{
- return D.north + (U_row - U.north) * U_to_D_conv.y;
+ return D.north + (A_row - A.north) / D_to_A_conv.y;
}
/*!
- * \brief earth to screen (east)
+ * \brief array to screen (column)
*
- * Returns an <i>x</i> value in the screen coordinate system when provided the
- * corresponding <b>east</b> value in the earth coordinate system.
+ * Returns an <i>x</i> value in the screen coordinate system when
+ * provided the corresponding <b>column</b> value in the array coordinate
+ * system.
*
- * \param east
+ * \param column
* \return double
*/
-double D_u_to_d_col(double U_col)
+double D_a_to_d_col(double A_col)
{
- return D.west + (U_col - U.west) * U_to_D_conv.x;
+ return D.west + (A_col - A.west) / D_to_A_conv.x;
}
/*!
- * \brief screen to earth (y)
+ * \brief earth to screen (north)
*
- * Returns a <i>north</i> value in the earth coordinate system when provided the
- * corresponding <b>y</b> value in the screen coordinate system.
+ * Returns a <i>y</i> value in the screen coordinate system when provided the
+ * corresponding <b>north</b> value in the earth coordinate system.
*
- * \param y
+ * \param north
* \return double
*/
-double D_d_to_u_row(double D_row)
+double D_u_to_d_row(double U_row)
{
- return U.north + (D_row - D.north) / U_to_D_conv.y;
+ return D.north + (U_row - U.north) * U_to_D_conv.y;
}
/*!
- * \brief screen to earth (x)
+ * \brief earth to screen (east)
*
- * Returns an <i>east</i> value in the earth coordinate system when provided the
- * corresponding <b>x</b> value in the screen coordinate system.
+ * Returns an <i>x</i> value in the screen coordinate system when provided the
+ * corresponding <b>east</b> value in the earth coordinate system.
*
- * \param x
+ * \param east
* \return double
*/
-double D_d_to_u_col(double D_col)
+double D_u_to_d_col(double U_col)
{
- return U.west + (D_col - D.west) / U_to_D_conv.x;
+ return D.west + (U_col - U.west) * U_to_D_conv.x;
}
/*!
- * \brief screen to array (y)
+ * \brief earth to array (north)
*
* Returns a <i>row</i> value in the array coordinate system when provided the
- * corresponding <b>y</b> value in the screen coordinate system.
+ * corresponding <b>north</b> value in the earth coordinate system.
*
- * \param y
+ * \param north
* \return double
*/
-double D_d_to_a_row(double D_row)
+double D_u_to_a_row(double U_row)
{
- return A.north + (D_row - D.north) * D_to_A_conv.y;
+ return A.north + (U_row - U.north) / A_to_U_conv.y;
}
/*!
- * \brief screen to array (x)
+ * \brief earth to array (east
*
* Returns a <i>column</i> value in the array coordinate system when provided the
- * corresponding <b>x</b> value in the screen coordinate system.
+ * corresponding <b>east</b> value in the earth coordinate system.
*
- * \param x
+ * \param east
* \return double
*/
-double D_d_to_a_col(double D_col)
+double D_u_to_a_col(double U_col)
{
- return A.west + (D_col - D.west) * D_to_A_conv.x;
+ return A.west + (U_col - U.west) / A_to_U_conv.x;
}
Modified: grass/trunk/lib/display/draw2.c
===================================================================
--- grass/trunk/lib/display/draw2.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/lib/display/draw2.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -113,6 +113,25 @@
return do_reduce(xi, yi, n);
}
+static void rel_to_abs(const double **px, const double **py, int n)
+{
+ const double *x = *px;
+ const double *y = *py;
+ int i;
+
+ alloc_src(n);
+
+ xf[0] = cur.x + x[0];
+ yf[0] = cur.y + y[0];
+
+ for (i = 1; i < n; i++) {
+ xf[i] = xf[i-1] + x[i];
+ yf[i] = yf[i-1] + y[i];
+ }
+
+ dealloc_src(px, py, 0);
+}
+
static double dist_plane(double x, double y, const struct plane *p)
{
return x * p->x + y * p->y + p->k;
@@ -742,13 +761,19 @@
return D_cont_abs_cull(cur.x + x, cur.y + y);
}
-int D_line_cull(double x1, double y1, double x2, double y2)
+int D_line_abs_cull(double x1, double y1, double x2, double y2)
{
+ D_move_rel(x1, y1);
+ return D_cont_rel_cull(x2, y2);
+}
+
+int D_line_rel_cull(double x1, double y1, double x2, double y2)
+{
D_move_abs(x1, y1);
return D_cont_abs_cull(x2, y2);
}
-void D_polydots_cull(const double *x, const double *y, int n)
+void D_polydots_abs_cull(const double *x, const double *y, int n)
{
if (!window_set)
D_clip_to_map();
@@ -756,8 +781,15 @@
polydots_cull(x, y, n);
}
-void D_polyline_cull(const double *x, const double *y, int n)
+void D_polydots_rel_cull(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polydots_abs_cull(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_polyline_abs_cull(const double *x, const double *y, int n)
+{
if (n < 2)
return;
@@ -770,8 +802,15 @@
polyline_cull(x, y, n);
}
-void D_polygon_cull(const double *x, const double *y, int n)
+void D_polyline_rel_cull(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polyline_abs_cull(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_polygon_abs_cull(const double *x, const double *y, int n)
+{
if (!window_set)
D_clip_to_map();
@@ -781,8 +820,15 @@
polygon_cull(x, y, n);
}
-void D_box_cull(double x1, double y1, double x2, double y2)
+void D_polygon_rel_cull(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polygon_abs_cull(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_box_abs_cull(double x1, double y1, double x2, double y2)
+{
if (!window_set)
D_clip_to_map();
@@ -792,6 +838,11 @@
box_cull(x1, y1, x2, y2);
}
+void D_box_rel_cull(double x2, double y2)
+{
+ D_box_abs_cull(cur.x, cur.y, x2, y2);
+}
+
int D_cont_abs_clip(double x, double y)
{
int ret;
@@ -815,22 +866,35 @@
return D_cont_abs_clip(cur.x + x, cur.y + y);
}
-int D_line_clip(double x1, double y1, double x2, double y2)
+int D_line_abs_clip(double x1, double y1, double x2, double y2)
{
D_move_abs(x1, y1);
return D_cont_abs_clip(x2, y2);
}
-void D_polydots_clip(const double *x, const double *y, int n)
+int D_line_rel_clip(double x1, double y1, double x2, double y2)
{
+ D_move_rel(x1, y1);
+ return D_cont_rel_clip(x2, y2);
+}
+
+void D_polydots_abs_clip(const double *x, const double *y, int n)
+{
if (!window_set)
D_clip_to_map();
polydots_cull(x, y, n);
}
-void D_polyline_clip(const double *x, const double *y, int n)
+void D_polydots_rel_clip(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polydots_abs_clip(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_polyline_abs_clip(const double *x, const double *y, int n)
+{
if (!window_set)
D_clip_to_map();
@@ -843,8 +907,15 @@
polyline_clip(x, y, n);
}
-void D_polygon_clip(const double *x, const double *y, int n)
+void D_polyline_rel_clip(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polyline_abs_clip(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_polygon_abs_clip(const double *x, const double *y, int n)
+{
if (!window_set)
D_clip_to_map();
@@ -854,8 +925,15 @@
polygon_clip(x, y, n);
}
-void D_box_clip(double x1, double y1, double x2, double y2)
+void D_polygon_rel_clip(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polygon_abs_clip(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_box_abs_clip(double x1, double y1, double x2, double y2)
+{
if (!window_set)
D_clip_to_map();
@@ -865,6 +943,11 @@
box_clip(x1, y1, x2, y2);
}
+void D_box_rel_clip(double x2, double y2)
+{
+ D_box_abs_clip(cur.x, cur.y, x2, y2);
+}
+
void D_move_abs(double x, double y)
{
cur.x = x;
@@ -897,32 +980,59 @@
D_cont_abs(cur.x + x, cur.y + y);
}
-void D_line(double x1, double y1, double x2, double y2)
+void D_line_abs(double x1, double y1, double x2, double y2)
{
D_move_abs(x1, y1);
D_cont_abs(x2, y2);
}
-void D_polydots(const double *x, const double *y, int n)
+void D_line_rel(double x1, double y1, double x2, double y2)
{
+ D_move_rel(x1, y1);
+ D_cont_rel(x2, y2);
+}
+
+void D_polydots_abs(const double *x, const double *y, int n)
+{
n = do_convert(x, y, n);
R_polydots_abs(xi, yi, n);
}
-void D_polyline(const double *x, const double *y, int n)
+void D_polydots_rel(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polydots_abs(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_polyline_abs(const double *x, const double *y, int n)
+{
n = do_convert(x, y, n);
R_polyline_abs(xi, yi, n);
}
-void D_polygon(const double *x, const double *y, int n)
+void D_polyline_rel(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polyline_abs(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_polygon_abs(const double *x, const double *y, int n)
+{
n = do_convert(x, y, n);
R_polygon_abs(xi, yi, n);
}
-void D_box(double x1, double y1, double x2, double y2)
+void D_polygon_rel(const double *x, const double *y, int n)
{
+ rel_to_abs(&x, &y, n);
+ D_polygon_abs(x, y, n);
+ dealloc_src(&x, &y, 1);
+}
+
+void D_box_abs(double x1, double y1, double x2, double y2)
+{
x1 = D_u_to_d_col(x1);
x2 = D_u_to_d_col(x2);
y1 = D_u_to_d_row(y1);
@@ -931,3 +1041,8 @@
R_box_abs(x1, y1, x2, y2);
}
+void D_box_rel(double x2, double y2)
+{
+ D_box_abs(cur.x, cur.y, x2, y2);
+}
+
Modified: grass/trunk/lib/display/icon.c
===================================================================
--- grass/trunk/lib/display/icon.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/lib/display/icon.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -26,7 +26,7 @@
double tx1 = m[0][0] * x1 + m[0][1] * y1 + m[0][2];
double ty1 = m[1][0] * x1 + m[1][1] * y1 + m[1][2];
- D_line(tx0, ty0, tx1, ty1);
+ D_line_abs(tx0, ty0, tx1, ty1);
}
/**
Modified: grass/trunk/lib/display/setup.c
===================================================================
--- grass/trunk/lib/display/setup.c 2008-08-24 20:22:08 UTC (rev 33053)
+++ grass/trunk/lib/display/setup.c 2008-08-25 00:24:22 UTC (rev 33054)
@@ -23,24 +23,7 @@
#include <grass/display.h>
#include <grass/raster.h>
-
/*!
- * \brief initialize/create a frame
- *
- * This routine
- * performs a series of initialization steps for the current frame. It also
- * creates a full screen frame if there is no current frame. The <b>clear</b>
- * flag, if set to 1, tells this routine to clear any information associated with
- * the frame: graphics as well as region information.
- * This routine relieves the programmer of having to perform the following
- * idiomatic function call sequence
- *
- * \param clear
- * \return int
- */
-
-
-/*!
* \brief graphics frame setup
*
* Performs a full setup
@@ -59,19 +42,50 @@
void D_setup(int clear)
{
struct Cell_head region;
- double t, b, l, r;
+ double dt, db, dl, dr;
- R_get_window(&t, &b, &l, &r);
+ R_get_window(&dt, &db, &dl, &dr);
- /* clear the frame, if requested to do so */
- if (clear)
- D_erase(DEFAULT_BG_COLOR);
-
- /* Set the map region associated with graphics frame */
G_get_set_window(®ion);
if (G_set_window(®ion) < 0)
G_fatal_error("Invalid graphics coordinates");
- /* Determine conversion factors */
- D_do_conversions(®ion, t, b, l, r);
+ D_do_conversions(®ion, dt, db, dl, dr);
+
+ if (clear)
+ D_erase(DEFAULT_BG_COLOR);
}
+
+void D_setup_unity(int clear)
+{
+ double dt, db, dl, dr;
+
+ R_get_window(&dt, &db, &dl, &dr);
+
+ D_set_src(dt, db, dl, dr);
+ D_set_dst(dt, db, dl, dr);
+
+ D_update_conversions();
+
+ if (clear)
+ D_erase(DEFAULT_BG_COLOR);
+}
+
+void D_setup2(int clear, int fit, double st, double sb, double sl, double sr)
+{
+ double dt, db, dl, dr;
+
+ R_get_window(&dt, &db, &dl, &dr);
+
+ D_set_src(st, sb, sl, sr);
+ D_set_dst(dt, db, dl, dr);
+
+ if (fit)
+ D_fit_d_to_u();
+
+ D_update_conversions();
+
+ if (clear)
+ D_erase(DEFAULT_BG_COLOR);
+}
+
More information about the grass-commit
mailing list