46 for (i = 0; i <
rows; i++) {
49 for (j = 0; j <
cols; j++) {
55 for (i = 0; i <
rows; i++) {
58 for (j = 0; j <
cols; j++) {
59 if (
GET_MAPATT(frombuff, (ioff + j), curval)) {
60 BM_set(bm, j, i, (curval == maskval));
113 static int gsbm_masks(
struct BM *bmvar,
struct BM *bmcon,
const int mask_type)
116 int varsize, consize, numbytes;
118 varsize = bmvar->
rows * bmvar->
cols;
119 consize = bmcon->
rows * bmcon->
cols;
122 if (bmcon && bmvar) {
123 if (varsize != consize) {
133 for (i = 0; i < numbytes; i++)
137 for (i = 0; i < numbytes; i++)
141 for (i = 0; i < numbytes; i++)
145 for (i = 0; i < numbytes; i++)
170 return gsbm_masks(bmvar, bmcon,
MASK_OR);
204 return gsbm_masks(bmvar, bmcon,
MASK_AND);
221 return gsbm_masks(bmvar, bmcon,
MASK_XOR);
234 struct BM *b_mask, *b_topo, *b_color;
235 typbuff *t_topo, *t_mask, *t_color;
236 int row, col, offset, destroy_ok = 1;
255 b_mask = b_topo = b_color =
NULL;
275 for (row = 0; row < surf->
rows; row++) {
276 for (col = 0; col < surf->
cols; col++) {
277 offset = row * surf->
cols + col;
296 for (row = 0; row < surf->
rows; row++) {
297 for (col = 0; col < surf->
cols; col++) {
298 offset = row * surf->
cols + col;
307 G_debug(5,
"gs_update_curmask(): update topo mask");
313 G_debug(5,
"gs_update_curmask(): update color mask");
319 G_debug(5,
"gs_update_curmask(): update elev null mask");
324 G_debug(5,
"gs_update_curmask(): update mask mask");
367 for (i = 0; i < bm->
rows; i++) {
368 for (j = 0; j < bm->
cols; j++) {
369 fprintf(stderr,
"%d ",
BM_get(bm, j, i));
372 fprintf(stderr,
"\n");
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
int gs_mask_defined(geosurf *)
Check if mask is defined.
int gs_masked(typbuff *, int, int, int)
Should only be called when setting up the current mask (gs_bm.c)
int BM_set(struct BM *, int, int, int)
Sets bitmap value to 'val' at location 'x' 'y'.
int gsbm_ornot_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type ORNOT)
int gsbm_xor_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type XOR)
int BM_destroy(struct BM *)
Destroy bitmap and free all associated memory.
int gsbm_and_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type ADD)
void gsbm_zero_mask(struct BM *map)
Zero mask.
void gs_set_maskmode(int)
Set geosurf mask mode.
int gsbm_or_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type OR)
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
struct BM * BM_create(int, int)
Create bitmap of dimension x/y and return structure token.
void print_bm(struct BM *bm)
Print bitmap to stderr.
struct BM * gsbm_make_mask(typbuff *frombuff, float maskval, int rows, int cols)
Do combining of bitmaps, make bitmaps from other data w/maskval.
void G_warning(const char *,...) __attribute__((format(printf
#define MASK_OR
mask types
int G_debug(int, const char *,...) __attribute__((format(printf
int gs_update_curmask(geosurf *surf)
Update current maps.
#define GET_MAPATT(buff, offset, att)