[GRASS-SVN] r47695 - grass/branches/develbranch_6/ps/ps.map
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 17 08:30:27 EDT 2011
Author: hamish
Date: 2011-08-17 05:30:27 -0700 (Wed, 17 Aug 2011)
New Revision: 47695
Modified:
grass/branches/develbranch_6/ps/ps.map/do_header.c
grass/branches/develbranch_6/ps/ps.map/header.h
grass/branches/develbranch_6/ps/ps.map/main.c
grass/branches/develbranch_6/ps/ps.map/r_header.c
Log:
full RGB support for header text (#192); bugfix: text color survives %_ horizontal line draw
Modified: grass/branches/develbranch_6/ps/ps.map/do_header.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/do_header.c 2011-08-17 12:20:44 UTC (rev 47694)
+++ grass/branches/develbranch_6/ps/ps.map/do_header.c 2011-08-17 12:30:27 UTC (rev 47695)
@@ -20,7 +20,7 @@
char temp[100];
/* set color and font */
- set_rgb_color(hdr.color);
+ set_ps_color(&hdr.color);
fontsize = (double)hdr.fontsize;
fprintf(PS.fp, "(%s) FN %.1f SF\n", hdr.font, fontsize);
@@ -96,6 +96,7 @@
72.0 * (PS.page_width - PS.right_marg),
y + 0.2 * fontsize);
y -= dy;
+ set_ps_color(&hdr.color);
return 0;
}
else {
Modified: grass/branches/develbranch_6/ps/ps.map/header.h
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/header.h 2011-08-17 12:20:44 UTC (rev 47694)
+++ grass/branches/develbranch_6/ps/ps.map/header.h 2011-08-17 12:30:27 UTC (rev 47695)
@@ -4,13 +4,14 @@
*/
#include <stdio.h>
+#include "clr.h"
struct header
{
char *file;
char *font;
int fontsize;
- int color;
+ PSCOLOR color;
FILE *fp;
};
Modified: grass/branches/develbranch_6/ps/ps.map/main.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/main.c 2011-08-17 12:20:44 UTC (rev 47694)
+++ grass/branches/develbranch_6/ps/ps.map/main.c 2011-08-17 12:30:27 UTC (rev 47695)
@@ -160,7 +160,6 @@
vector.x = vector.y = -1.0;
ct.x = ct.y = -1.0;
ct.width = -1.0;
- hdr.color = BLACK;
cmt.color = BLACK;
m_info.font = G_store(def_font);
vector.font = G_store(def_font);
Modified: grass/branches/develbranch_6/ps/ps.map/r_header.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/r_header.c 2011-08-17 12:20:44 UTC (rev 47694)
+++ grass/branches/develbranch_6/ps/ps.map/r_header.c 2011-08-17 12:30:27 UTC (rev 47695)
@@ -5,7 +5,9 @@
#include <stdlib.h>
#include <string.h>
+#include <grass/glocale.h>
#include "header.h"
+#include "clr.h"
#include "local_proto.h"
#define KEY(x) (strcmp(key,x)==0)
@@ -22,10 +24,13 @@
{
char buf[1024];
char *key, *data;
- int color, fontsize;
+ int fontsize;
+ PSCOLOR color;
+ int ret, r, g, b;
fontsize = 0;
- color = BLACK;
+ set_color(&color, 0, 0, 0);
+
while (input(2, buf, help)) {
if (!key_data(buf, &key, &data))
continue;
@@ -51,11 +56,15 @@
}
if (KEY("color")) {
- color = get_color_number(data);
- if (color < 0) {
- color = BLACK;
- error(key, data, "illegal color request");
- }
+ ret = G_str_to_color(data, &r, &g, &b);
+ if (ret == 1)
+ set_color(&color, r, g, b);
+ else if (ret == 2) /* i.e. "none" */
+ /* unset_color(&color); */
+ error(key, data, _("Unsupported color request"));
+ else
+ error(key, data, _("illegal color request"));
+
continue;
}
@@ -64,8 +73,9 @@
hdr.font = G_store(data);
continue;
}
- error(key, data, "illegal header sub-request");
+ error(key, data, _("illegal header sub-request"));
}
+
hdr.color = color;
if (fontsize)
hdr.fontsize = fontsize;
More information about the grass-commit
mailing list