18 #include <grass/gis.h>
19 #include <grass/raster.h>
20 #include <grass/symbol.h>
21 #include <grass/glocale.h>
47 void D_symbol(
const SYMBOL * Symb,
int x0,
int y0,
48 const RGBA_Color * line_color,
const RGBA_Color * fill_color)
52 const SYMBCHAIN *chain;
57 G_debug(2,
"D_symbol(): %d parts", Symb->count);
59 for (i = 0; i < Symb->count; i++) {
66 if ((part->fcolor.color == S_COL_DEFAULT &&
67 fill_color->a != RGBA_COLOR_NONE) ||
68 part->fcolor.color == S_COL_DEFINED) {
69 if (part->fcolor.color == S_COL_DEFAULT)
70 R_RGB_color(fill_color->r, fill_color->g, fill_color->b);
75 for (j = 0; j < part->count; j++) {
76 chain = part->chain[j];
78 x = G_malloc(
sizeof(
int) * chain->scount);
79 y = G_malloc(
sizeof(
int) * chain->scount);
81 for (k = 0; k < chain->scount; k++) {
82 x[k] = x0 + chain->sx[k];
83 y[k] = y0 - chain->sy[k];
93 if ((part->color.color == S_COL_DEFAULT &&
94 line_color->a != RGBA_COLOR_NONE) ||
95 part->color.color == S_COL_DEFINED) {
96 if (part->color.color == S_COL_DEFAULT) {
97 R_RGB_color(line_color->r, line_color->g, line_color->b);
100 R_RGB_color(part->color.r, part->color.g, part->color.b);
102 for (j = 0; j < part->count; j++) {
103 chain = part->chain[j];
105 for (k = 0; k < chain->scount; k++) {
106 xp = x0 + chain->sx[k];
107 yp = y0 - chain->sy[k];
118 if (part->color.color == S_COL_NONE)
120 else if (part->color.color == S_COL_DEFAULT &&
121 line_color->a != RGBA_COLOR_NONE)
122 R_RGB_color(line_color->r, line_color->g, line_color->b);
124 R_RGB_color(part->color.r, part->color.g, part->color.b);
126 chain = part->chain[0];
128 for (j = 0; j < chain->scount; j++) {
129 xp = x0 + chain->sx[j];
130 yp = y0 - chain->sy[j];
160 const RGBA_Color * primary_color,
161 const RGBA_Color * secondary_color)
165 const SYMBPART *part;
166 const SYMBCHAIN *chain;
171 G_debug(2,
"D_symbol(): %d parts", Symb->count);
173 for (i = 0; i < Symb->count; i++) {
174 part = Symb->part[i];
176 switch (part->type) {
180 if ((part->fcolor.color == S_COL_DEFAULT &&
181 primary_color->a != RGBA_COLOR_NONE) ||
182 part->fcolor.color == S_COL_DEFINED) {
183 if (part->fcolor.color == S_COL_DEFAULT)
190 for (j = 0; j < part->count; j++) {
191 chain = part->chain[j];
193 x = G_malloc(
sizeof(
int) * chain->scount);
194 y = G_malloc(
sizeof(
int) * chain->scount);
196 for (k = 0; k < chain->scount; k++) {
197 x[k] = x0 + chain->sx[k];
198 y[k] = y0 - chain->sy[k];
208 if ((part->color.color == S_COL_DEFAULT &&
209 secondary_color->a != RGBA_COLOR_NONE) ||
210 part->color.color == S_COL_DEFINED) {
211 if (part->color.color == S_COL_DEFAULT) {
212 R_RGB_color(secondary_color->r, secondary_color->g,
216 R_RGB_color(part->color.r, part->color.g, part->color.b);
218 for (j = 0; j < part->count; j++) {
219 chain = part->chain[j];
221 for (k = 0; k < chain->scount; k++) {
222 xp = x0 + chain->sx[k];
223 yp = y0 - chain->sy[k];
234 if (part->color.color == S_COL_NONE)
236 else if (part->color.color == S_COL_DEFAULT &&
237 primary_color->a != RGBA_COLOR_NONE)
241 R_RGB_color(part->color.r, part->color.g, part->color.b);
243 chain = part->chain[0];
245 for (j = 0; j < chain->scount; j++) {
246 xp = x0 + chain->sx[j];
247 yp = y0 - chain->sy[j];
void R_polygon_abs(const int *xarray, const int *yarray, int number)
draw a closed polygon
void G_free(void *buf)
Free allocated memory.
void D_symbol(const SYMBOL *Symb, int x0, int y0, const RGBA_Color *line_color, const RGBA_Color *fill_color)
draw a symbol at pixel coordinates
void R_cont_abs(int x, int y)
draw line
void R_move_abs(int x, int y)
move current location
void D_symbol2(const SYMBOL *Symb, int x0, int y0, const RGBA_Color *primary_color, const RGBA_Color *secondary_color)
draw a symbol at pixel coordinates (alternate)
int G_debug(int level, const char *msg,...)
Print debugging message.
void R_RGB_color(unsigned char red, unsigned char grn, unsigned char blu)
select color