[GRASS-SVN] r33076 - in grass/trunk: display/d.barscale
display/d.colorlist display/d.colortable display/d.extract
display/d.geodesic display/d.graph display/d.grid
display/d.histogram display/d.labels display/d.legend
display/d.linegraph display/d.measure display/d.path
display/d.profile display/d.rast.arrow display/d.rast.num
display/d.rhumbline display/d.text display/d.thematic.area
display/d.title display/d.vect display/d.vect.chart include
lib/display
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 25 21:01:02 EDT 2008
Author: glynn
Date: 2008-08-25 21:01:01 -0400 (Mon, 25 Aug 2008)
New Revision: 33076
Removed:
grass/trunk/lib/display/color_list.c
Modified:
grass/trunk/display/d.barscale/draw_scale.c
grass/trunk/display/d.colorlist/main.c
grass/trunk/display/d.colortable/main.c
grass/trunk/display/d.extract/extract.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/main.c
grass/trunk/display/d.grid/plot.c
grass/trunk/display/d.histogram/bar.c
grass/trunk/display/d.histogram/draw_slice.c
grass/trunk/display/d.histogram/main.c
grass/trunk/display/d.histogram/pie.c
grass/trunk/display/d.labels/color.c
grass/trunk/display/d.labels/do_labels.c
grass/trunk/display/d.legend/main.c
grass/trunk/display/d.linegraph/main.c
grass/trunk/display/d.measure/draw_line.c
grass/trunk/display/d.measure/main.c
grass/trunk/display/d.measure/msurements.c
grass/trunk/display/d.path/select.c
grass/trunk/display/d.profile/PlotProfile.c
grass/trunk/display/d.profile/What.c
grass/trunk/display/d.profile/bnw_line.c
grass/trunk/display/d.profile/main.c
grass/trunk/display/d.rast.arrow/main.c
grass/trunk/display/d.rast.num/main.c
grass/trunk/display/d.rhumbline/main.c
grass/trunk/display/d.rhumbline/plot.c
grass/trunk/display/d.text/main.c
grass/trunk/display/d.thematic.area/area.c
grass/trunk/display/d.thematic.area/main.c
grass/trunk/display/d.thematic.area/plot1.c
grass/trunk/display/d.title/main.c
grass/trunk/display/d.vect.chart/bar.c
grass/trunk/display/d.vect.chart/pie.c
grass/trunk/display/d.vect/area.c
grass/trunk/display/d.vect/attr.c
grass/trunk/display/d.vect/label.c
grass/trunk/display/d.vect/main.c
grass/trunk/display/d.vect/plot1.c
grass/trunk/display/d.vect/topo.c
grass/trunk/display/d.vect/utils.c
grass/trunk/display/d.vect/zcoor.c
grass/trunk/include/display.h
grass/trunk/lib/display/tran_colr.c
grass/trunk/lib/display/window.c
Log:
Eliminate R_* functions in favour of D_* equivalents (part 3)
Make D_translate_color() equivalent to D_parse_color(<colour>, 0)
Rename D_raster_use_color() to D_use_color()
Add D_RGB_color()
Remove D_color_list()
Modified: grass/trunk/display/d.barscale/draw_scale.c
===================================================================
--- grass/trunk/display/d.barscale/draw_scale.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.barscale/draw_scale.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -95,11 +95,11 @@
pb = y_pos + h + 2; /* 1 pixel margin for both sides */
if (do_background) {
- D_raster_use_color(color1);
+ D_use_color(color1);
D_box_abs(pl, pt, pr, pb);
}
/* Draw legend */
- D_raster_use_color(color2);
+ D_use_color(color2);
D_move_abs(pl + w / 2 + 1, pt + 17 + 1);
D_cont_rel(-0.5 * w, 2.0 * w);
@@ -160,12 +160,12 @@
pr = r;
if (do_background) {
- D_raster_use_color(color1);
+ D_use_color(color1);
D_box_abs(pl, pt, pr, pb);
}
/* Draw legend */
- D_raster_use_color(color2);
+ D_use_color(color2);
if (draw != 2) {
D_move_abs(x_pos + 5, y_pos + 20);
Modified: grass/trunk/display/d.colorlist/main.c
===================================================================
--- grass/trunk/display/d.colorlist/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.colorlist/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
-#include <grass/display.h>
+#include <grass/colors.h>
int main(int argc, char **argv)
{
@@ -48,7 +48,7 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- colorlist = G_store(D_color_list());
+ colorlist = G_store(D_COLOR_LIST);
/* if separator is different from ",", escape this character */
if (strcmp(sep->answer, ",") != 0 && strlen(sep->answer) > 0) {
Modified: grass/trunk/display/d.colortable/main.c
===================================================================
--- grass/trunk/display/d.colortable/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.colortable/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -77,7 +77,7 @@
opt2->key = "color";
opt2->type = TYPE_STRING;
opt2->answer = DEFAULT_FG_COLOR;
- opt2->options = D_color_list();
+ opt2->gisprompt = GISPROMPT_COLOR;
opt2->description =
"Color of lines separating the colors of the color table";
@@ -193,14 +193,14 @@
for (atline = 0; atline < lines; atline++) {
cur_dot_row += dots_per_line;
/* Draw white box */
- R_standard_color(color);
+ D_use_color(color);
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);
+ D_use_color(black);
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);
@@ -227,14 +227,14 @@
cur_dot_row = t + dots_per_line;
cur_dot_col = l;
/* Draw white box */
- R_standard_color(color);
+ D_use_color(color);
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);
+ D_use_color(black);
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);
Modified: grass/trunk/display/d.extract/extract.c
===================================================================
--- grass/trunk/display/d.extract/extract.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.extract/extract.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -136,7 +136,7 @@
G_debug(1, "msize = %f\n", msize);
Points = Vect_new_line_struct();
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
for (i = 0; i < List->n_values; i++) {
line = abs(List->value[i]);
Modified: grass/trunk/display/d.geodesic/main.c
===================================================================
--- grass/trunk/display/d.geodesic/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.geodesic/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -59,7 +59,7 @@
parm.lcolor->type = TYPE_STRING;
parm.lcolor->required = NO;
parm.lcolor->description = "Line color";
- parm.lcolor->options = D_color_list();
+ parm.lcolor->gisprompt = GISPROMPT_COLOR;
parm.lcolor->answer = DEFAULT_FG_COLOR;
parm.tcolor = G_define_option();
@@ -67,7 +67,7 @@
parm.tcolor->type = TYPE_STRING;
parm.tcolor->required = NO;
parm.tcolor->description = "Text color or \"none\"";
- /* parm.tcolor->options = D_color_list(); */
+ parm.tcolor->gisprompt = GISPROMPT_COLOR;
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
Modified: grass/trunk/display/d.geodesic/plot.c
===================================================================
--- grass/trunk/display/d.geodesic/plot.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.geodesic/plot.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -45,7 +45,7 @@
which_range = -1;
change_range = 1;
- R_standard_color(line_color);
+ D_use_color(line_color);
if (lon1 != lon2) {
G_shortest_way(&lon1, &lon2);
G_begin_geodesic_equation(lon1, lat1, lon2, lat2);
@@ -68,7 +68,7 @@
if (text_x + 10 * strlen(buf) >= D_get_d_east())
text_x = D_get_d_east() - 10 * strlen(buf);
D_move_abs(text_x, text_y);
- R_standard_color(text_color);
+ D_use_color(text_color);
R_text(buf);
R_flush();
}
Modified: grass/trunk/display/d.graph/do_graph.c
===================================================================
--- grass/trunk/display/d.graph/do_graph.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.graph/do_graph.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -101,13 +101,13 @@
return (-1);
}
if (color == 1) {
- R_RGB_color(R, G, B);
+ D_RGB_color(R, G, B);
/* store for backup */
set_last_color(R, G, B, RGBA_COLOR_OPAQUE);
}
if (color == 2) { /* color == 'none' */
R = D_translate_color(DEFAULT_BG_COLOR);
- R_standard_color(R);
+ D_use_color(R);
/* store for backup */
set_last_color(0, 0, 0, RGBA_COLOR_NONE);
}
@@ -370,11 +370,11 @@
/* restore previous d.graph draw color */
if (last_color.a == RGBA_COLOR_OPAQUE)
- R_RGB_color(last_color.r, last_color.g, last_color.b);
+ D_RGB_color(last_color.r, last_color.g, last_color.b);
else if (last_color.a == RGBA_COLOR_NONE)
- D_raster_use_color(D_parse_color(DEFAULT_BG_COLOR, 0));
+ D_use_color(D_parse_color(DEFAULT_BG_COLOR, 0));
else /* unset or bad */
- R_RGB_color(line_color->r, line_color->g, line_color->b);
+ D_RGB_color(line_color->r, line_color->g, line_color->b);
G_free(symb_name);
G_free(line_color_str);
Modified: grass/trunk/display/d.graph/main.c
===================================================================
--- grass/trunk/display/d.graph/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.graph/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -106,7 +106,7 @@
G_fatal_error(_("[%s]: No such color"), opt2->answer);
if (color == 1) {
- R_RGB_color(R, G, B);
+ D_RGB_color(R, G, B);
set_last_color(R, G, B, RGBA_COLOR_OPAQUE);
}
else /* (color==2) is "none" */
Modified: grass/trunk/display/d.grid/main.c
===================================================================
--- grass/trunk/display/d.grid/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.grid/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -214,7 +214,7 @@
/* Draw border */
if (!noborder->answer) {
/* Set border color */
- D_raster_use_color(colorb);
+ D_use_color(colorb);
/* Do the border plotting */
plot_border(size, east, north);
Modified: grass/trunk/display/d.grid/plot.c
===================================================================
--- grass/trunk/display/d.grid/plot.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.grid/plot.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -37,12 +37,12 @@
while (x <= window.east) {
if (mark_type == MARK_GRID) {
- D_raster_use_color(gcolor);
+ D_use_color(gcolor);
D_line_abs(x, window.north, x, window.south);
}
if (do_text) {
- D_raster_use_color(tcolor);
+ D_use_color(tcolor);
G_format_easting(x, text, G_projection());
R_text_rotation(270.0);
R_text_size(fontsize, fontsize);
@@ -79,14 +79,14 @@
while (y <= window.north) {
if (mark_type == MARK_GRID) {
- D_raster_use_color(gcolor);
+ D_use_color(gcolor);
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) {
- D_raster_use_color(tcolor);
+ D_use_color(tcolor);
G_format_northing(y, text, G_projection());
R_text_size(fontsize, fontsize);
@@ -178,7 +178,7 @@
continue;
/* Set grid color */
- D_raster_use_color(gcolor);
+ D_use_color(gcolor);
for (ll = 0; ll < SEGS; ll++) {
n1 = n2 = g;
@@ -205,7 +205,7 @@
if (do_text) {
/* Set text color */
- D_raster_use_color(tcolor);
+ D_use_color(tcolor);
G_format_northing(g, text, PROJECTION_LL);
R_text_rotation(font_angle);
@@ -225,7 +225,7 @@
continue;
/* Set grid color */
- D_raster_use_color(gcolor);
+ D_use_color(gcolor);
for (ll = 0; ll < SEGS; ll++) {
e1 = e2 = g;
@@ -257,7 +257,7 @@
}
if (do_text) {
/* Set text color */
- D_raster_use_color(tcolor);
+ D_use_color(tcolor);
G_format_easting(g, text, PROJECTION_LL);
R_text_rotation(font_angle);
Modified: grass/trunk/display/d.histogram/bar.c
===================================================================
--- grass/trunk/display/d.histogram/bar.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.histogram/bar.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -298,7 +298,7 @@
((i == dist_stats->mincat) && nodata))
&& !(nodata && i == dist_stats->mincat + 1)) {
/* draw a numbered tic-mark */
- D_raster_use_color(color);
+ D_use_color(color);
D_move_abs(xoffset + (i - dist_stats->mincat) * xscale - 0.5 * xscale,
b - ORIGIN_Y * (b - t));
D_cont_rel(0, BIG_TIC * (b - t));
@@ -315,12 +315,12 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
while ((tr - tl) > XTIC_DIST) {
text_width *= 0.75;
text_height *= 0.75;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
}
D_move_abs(xoffset + (i - dist_stats->mincat) * xscale - 0.5 * xscale - (tr - tl) / 2,
b - XNUMS_Y * (b - t));
@@ -328,7 +328,7 @@
}
else if (rem(i, tic_unit) == (float)0) {
/* draw a tic-mark */
- D_raster_use_color(color);
+ D_use_color(color);
D_move_abs(xoffset + (i - dist_stats->mincat) * xscale - 0.5 * xscale,
b - ORIGIN_Y * (b - t));
D_cont_rel(0, SMALL_TIC * (b - t));
@@ -343,10 +343,10 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
+ D_get_text_box(xlabel, &tt, &tb, &tl, &tr);
D_move_abs(l + (r - l) / 2 - (tr - tl) / 2,
b - LABEL_1 * (b - t));
- D_raster_use_color(color);
+ D_use_color(color);
R_text(xlabel);
/* DRAW Y-AXIS TIC-MARKS AND NUMBERS
@@ -385,12 +385,12 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
while ((tt - tb) > YTIC_DIST) {
text_width *= 0.75;
text_height *= 0.75;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
}
D_move_abs(l + (r - l) * YNUMS_X - (tr - tl) / 2,
yoffset - (yscale * i + 0.5 * (tt - tb)));
@@ -420,14 +420,14 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(ylabel, &tt, &tb, &tl, &tr);
+ D_get_text_box(ylabel, &tt, &tb, &tl, &tr);
D_move_abs(l + (r - l) / 2 - (tr - tl) / 2,
b - LABEL_2 * (b - t));
- D_raster_use_color(color);
+ D_use_color(color);
R_text(ylabel);
/* draw x and y axis lines */
- D_raster_use_color(color);
+ D_use_color(color);
D_polyline_abs(x_line, y_line, 3);
return 0;
Modified: grass/trunk/display/d.histogram/draw_slice.c
===================================================================
--- grass/trunk/display/d.histogram/draw_slice.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.histogram/draw_slice.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -19,7 +19,7 @@
double arc, arc_incr = 0.01;
DCELL fill_color;
- D_get_dst(&tt, &tb, &tl, &tr);
+ D_get_src(&tt, &tb, &tl, &tr);
height = tb - tt;
width = tr - tl;
@@ -42,7 +42,7 @@
y[i] = y[0] - r * (height) * sin(arc / 57.296);
if (i == 2) {
D_d_color(fill_color, colors);
- R_polygon_abs(x + i - 2, y + i - 2, 3);
+ D_polygon_abs(x + i - 2, y + i - 2, 3);
x[i - 1] = x[i];
y[i - 1] = y[i];
}
@@ -61,12 +61,12 @@
}
if (!fill_flag) {
- R_standard_color(txt_color);
- R_polyline_abs(x, y, i);
+ D_use_color(txt_color);
+ D_polyline_abs(x, y, i);
}
else {
D_d_color(fill_color1, colors);
- R_polygon_abs(x, y, i);
+ D_polygon_abs(x, y, i);
}
}
@@ -74,11 +74,11 @@
/* draw a label */
arc = a1 + a2 / 2;
sprintf(txt, "%2.0f%s", (a2 / 360.0) * 100.0, percent);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
lx = x[0] + (r + 0.03) * (width) * cos(arc / 57.296) - (tr - tl) / 2;
ly = y[0] - (r + 0.03) * (height) * sin(arc / 57.296) + (tb - tt) / 2;
- R_move_abs(lx, ly);
- R_standard_color(txt_color);
+ D_move_abs(lx, ly);
+ D_use_color(txt_color);
R_text(txt);
}
Modified: grass/trunk/display/d.histogram/main.c
===================================================================
--- grass/trunk/display/d.histogram/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.histogram/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -205,10 +205,10 @@
text_height = (b - t) * 0.05;
text_width = (r - l) * 0.05 * 0.50;
R_text_size(text_width, text_height);
- R_get_text_box(title, &tt, &tb, &tl, &tr);
+ D_get_text_box(title, &tt, &tb, &tl, &tr);
D_move_abs(l + (r - l) / 2 - (tr - tl) / 2,
t + (b - t) * 0.07);
- D_raster_use_color(color);
+ D_use_color(color);
R_text(title);
/* plot the distributrion statistics */
Modified: grass/trunk/display/d.histogram/pie.c
===================================================================
--- grass/trunk/display/d.histogram/pie.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.histogram/pie.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -284,7 +284,7 @@
*/
draw = NO;
bar_color = D_translate_color("black");
- R_standard_color(bar_color);
+ D_use_color(bar_color);
}
else
draw = NO;
@@ -347,7 +347,7 @@
((i == dist_stats->mincat) && nodata))
&& !(nodata && i == dist_stats->mincat + 1)) {
/* draw a numbered tic-mark */
- R_standard_color(color);
+ D_use_color(color);
D_move_abs((int)
(xoffset + (i - dist_stats->mincat) * xscale -
0.5 * xscale), (int)(b - BAR_Y1 * (height)));
@@ -361,12 +361,12 @@
text_height = (height) * TEXT_HEIGHT;
text_width = (width) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
while ((tr - tl) > XTIC_DIST) {
text_width *= 0.95;
text_height *= 0.95;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
}
D_move_abs((int)
(xoffset + (i - dist_stats->mincat) * xscale -
@@ -376,7 +376,7 @@
}
else if (rem(i, tic_unit) == (float)0) {
/* draw a tic-mark */
- R_standard_color((int)color);
+ D_use_color((int)color);
D_move_abs((int)
(xoffset + (i - dist_stats->mincat) * xscale -
0.5 * xscale), (int)(b - BAR_Y1 * (height)));
@@ -385,13 +385,13 @@
}
/* draw border around pie */
- R_standard_color((int)color);
+ D_use_color((int)color);
draw_slice_unfilled(colors, (int)color, (double)ORIGIN_X,
(double)ORIGIN_Y, (double)RADIUS, (double)0,
(double)360);
/* draw border around legend bar */
- R_standard_color((int)color);
+ D_use_color((int)color);
D_polyline_abs(x_line, y_line, 5);
/* draw the x-axis label */
@@ -402,10 +402,10 @@
text_height = (height) * TEXT_HEIGHT;
text_width = (width) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
+ D_get_text_box(xlabel, &tt, &tb, &tl, &tr);
D_move_abs((int)(l + (width) / 2 - (tr - tl) / 2),
(int)(b - LABEL * (height)));
- R_standard_color((int)color);
+ D_use_color((int)color);
R_text(xlabel);
return 0;
Modified: grass/trunk/display/d.labels/color.c
===================================================================
--- grass/trunk/display/d.labels/color.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.labels/color.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -91,7 +91,7 @@
G_debug(5, "setting display color to [%d:%d:%d]",
color->r, color->g, color->b);
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
}
else
G_debug(5, "skipped setting display color as it was set to \"none\"");
Modified: grass/trunk/display/d.labels/do_labels.c
===================================================================
--- grass/trunk/display/d.labels/do_labels.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.labels/do_labels.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -332,9 +332,9 @@
}
if (RGBA_has_color(&border)) {
set_color_from_RGBA(&border);
- R_line_width(width);
+ D_line_width(width);
D_polyline_abs(xarr, yarr, 5);
- R_line_width(0);
+ D_line_width(0);
}
/* Set font rotation */
Modified: grass/trunk/display/d.legend/main.c
===================================================================
--- grass/trunk/display/d.legend/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.legend/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -94,7 +94,7 @@
opt2->key = "color";
opt2->type = TYPE_STRING;
opt2->answer = DEFAULT_FG_COLOR;
- opt2->options = D_color_list();
+ opt2->gisprompt = GISPROMPT_COLOR;
opt2->description = _("Sets the legend's text color");
opt4 = G_define_option();
@@ -662,7 +662,7 @@
txsiz = 0; /* keep it sane */
R_text_size(txsiz, txsiz);
- R_standard_color(color);
+ D_use_color(color);
ppl = (lleg) / (steps - 1);
@@ -697,7 +697,7 @@
wleg = x1 - x0;
/* Black box */
- R_standard_color(black);
+ D_use_color(black);
D_move_abs(x0 + 1, y0 + 1);
D_cont_rel(0, lleg - 2);
D_cont_rel(wleg - 2, 0);
@@ -705,7 +705,7 @@
D_cont_rel(2 - wleg, 0);
/* White box */
- R_standard_color(white);
+ D_use_color(white);
D_move_abs(x0, y0);
D_cont_rel(0, lleg);
D_cont_rel(wleg, 0);
@@ -795,7 +795,7 @@
k++; /* count of actual boxes drawn (hide_nodata option invaidates using j-1) */
/* White box */
- R_standard_color(white);
+ D_use_color(white);
cur_dot_row += dots_per_line;
D_move_abs(l + 2, (cur_dot_row - 1));
D_cont_rel(0, (2 - dots_per_line));
@@ -804,7 +804,7 @@
D_cont_rel((2 - dots_per_line), 0);
/* Black box */
- R_standard_color(black);
+ D_use_color(black);
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);
@@ -830,7 +830,7 @@
D_polygon_rel(x_box, y_box, 5);
/* Draw text */
- R_standard_color(color);
+ D_use_color(color);
if (!fp) {
/* nothing, box only */
@@ -876,7 +876,7 @@
txsiz = (int)floor(txsiz * ScaleFactor);
R_text_size(txsiz, txsiz);
}
- R_standard_color(white);
+ D_use_color(white);
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-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.linegraph/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -140,16 +140,16 @@
y_color_opt->type = TYPE_STRING;
y_color_opt->required = NO;
y_color_opt->multiple = YES;
+ y_color_opt->gisprompt = GISPROMPT_COLOR;
y_color_opt->answers = NULL;
- y_color_opt->options = D_COLOR_LIST;
t_color_opt = G_define_option();
t_color_opt->key = "title_color";
t_color_opt->description = _("Color for axis, tics, numbers, and title");
t_color_opt->type = TYPE_STRING;
t_color_opt->required = NO;
+ t_color_opt->gisprompt = GISPROMPT_COLOR;
t_color_opt->answer = DEFAULT_FG_COLOR;
- t_color_opt->options = D_COLOR_LIST;
title[0] = G_define_option();
title[0]->key = "x_title";
@@ -373,7 +373,7 @@
/* draw increment of each Y file's data */
- R_standard_color(in[i].color);
+ D_use_color(in[i].color);
/* find out position of where Y should be drawn. */
/* if our minimum value of y is not negative, this is easy */
@@ -413,7 +413,7 @@
/* draw a numbered tic-mark */
- R_standard_color(title_color);
+ D_use_color(title_color);
D_move_abs((xoffset + line * xscale),
(b - ORIGIN_Y * (b - t)));
D_cont_rel(0, (BIG_TIC * (b - t)));
@@ -425,12 +425,12 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
while ((tr - tl) > XTIC_DIST) {
text_width *= 0.75;
text_height *= 0.75;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
}
D_move_abs((xoffset + (line * xscale - (tr - tl) / 2)),
(b - XNUMS_Y * (b - t)));
@@ -440,7 +440,7 @@
/* draw a tic-mark */
- R_standard_color(title_color);
+ D_use_color(title_color);
D_move_abs((xoffset + line * xscale),
(b - ORIGIN_Y * (b - t)));
D_cont_rel(0, (SMALL_TIC * (b - t)));
@@ -460,10 +460,10 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH * 1.5;
R_text_size(text_width, text_height);
- R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
+ D_get_text_box(xlabel, &tt, &tb, &tl, &tr);
D_move_abs((l + (r - l) / 2 - (tr - tl) / 2),
(b - LABEL_1 * (b - t)));
- R_standard_color(title_color);
+ D_use_color(title_color);
R_text(xlabel);
/* DRAW Y-AXIS TIC-MARKS AND NUMBERS
@@ -501,12 +501,12 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
while ((tt - tb) > YTIC_DIST) {
text_width *= 0.75;
text_height *= 0.75;
R_text_size(text_width, text_height);
- R_get_text_box(txt, &tt, &tb, &tl, &tr);
+ D_get_text_box(txt, &tt, &tb, &tl, &tr);
}
D_move_abs((l + (r - l) * YNUMS_X - (tr - tl) / 2),
(yoffset -
@@ -529,10 +529,10 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH * 1.5;
R_text_size(text_width, text_height);
- R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
+ D_get_text_box(xlabel, &tt, &tb, &tl, &tr);
D_move_abs((l + (r - l) / 2 - (tr - tl) / 2),
(b - LABEL_2 * (b - t)));
- R_standard_color(title_color);
+ D_use_color(title_color);
R_text(xlabel);
/* top label */
@@ -540,19 +540,19 @@
text_height = (b - t) * TEXT_HEIGHT;
text_width = (r - l) * TEXT_WIDTH * 2.0;
R_text_size(text_width, text_height);
- R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
+ D_get_text_box(xlabel, &tt, &tb, &tl, &tr);
/*
R_move_abs((int)(((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);
+ D_use_color(title_color);
R_text(xlabel);
/* draw x and y axis lines */
- R_standard_color(title_color);
- R_polyline_abs(x_line, y_line, 3);
+ D_use_color(title_color);
+ D_polyline_abs(x_line, y_line, 3);
R_flush();
R_close_driver();
Modified: grass/trunk/display/d.measure/draw_line.c
===================================================================
--- grass/trunk/display/d.measure/draw_line.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.measure/draw_line.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -6,10 +6,10 @@
draw_line(int screen_x, int screen_y, int cur_screen_x, int cur_screen_y,
int color1, int color2)
{
- R_standard_color(color1);
+ D_use_color(color1);
R_move_abs(cur_screen_x, cur_screen_y);
R_cont_abs(screen_x, screen_y);
- R_standard_color(color2);
+ D_use_color(color2);
if (abs(screen_y - cur_screen_y) <= abs(screen_x - cur_screen_x)) {
R_move_abs(cur_screen_x, cur_screen_y - 1);
R_cont_abs(screen_x, screen_y - 1);
Modified: grass/trunk/display/d.measure/main.c
===================================================================
--- grass/trunk/display/d.measure/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.measure/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -55,7 +55,7 @@
parm.c1->description = _("Line color 1");
parm.c1->type = TYPE_STRING;
parm.c1->required = NO;
- parm.c1->options = D_color_list();
+ parm.c1->gisprompt = GISPROMPT_COLOR;
parm.c1->answer = DEFAULT_BG_COLOR;
parm.c2 = G_define_option();
@@ -63,7 +63,7 @@
parm.c2->description = _("Line color 2");
parm.c2->type = TYPE_STRING;
parm.c2->required = NO;
- parm.c2->options = D_color_list();
+ parm.c2->gisprompt = GISPROMPT_COLOR;
parm.c2->answer = DEFAULT_FG_COLOR;
parm.s = G_define_flag();
Modified: grass/trunk/display/d.measure/msurements.c
===================================================================
--- grass/trunk/display/d.measure/msurements.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.measure/msurements.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -75,7 +75,7 @@
length = 0.0;
do {
- R_standard_color(color1);
+ D_use_color(color1);
R_get_location_with_line(cur_screen_x, cur_screen_y, &screen_x,
&screen_y, &button);
uy = D_d_to_u_row((double)screen_y);
Modified: grass/trunk/display/d.path/select.c
===================================================================
--- grass/trunk/display/d.path/select.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.path/select.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -17,7 +17,7 @@
{
int from, to;
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
if (first)
from = 0;
@@ -34,7 +34,7 @@
D_polyline_abs(&Points->x[from], &Points->y[from], to - from);
if (be_bold)
- R_line_width(0);
+ D_line_width(0);
return 0;
}
@@ -92,7 +92,7 @@
fx = start_x;
fy = start_y;
}
- R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
+ D_RGB_color(hcolor->r, hcolor->g, hcolor->b);
D_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
@@ -109,7 +109,7 @@
tx = end_x;
ty = end_y;
}
- R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
+ D_RGB_color(hcolor->r, hcolor->g, hcolor->b);
D_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
Modified: grass/trunk/display/d.profile/PlotProfile.c
===================================================================
--- grass/trunk/display/d.profile/PlotProfile.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.profile/PlotProfile.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -56,7 +56,7 @@
R_set_window(t, b, l, r);
/* erase current graphics window to black */
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
/* create axis lines */
@@ -66,7 +66,7 @@
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);
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
/* figure scaling factors and offsets for profile line */
xscale = ((double)(x_line[2] - x_line[1]) / ((double)profile.count));
@@ -91,13 +91,13 @@
(int)(yoffset - yscale * _get_cat(&ptr->cat, min)));
ptr = ptr->next;
}
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
R_polyline_abs(x_line, y_line, 3);
/* loop until coordinate text is sized correctly to fit in window */
text_height = TEXT_HEIGHT * (b - t);
text_width = text_height * 0.8;
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
sprintf(txt_buf, "%s: From (%10.2f,%10.2f) to (%10.2f,%10.2f)",
letter, profile.e1, profile.n1, profile.e2, profile.n2);
done = 0;
Modified: grass/trunk/display/d.profile/What.c
===================================================================
--- grass/trunk/display/d.profile/What.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.profile/What.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -28,13 +28,13 @@
if (G_get_map_row(fd, buf, row) < 0)
G_fatal_error(_("Error reading raster map"));
else {
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
R_flush();
sprintf(txt_buf, "%s in mapset %s", name, mapset);
DrawText(22, 1, 1, txt_buf);
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
sprintf(txt_buf, "EAST: %10.2f", east);
DrawText(22, 2, 1, txt_buf);
sprintf(txt_buf, "NORTH: %10.2f", north);
Modified: grass/trunk/display/d.profile/bnw_line.c
===================================================================
--- grass/trunk/display/d.profile/bnw_line.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.profile/bnw_line.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -5,10 +5,10 @@
int black_and_white_line(int screen_x, int screen_y,
int cur_screen_x, int cur_screen_y)
{
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
R_move_abs(cur_screen_x, cur_screen_y);
R_cont_abs(screen_x, screen_y);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
if (abs(screen_y - cur_screen_y) <= abs(screen_x - cur_screen_x)) {
R_move_abs(cur_screen_x, cur_screen_y - 1);
R_cont_abs(screen_x, screen_y - 1);
Modified: grass/trunk/display/d.profile/main.c
===================================================================
--- grass/trunk/display/d.profile/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.profile/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -148,7 +148,7 @@
/* Make sure screen is clear */
D_remove_windows();
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
R_erase();
/* Establish windows on screen */
@@ -182,11 +182,11 @@
for (;;) {
/* display mouse-menu in mouse-menu window */
D_set_cur_wind(MOU.name);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
DrawText(25, 1, 1, "GRASS PROGRAM: profile");
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
DrawText(15, 3, 1, "MOUSE | Left: Where am I?");
DrawText(15, 4, 1, "BUTTON | Middle: Set FIRST point");
DrawText(15, 5, 1, "MENU | Right: Quit this\n");
@@ -220,9 +220,9 @@
if (cur_ux > window.east || cur_ux < window.west ||
cur_uy > window.north || cur_uy < window.south) {
D_set_cur_wind(STA.name);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
DrawText(25, 1, 1, "OUTSIDE CURRENT WINDOW");
R_flush();
button = 1;
@@ -237,11 +237,11 @@
/* display mouse-menu in mouse-menu window */
D_set_cur_wind(MOU.name);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
DrawText(25, 1, 1, "GRASS PROGRAM: profile");
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
DrawText(15, 3, 1, "MOUSE | Left: Where am I?");
DrawText(15, 4, 1, "BUTTON | Middle: Set SECOND point");
DrawText(15, 5, 1, "MENU | Right: Quit this\n");
@@ -267,9 +267,9 @@
if (ux > window.east || ux < window.west ||
uy > window.north || uy < window.south) {
D_set_cur_wind(STA.name);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
DrawText(25, 1, 1, "OUTSIDE CURRENT WINDOW");
button = 1;
}
@@ -286,9 +286,9 @@
ExtractProfile(&profile, old_mapname,
old_mapset)) == -1) {
D_set_cur_wind(STA.name);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
DrawText(25, 1, 1, "ERROR: end-point outside");
DrawText(25, 2, 1, " of current window");
}
@@ -340,10 +340,10 @@
R_move_rel(-(text_width + 2), 2);
else if (screen_x > cur_screen_x)
R_move_rel(3, 0);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
R_text_size(text_width, text_height);
R_text(ltr);
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
/* plot label in white */
R_move_abs(screen_x, screen_y);
@@ -357,15 +357,15 @@
R_move_rel(3, 0);
R_move_rel(1, 1);
R_text(ltr);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
/*length = hypot(cur_ux - ux, cur_uy - uy); */
/* tell user about profile being plotted */
D_set_cur_wind(STA.name);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
DrawText(25, 1, 1, "PLOTTING PROFILE");
/* plot profile data in profile window */
@@ -390,11 +390,11 @@
/* display mouse-menu in mouse-menu window */
D_set_cur_wind(MOU.name);
- R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_BG_COLOR));
D_erase_window();
- R_standard_color(D_translate_color("red"));
+ D_use_color(D_translate_color("red"));
DrawText(25, 1, 1, "GRASS PROGRAM: profile");
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
+ D_use_color(D_translate_color(DEFAULT_FG_COLOR));
DrawText(15, 3, 1, "MOUSE | Left: DO ANOTHER");
DrawText(15, 4, 1, "BUTTON | Middle: CLEAR DISPLAY");
DrawText(15, 5, 1, "MENU | Right: QUIT");
Modified: grass/trunk/display/d.rast.arrow/main.c
===================================================================
--- grass/trunk/display/d.rast.arrow/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.rast.arrow/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -116,7 +116,7 @@
opt3->type = TYPE_STRING;
opt3->required = NO;
opt3->answer = "green";
- opt3->options = D_COLOR_LIST;
+ opt3->gisprompt = GISPROMPT_COLOR;
opt3->description = _("Color for drawing arrows");
opt4 = G_define_option();
@@ -124,7 +124,7 @@
opt4->type = TYPE_STRING;
opt4->required = NO;
opt4->answer = "gray";
- opt4->options = D_COLOR_LIST ",none";
+ opt4->gisprompt = GISPROMPT_COLOR;
opt4->description = _("Color for drawing grid or \"none\"");
opt5 = G_define_option();
@@ -132,7 +132,7 @@
opt5->type = TYPE_STRING;
opt5->required = NO;
opt5->answer = DEFAULT_FG_COLOR;
- opt5->options = D_COLOR_LIST;
+ opt5->gisprompt = GISPROMPT_COLOR;
opt5->description = _("Color for drawing X's (Null values)");
opt6 = G_define_option();
@@ -140,7 +140,7 @@
opt6->type = TYPE_STRING;
opt6->required = NO;
opt6->answer = "red";
- opt6->options = D_COLOR_LIST;
+ opt6->gisprompt = GISPROMPT_COLOR;
opt6->description = _("Color for showing unknown information");
opt9 = G_define_option();
@@ -245,7 +245,7 @@
if (grid_color > 0) { /* ie not "none" */
/* Set color */
- R_standard_color(grid_color);
+ D_use_color(grid_color);
/* Draw vertical grids */
for (col = 0; col < ncols; col++) {
@@ -362,12 +362,12 @@
/* case switch for standard GRASS aspect map
measured in degrees counter-clockwise from east */
if (map_type == 1) {
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
if (G_is_null_value(ptr, raster_type)) {
- R_standard_color(x_color);
+ D_use_color(x_color);
draw_x();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
}
else if (aspect_f >= 0.0 && aspect_f <= 360.0) {
if (opt7->answer)
@@ -376,21 +376,21 @@
arrow_360(aspect_f);
}
else {
- R_standard_color(unknown_color);
+ D_use_color(unknown_color);
unknown_();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
}
}
/* case switch for AGNPS type aspect map */
else if (map_type == 2) {
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
switch (aspect_c) {
case 0:
- R_standard_color(x_color);
+ D_use_color(x_color);
draw_x();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
break;
case 1:
arrow_n();
@@ -417,9 +417,9 @@
arrow_nw();
break;
default:
- R_standard_color(unknown_color);
+ D_use_color(unknown_color);
unknown_();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
break;
}
}
@@ -427,30 +427,30 @@
/* case switch for ANSWERS type aspect map */
else if (map_type == 3) {
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
if (aspect_c >= 15 && aspect_c <= 360) /* start at zero? */
arrow_360((double)aspect_c);
else if (aspect_c == 400) {
- R_standard_color(unknown_color);
+ D_use_color(unknown_color);
unknown_();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
}
else {
- R_standard_color(x_color);
+ D_use_color(x_color);
draw_x();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
}
}
/* case switch for compass type aspect map
measured in degrees clockwise from north */
else if (map_type == 4) {
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
if (G_is_null_value(ptr, raster_type)) {
- R_standard_color(x_color);
+ D_use_color(x_color);
draw_x();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
}
else if (aspect_f >= 0.0 && aspect_f <= 360.0) {
if (opt7->answer)
@@ -459,9 +459,9 @@
arrow_360(90 - aspect_f);
}
else {
- R_standard_color(unknown_color);
+ D_use_color(unknown_color);
unknown_();
- R_standard_color(arrow_color);
+ D_use_color(arrow_color);
}
}
Modified: grass/trunk/display/d.rast.num/main.c
===================================================================
--- grass/trunk/display/d.rast.num/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.rast.num/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -52,7 +52,6 @@
DCELL *cell;
char *mapset;
char full_name[128];
- double ew_res, ns_res;
int fixed_color, grid_color;
int R, G, B;
int layer_fd;
@@ -81,7 +80,7 @@
opt2->type = TYPE_STRING;
opt2->required = NO;
opt2->answer = "gray";
- opt2->options = D_COLOR_LIST ",none";
+ opt2->gisprompt = GISPROMPT_COLOR;
opt2->key_desc = "color";
opt2->description = _("Color for drawing grid, or \"none\"");
@@ -90,7 +89,7 @@
opt3->type = TYPE_STRING;
opt3->required = NO;
opt3->answer = DEFAULT_FG_COLOR;
- opt3->options = D_COLOR_LIST;
+ opt3->gisprompt = GISPROMPT_COLOR;
opt3->key_desc = "color";
opt3->description = _("Color for drawing text");
@@ -135,16 +134,6 @@
inmap_type = G_get_raster_map_type(layer_fd);
map_type = DCELL_TYPE;
- /* Setup driver and check important information */
-
- if (R_open_driver() != 0)
- G_fatal_error(_("No graphics device selected"));
-
- D_setup(0);
-
- D_ns = fabs(D_get_a_to_d_yconv());
- D_ew = fabs(D_get_a_to_d_xconv());
-
/* Read in the map window associated with window */
G_get_window(&window);
@@ -169,25 +158,31 @@
G_fatal_error(_("Aborting."));
}
- /* resolutions */
- ew_res = window.ew_res;
- ns_res = window.ns_res;
+ /* Setup driver and check important information */
+ if (R_open_driver() != 0)
+ G_fatal_error(_("No graphics device selected"));
+
+ D_setup2(0, 0, 0, nrows, 0, ncols);
+
+ D_ns = fabs(D_get_u_to_d_yconv());
+ D_ew = fabs(D_get_u_to_d_xconv());
+
/*set the number of significant digits */
sscanf(prec->answer, "%i", &digits);
if (grid_color > 0) { /* ie not "none" */
/* Set grid color */
- R_standard_color(grid_color);
+ D_use_color(grid_color);
/* Draw vertical grids */
- for (col = 0; col < ncols; col++) {
+ for (col = 0; col <= ncols; col++) {
D_move_abs(col, 0);
D_cont_abs(col, nrows);
}
/* Draw horizontal grids */
- for (row = 0; row < nrows; row++) {
+ for (row = 0; row <= nrows; row++) {
D_move_abs(0, row);
D_cont_abs(ncols, row);
}
@@ -202,7 +197,7 @@
/* fixed text color */
if (fixed_color == 1)
- R_standard_color(D_translate_color(opt3->answer));
+ D_use_color(D_translate_color(opt3->answer));
/* loop through cells, find value, and draw text for value */
for (row = 0; row < nrows; row++) {
@@ -212,7 +207,7 @@
if (fixed_color == 0) {
G_get_raster_color(&cell[col], &R, &G, &B, &colors, map_type);
- R_RGB_color(R, G, B);
+ D_RGB_color(R, G, B);
}
draw_number(row, col, cell[col], digits, inmap_type);
@@ -231,13 +226,14 @@
int draw_number(int row, int col, double number, int prec, RASTER_MAP_TYPE map_type)
{
- int len, text_size, rite;
+ int len;
+ double text_size, rite;
double tt, tb, tl, tr;
char no[32];
double dots_per_line, factor = 0.8;
DCELL dcell = number;
CELL cell = (int)number;
- double x, y;
+ double dx;
/* maybe ugly, but works */
if (map_type == CELL_TYPE) {
@@ -265,15 +261,12 @@
}
R_text_size(text_size, text_size);
- R_get_text_box(no, &tt, &tb, &tl, &tr);
- /*
- R_get_text_box(num,&tt,&tb,&tl,&tr);
- 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_u_col(col + 0.5);
- y = D_a_to_u_row(row + 0.7);
- D_move_abs(x - (tr - tl) / 2, y);
+
+ D_move_abs(col, row + 0.7);
+ D_get_text_box(no, &tt, &tb, &tl, &tr);
+
+ dx = (tr + tl) / 2 - (col + 0.5);
+ D_move_abs(col - dx, row + 0.7);
R_text(no);
return 0;
Modified: grass/trunk/display/d.rhumbline/main.c
===================================================================
--- grass/trunk/display/d.rhumbline/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.rhumbline/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -58,7 +58,7 @@
parm.lcolor->type = TYPE_STRING;
parm.lcolor->required = NO;
parm.lcolor->description = "Line color";
- parm.lcolor->options = D_color_list();
+ parm.lcolor->gisprompt = GISPROMPT_COLOR;
parm.lcolor->answer = DEFAULT_FG_COLOR;
#ifdef CAN_DO_DISTANCES
@@ -67,7 +67,7 @@
parm.tcolor->type = TYPE_STRING;
parm.tcolor->required = NO;
parm.tcolor->description = "Text color";
- parm.tcolor->options = D_color_list();
+ parm.tcolor->gisprompt = GISPROMPT_COLOR;
#endif
if (G_parser(argc, argv))
Modified: grass/trunk/display/d.rhumbline/plot.c
===================================================================
--- grass/trunk/display/d.rhumbline/plot.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.rhumbline/plot.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -29,7 +29,7 @@
{
int text_x, text_y;
- R_standard_color(line_color);
+ D_use_color(line_color);
if (lon1 != lon2) {
G_shortest_way(&lon1, &lon2);
G_begin_rhumbline_equation(lon1, lat1, lon2, lat2);
Modified: grass/trunk/display/d.text/main.c
===================================================================
--- grass/trunk/display/d.text/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.text/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -532,7 +532,7 @@
if (sscanf(tcolor, "%d:%d:%d", &r, &g, &b) == 3 ||
sscanf(tcolor, "0x%02x%02x%02x", &r, &g, &b) == 3) {
if (r >= 0 && r < 256 && g >= 0 && g < 256 && b >= 0 && b < 256) {
- R_RGB_color(r, g, b);
+ D_RGB_color(r, g, b);
}
}
else {
@@ -542,7 +542,7 @@
DEFAULT_COLOR);
color = D_translate_color(DEFAULT_COLOR);
}
- R_standard_color(color);
+ D_use_color(color);
}
@@ -600,7 +600,7 @@
if (rotation != 0.0)
R_text_rotation(0.0);
- R_get_text_box(text, &t, &b, &l, &r);
+ D_get_text_box(text, &t, &b, &l, &r);
if (rotation != 0.0)
R_text_rotation(rotation * 180.0 / M_PI);
Modified: grass/trunk/display/d.thematic.area/area.c
===================================================================
--- grass/trunk/display/d.thematic.area/area.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.thematic.area/area.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -154,7 +154,7 @@
/* plot polygon in class color */
- R_RGB_color(colors[i].r, colors[i].g, colors[i].b);
+ D_RGB_color(colors[i].r, colors[i].g, colors[i].b);
plot_polygon(Points->x, Points->y, Points->n_points);
/* XXX rewrite boundary */
@@ -162,7 +162,7 @@
int i;
Vect_get_area_points(Map, area, Points);
- R_RGB_color(bcolor->r, bcolor->g, bcolor->b);
+ D_RGB_color(bcolor->r, bcolor->g, bcolor->b);
/*use different user defined render methods */
plot_polyline(Points->x, Points->y, Points->n_points);
for (i = 0; i < n_isles; i++) {
Modified: grass/trunk/display/d.thematic.area/main.c
===================================================================
--- grass/trunk/display/d.thematic.area/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.thematic.area/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -443,7 +443,7 @@
* driver (not implemented)? It will help restore previous line
* width (not just 0) determined by another module (e.g.,
* d.linewidth). */
- R_line_width(0);
+ D_line_width(0);
} /* end window check if */
Modified: grass/trunk/display/d.thematic.area/plot1.c
===================================================================
--- grass/trunk/display/d.thematic.area/plot1.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.thematic.area/plot1.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -219,7 +219,7 @@
/* Is it necessary to reset line/label color in each loop ? */
if (color && !table_colors_flag && !cats_color_flag)
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
if (Vect_level(Map) >= 2)
nlines = Vect_get_num_lines(Map);
@@ -436,13 +436,13 @@
}
else if (color || custom_rgb) {
if (!table_colors_flag && !cats_color_flag)
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
else {
if (custom_rgb)
- R_RGB_color((unsigned char)red, (unsigned char)grn,
+ D_RGB_color((unsigned char)red, (unsigned char)grn,
(unsigned char)blu);
else
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
}
/* Plot the lines */
Modified: grass/trunk/display/d.title/main.c
===================================================================
--- grass/trunk/display/d.title/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.title/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -59,7 +59,7 @@
opt2->type = TYPE_STRING;
opt2->answer = DEFAULT_FG_COLOR;
opt2->required = NO;
- opt2->options = D_color_list();
+ opt2->gisprompt = GISPROMPT_COLOR;
opt2->description = _("Sets the text color");
opt3 = G_define_option();
Modified: grass/trunk/display/d.vect/area.c
===================================================================
--- grass/trunk/display/d.vect/area.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/area.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -357,16 +357,16 @@
if (fcolor || (z_color_flag && Vect_is_3d(Map))) {
if (!table_colors_flag && !cats_color_flag && !z_color_flag) {
- R_RGB_color(fcolor->r, fcolor->g, fcolor->b);
+ D_RGB_color(fcolor->r, fcolor->g, fcolor->b);
plot_polygon(Points->x, Points->y, Points->n_points);
}
else {
if (rgb) {
- R_RGB_color((unsigned char)red, (unsigned char)grn,
+ D_RGB_color((unsigned char)red, (unsigned char)grn,
(unsigned char)blu);
}
else {
- R_RGB_color(fcolor->r, fcolor->g, fcolor->b);
+ D_RGB_color(fcolor->r, fcolor->g, fcolor->b);
}
if (cat >= 0) {
plot_polygon(Points->x, Points->y, Points->n_points);
@@ -380,11 +380,11 @@
Vect_get_area_points(Map, area, Points);
if (rgb) {
- R_RGB_color((unsigned char)red, (unsigned char)grn,
+ D_RGB_color((unsigned char)red, (unsigned char)grn,
(unsigned char)blu);
}
else {
- R_RGB_color(bcolor->r, bcolor->g, bcolor->b);
+ D_RGB_color(bcolor->r, bcolor->g, bcolor->b);
}
/*use different user defined render methods */
plot_polyline(Points->x, Points->y, Points->n_points);
Modified: grass/trunk/display/d.vect/attr.c
===================================================================
--- grass/trunk/display/d.vect/attr.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/attr.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -57,7 +57,7 @@
if (!(type & ltype))
continue; /* used for both lines and labels */
- R_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
+ D_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
R_text_size(lattr->size, lattr->size);
if (lattr->font)
R_font(lattr->font);
Modified: grass/trunk/display/d.vect/label.c
===================================================================
--- grass/trunk/display/d.vect/label.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/label.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -32,7 +32,7 @@
if (!(type & ltype))
continue; /* used for both lines and labels */
- R_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
+ D_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
R_text_size(lattr->size, lattr->size);
if (lattr->font)
R_font(lattr->font);
Modified: grass/trunk/display/d.vect/main.c
===================================================================
--- grass/trunk/display/d.vect/main.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/main.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -687,7 +687,7 @@
}
if (has_color) {
- R_RGB_color(color.r, color.g, color.b);
+ D_RGB_color(color.r, color.g, color.b);
if (display & DISP_DIR)
stat = dir(&Map, type, Clist, chcat);
}
@@ -697,7 +697,7 @@
* width (not just 0) determined by another module (e.g.,
* d.linewidth). */
if (!wcolumn_opt->answer)
- R_line_width(0);
+ D_line_width(0);
if (display & DISP_CAT)
stat = label(&Map, type, area, Clist, &lattr, chcat);
Modified: grass/trunk/display/d.vect/plot1.c
===================================================================
--- grass/trunk/display/d.vect/plot1.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/plot1.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -217,7 +217,7 @@
/* Is it necessary to reset line/label color in each loop ? */
if (color && !table_colors_flag && !cats_color_flag)
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
if (Vect_level(Map) >= 2)
nlines = Vect_get_num_lines(Map);
@@ -452,13 +452,13 @@
}
else if (color || custom_rgb || (z_color_flag && Vect_is_3d(Map))) {
if (!table_colors_flag && !cats_color_flag && !z_color_flag)
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
else {
if (custom_rgb)
- R_RGB_color((unsigned char)red, (unsigned char)grn,
+ D_RGB_color((unsigned char)red, (unsigned char)grn,
(unsigned char)blu);
else
- R_RGB_color(color->r, color->g, color->b);
+ D_RGB_color(color->r, color->g, color->b);
}
/* Plot the lines */
Modified: grass/trunk/display/d.vect/topo.c
===================================================================
--- grass/trunk/display/d.vect/topo.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/topo.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -20,7 +20,7 @@
Points = Vect_new_line_struct();
Cats = Vect_new_cats_struct();
- R_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
+ D_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
R_text_size(lattr->size, lattr->size);
if (lattr->font)
R_font(lattr->font);
Modified: grass/trunk/display/d.vect/utils.c
===================================================================
--- grass/trunk/display/d.vect/utils.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/utils.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -43,17 +43,17 @@
yarr[1] = yarr[2] = T + Yoffset;
if (lattr->has_bgcolor) {
- R_RGB_color(lattr->bgcolor.R, lattr->bgcolor.G,
+ D_RGB_color(lattr->bgcolor.R, lattr->bgcolor.G,
lattr->bgcolor.B);
D_polygon_abs(xarr, yarr, 5);
}
if (lattr->has_bcolor) {
- R_RGB_color(lattr->bcolor.R, lattr->bcolor.G,
+ D_RGB_color(lattr->bcolor.R, lattr->bcolor.G,
lattr->bcolor.B);
D_polyline_abs(xarr, yarr, 5);
}
- R_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
+ D_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
}
D_move_abs(X + Xoffset, Y + Yoffset);
Modified: grass/trunk/display/d.vect/zcoor.c
===================================================================
--- grass/trunk/display/d.vect/zcoor.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect/zcoor.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -19,7 +19,7 @@
Points = Vect_new_line_struct();
Cats = Vect_new_cats_struct();
- R_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
+ D_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
R_text_size(lattr->size, lattr->size);
if (lattr->font)
R_font(lattr->font);
Modified: grass/trunk/display/d.vect.chart/bar.c
===================================================================
--- grass/trunk/display/d.vect.chart/bar.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect.chart/bar.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -59,7 +59,7 @@
Vect_append_point(max_Points, x0 + i * bw, y0, 0);
/* the outline color : default is black */
- R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
+ D_RGB_color(ocolor->r, ocolor->g, ocolor->b);
D_polyline_abs(max_Points->x, max_Points->y, max_Points->n_points);
}
}
@@ -76,11 +76,11 @@
Vect_append_point(Points, x0 + i * bw, y0, 0);
if (!colors[i].none) {
- R_RGB_color(colors[i].r, colors[i].g, colors[i].b);
+ D_RGB_color(colors[i].r, colors[i].g, colors[i].b);
D_polygon_abs(Points->x, Points->y, Points->n_points);
}
- R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
+ D_RGB_color(ocolor->r, ocolor->g, ocolor->b);
D_polyline_abs(Points->x, Points->y, Points->n_points);
}
Modified: grass/trunk/display/d.vect.chart/pie.c
===================================================================
--- grass/trunk/display/d.vect.chart/pie.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/display/d.vect.chart/pie.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -53,11 +53,11 @@
Vect_append_point(Points, cx, cy, 0);
if (!colors[i].none) {
- R_RGB_color(colors[i].r, colors[i].g, colors[i].b);
+ D_RGB_color(colors[i].r, colors[i].g, colors[i].b);
D_polygon_abs(Points->x, Points->y, Points->n_points);
}
- R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
+ D_RGB_color(ocolor->r, ocolor->g, ocolor->b);
D_polyline_abs(Points->x, Points->y, Points->n_points);
}
Modified: grass/trunk/include/display.h
===================================================================
--- grass/trunk/include/display.h 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/include/display.h 2008-08-26 01:01:01 UTC (rev 33076)
@@ -67,9 +67,6 @@
double D_u_to_a_row(double);
double D_u_to_a_col(double);
-/* color_list.c */
-char *D_color_list(void);
-
/* draw2.c */
void D_set_clip(double, double, double, double);
void D_clip_to_map(void);
@@ -157,8 +154,9 @@
int D_translate_or_add_color(const char *, int);
int D_allocate_color(void);
int D_parse_color(const char *, int);
-int D_raster_use_color(int);
+int D_use_color(int);
int D_color_number_to_RGB(int, int *, int *, int *);
+void D_RGB_color(int, int, int);
/* window.c */
void D_erase(const char *);
Deleted: grass/trunk/lib/display/color_list.c
===================================================================
--- grass/trunk/lib/display/color_list.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/lib/display/color_list.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -1,6 +0,0 @@
-#include <grass/colors.h>
-
-char *D_color_list(void)
-{
- return D_COLOR_LIST;
-}
Modified: grass/trunk/lib/display/tran_colr.c
===================================================================
--- grass/trunk/lib/display/tran_colr.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/lib/display/tran_colr.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -13,41 +13,13 @@
static int nalloc;
/*!
- * \brief color name to number
- *
- * Takes a
- * color <b>name</b> in ascii and returns the color number for that color.
- * Returns 0 if color is not known. The color number returned is for lines and
- * text, not raster graphics.
- *
- * \param name
- * \return int
- */
-
-int D_translate_color(const char *str)
-{
- int num_names = G_num_standard_color_names();
- int i;
-
- for (i = 0; i < num_names; i++) {
- const struct color_name *name = G_standard_color_name(i);
-
- if (G_strcasecmp(str, name->name) == 0)
- return name->number;
- }
-
- return 0;
-}
-
-
-/*!
* \brief color name and suggested number to actual number
*
* Takes a color <b>name</b> or <b>red:green:blue</b> code in ascii
* and a <b>suggested color index</b>.
* If the color is a standard preallocated color it returns the color number for that color.
* Otherwise (if the color is not standard) it sets the color of the supplied index to
- * the specified color (see R_reset_color).
+ * the specified color.
* Returns -1 if color is not known and 0 if the color is none.
*
* \param name_or_code
@@ -57,9 +29,10 @@
static int translate_or_add_color(const char *str)
{
+ int num_names = G_num_standard_color_names();
int index;
int red, grn, blu;
- int i, preallocated, ret;
+ int i, ret;
char lowerstr[MAX_COLOR_LEN];
/* Make the color string lowercase for display colors */
@@ -67,10 +40,13 @@
G_chop(lowerstr);
G_tolcase(lowerstr);
- preallocated = D_translate_color(lowerstr);
- if (preallocated)
- return preallocated;
+ for (i = 0; i < num_names; i++) {
+ const struct color_name *name = G_standard_color_name(i);
+ if (G_strcasecmp(str, name->name) == 0)
+ return name->number;
+ }
+
if (!nalloc) {
ncolors = G_num_standard_colors();
nalloc = 2 * ncolors;
@@ -110,7 +86,7 @@
* \brief color option text to usable color number
*
* Converts or looks up the color provided in the string.
- * Returns a color number usable by D_raster_use_color.
+ * Returns a color number usable by D_use_color.
* If the color does not exist exits with a fatal error and message.
* If the color is none and none_acceptable is not true exits with
* a fatal error and message.
@@ -132,7 +108,26 @@
return color;
}
+
/*!
+ * \brief color name to number
+ *
+ * Takes a
+ * color <b>name</b> in ascii and returns the color number for that color.
+ * Returns 0 if color is not known. The color number returned is for lines and
+ * text, not raster graphics.
+ *
+ * \param name
+ * \return int
+ */
+
+int D_translate_color(const char *str)
+{
+ return D_parse_color(str, 0);
+}
+
+
+/*!
* \brief draw with a color from D_parse_color
*
* Calls R_color or R_standard_color to use the color provided by
@@ -143,7 +138,7 @@
* \return int
*/
-int D_raster_use_color(int color)
+int D_use_color(int color)
{
if (color <= 0)
return 0;
@@ -213,3 +208,9 @@
return 1;
}
+
+void D_RGB_color(int red, int grn, int blu)
+{
+ R_RGB_color(red, grn, blu);
+}
+
Modified: grass/trunk/lib/display/window.c
===================================================================
--- grass/trunk/lib/display/window.c 2008-08-26 00:54:44 UTC (rev 33075)
+++ grass/trunk/lib/display/window.c 2008-08-26 01:01:01 UTC (rev 33076)
@@ -18,7 +18,7 @@
/* Parse and select background color */
colorindex = D_parse_color(color, 0);
- D_raster_use_color(colorindex);
+ D_use_color(colorindex);
/* Do the plotting */
R_box_abs(l, t, r, b);
More information about the grass-commit
mailing list