45 for (i = 0; i <
rows; i++) {
48 for (j = 0; j <
cols; j++) {
54 for (i = 0; i <
rows; i++) {
57 for (j = 0; j <
cols; j++) {
58 if (
GET_MAPATT(frombuff, (ioff + j), curval)) {
59 BM_set(bm, j, i, (curval == maskval));
112 static int gsbm_masks(
struct BM *bmvar,
struct BM *bmcon,
const int mask_type)
115 int varsize, consize, numbytes;
117 varsize = bmvar->
rows * bmvar->
cols;
118 consize = bmcon->
rows * bmcon->
cols;
121 if (bmcon && bmvar) {
122 if (varsize != consize) {
132 for (i = 0; i < numbytes; i++)
136 for (i = 0; i < numbytes; i++)
140 for (i = 0; i < numbytes; i++)
144 for (i = 0; i < numbytes; i++)
169 return gsbm_masks(bmvar, bmcon,
MASK_OR);
203 return gsbm_masks(bmvar, bmcon,
MASK_AND);
220 return gsbm_masks(bmvar, bmcon,
MASK_XOR);
233 struct BM *b_mask, *b_topo, *b_color;
234 typbuff *t_topo, *t_mask, *t_color;
235 int row, col, offset, destroy_ok = 1;
254 b_mask = b_topo = b_color =
NULL;
274 for (row = 0; row < surf->
rows; row++) {
275 for (col = 0; col < surf->
cols; col++) {
276 offset = row * surf->
cols + col;
295 for (row = 0; row < surf->
rows; row++) {
296 for (col = 0; col < surf->
cols; col++) {
297 offset = row * surf->
cols + col;
306 G_debug(5,
"gs_update_curmask(): update topo mask");
312 G_debug(5,
"gs_update_curmask(): update color mask");
318 G_debug(5,
"gs_update_curmask(): update elev null mask");
323 G_debug(5,
"gs_update_curmask(): update mask mask");
365 for (i = 0; i < bm->
rows; i++) {
366 for (j = 0; j < bm->
cols; j++) {
367 fprintf(stderr,
"%d ",
BM_get(bm, j, i));
370 fprintf(stderr,
"\n");
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
int BM_destroy(struct BM *)
Destroy bitmap and free all associated memory.
int BM_set(struct BM *, int, int, int)
Sets bitmap value to 'val' at location 'x' 'y'.
struct BM * BM_create(int, int)
Create bitmap of dimension x/y and return structure token.
void G_warning(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int gs_masked(typbuff *, int, int, int)
Should only be called when setting up the current mask (gs_bm.c)
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
void gs_set_maskmode(int)
Set geosurf mask mode.
int gs_mask_defined(geosurf *)
Check if mask is defined.
int gsbm_and_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type ADD)
int gsbm_ornot_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type ORNOT)
#define MASK_OR
mask types
struct BM * gsbm_make_mask(typbuff *frombuff, float maskval, int rows, int cols)
Do combining of bitmaps, make bitmaps from other data w/maskval.
int gsbm_or_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type OR)
int gs_update_curmask(geosurf *surf)
Update current maps.
int gsbm_xor_masks(struct BM *bmvar, struct BM *bmcon)
Mask bitmap (mask type XOR)
void print_bm(struct BM *bm)
Print bitmap to stderr.
void gsbm_zero_mask(struct BM *map)
Zero mask.
#define GET_MAPATT(buff, offset, att)