28 #include <grass/gis.h>
29 #include <grass/raster.h>
30 #include <grass/display.h>
34 static int src[2][2], dst[2][2];
36 static int draw_cell(
int,
const void *,
struct Colors *, RASTER_MAP_TYPE);
40 struct Colors *colors, RASTER_MAP_TYPE data_type)
42 return draw_cell(A_row, array, colors, data_type);
47 return draw_cell(A_row, darray, colors, DCELL_TYPE);
52 return draw_cell(A_row, farray, colors, FCELL_TYPE);
57 return draw_cell(A_row, carray, colors, CELL_TYPE);
77 int D_draw_cell(
int A_row,
const CELL * carray,
struct Colors *colors)
79 return draw_cell(A_row, carray, colors, CELL_TYPE);
82 static int draw_cell(
int A_row,
84 struct Colors *colors, RASTER_MAP_TYPE data_type)
86 static unsigned char *red, *grn, *blu, *
set;
89 int ncols = src[0][1] - src[0][0];
94 red = G_realloc(red, nalloc);
95 grn = G_realloc(grn, nalloc);
96 blu = G_realloc(blu, nalloc);
97 set = G_realloc(set, nalloc);
104 for (i = 0; i < ncols; i++) {
113 return (A_row < src[1][1])
134 struct Cell_head window;
151 const void *r_raster,
const void *g_raster,
152 const void *b_raster,
struct Colors *r_colors,
153 struct Colors *g_colors,
struct Colors *b_colors,
154 RASTER_MAP_TYPE r_type, RASTER_MAP_TYPE g_type,
155 RASTER_MAP_TYPE b_type)
157 static unsigned char *r_buf, *g_buf, *b_buf, *n_buf;
163 int ncols = src[0][1] - src[0][0];
167 if (nalloc < ncols) {
169 r_buf = G_realloc(r_buf, nalloc);
170 g_buf = G_realloc(g_buf, nalloc);
171 b_buf = G_realloc(b_buf, nalloc);
172 n_buf = G_realloc(n_buf, nalloc);
184 for (i = 0; i < ncols; i++) {
198 return (A_row < src[1][1])
int G_lookup_raster_colors(const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, RASTER_MAP_TYPE map_type)
If the cell_type is CELL_TYPE, calls G_lookup_colors((CELL *)cell, r, g, b, set, n, colors); If the cell_type is FCELL_TYPE, calls G_lookup_f_raster_colors(FCELL *)cell, r, g, b, set, n, colors); If the cell_type is DCELL_TYPE, calls G_lookup_d_raster_colors(DCELL *)cell, r, g, b, set, n, colors);.
int G_get_set_window(struct Cell_head *window)
Get the current working window.
int D_cell_draw_setup(int t, int b, int l, int r)
prepare for raster graphic
int D_draw_raster(int A_row, const void *array, struct Colors *colors, RASTER_MAP_TYPE data_type)
int D_draw_cell(int A_row, const CELL *carray, struct Colors *colors)
render a raster row
void * G_incr_void_ptr(const void *ptr, const size_t size)
Advance void pointer.
void R_end_scaled_raster(void)
int D_do_conversions(const struct Cell_head *window, int t, int b, int l, int r)
initialize conversions
int R_scaled_raster(int n, int row, const unsigned char *red, const unsigned char *grn, const unsigned char *blu, const unsigned char *nul)
int D_draw_d_raster(int A_row, const DCELL *darray, struct Colors *colors)
int D_draw_raster_RGB(int A_row, const void *r_raster, const void *g_raster, const void *b_raster, struct Colors *r_colors, struct Colors *g_colors, struct Colors *b_colors, RASTER_MAP_TYPE r_type, RASTER_MAP_TYPE g_type, RASTER_MAP_TYPE b_type)
size_t G_raster_size(RASTER_MAP_TYPE data_type)
Returns size of a raster CELL in bytes.
void D_get_d(int x[2][2])
void D_cell_draw_end(void)
void R_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
int D_draw_f_raster(int A_row, const FCELL *farray, struct Colors *colors)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
void D_get_a(int x[2][2])
int G_is_null_value(const void *rast, RASTER_MAP_TYPE data_type)
If the data_type is CELL_TYPE, calls G_is_c_null_value ((CELL *) rast); If the data_type is FCELL_TYP...
int D_draw_c_raster(int A_row, const CELL *carray, struct Colors *colors)