GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-f63024f571
gs_bm.c File Reference

OGSF library - manipulating bitmaps (lower level functions) More...

#include <grass/gis.h>
#include <grass/glocale.h>
#include <grass/ogsf.h>
#include "gsget.h"
Include dependency graph for gs_bm.c:

Go to the source code of this file.

Macros

#define MASK_OR   1
 mask types More...
 
#define MASK_ORNOT   2
 
#define MASK_AND   3
 
#define MASK_XOR   4
 

Functions

struct BMgsbm_make_mask (typbuff *frombuff, float maskval, int rows, int cols)
 Do combining of bitmaps, make bitmaps from other data w/maskval. More...
 
void gsbm_zero_mask (struct BM *map)
 Zero mask. More...
 
int gsbm_or_masks (struct BM *bmvar, struct BM *bmcon)
 Mask bitmap (mask type OR) More...
 
int gsbm_ornot_masks (struct BM *bmvar, struct BM *bmcon)
 Mask bitmap (mask type ORNOT) More...
 
int gsbm_and_masks (struct BM *bmvar, struct BM *bmcon)
 Mask bitmap (mask type ADD) More...
 
int gsbm_xor_masks (struct BM *bmvar, struct BM *bmcon)
 Mask bitmap (mask type XOR) More...
 
int gs_update_curmask (geosurf *surf)
 Update current maps. More...
 
void print_bm (struct BM *bm)
 Print bitmap to stderr. More...
 

Detailed Description

OGSF library - manipulating bitmaps (lower level functions)

GRASS OpenGL gsurf OGSF Library

(C) 1999-2008 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Bill Brown USACERL, GMSL/University of Illinois (September 1993)
Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)

Definition in file gs_bm.c.

Macro Definition Documentation

◆ MASK_AND

#define MASK_AND   3

Definition at line 97 of file gs_bm.c.

◆ MASK_OR

#define MASK_OR   1

mask types

Definition at line 95 of file gs_bm.c.

◆ MASK_ORNOT

#define MASK_ORNOT   2

Definition at line 96 of file gs_bm.c.

◆ MASK_XOR

#define MASK_XOR   4

Definition at line 98 of file gs_bm.c.

Function Documentation

◆ gs_update_curmask()

◆ gsbm_and_masks()

int gsbm_and_masks ( struct BM bmvar,
struct BM bmcon 
)

Mask bitmap (mask type ADD)

Must be same size, ADDs bitmaps & stores in bmvar

Parameters
bmvarbitmap (BM) to changed
bmcombitmap (BM)
mask_typemask type (see mask types macros)
Returns
-1 on failure (bitmap mispatch)
0 on success

Definition at line 201 of file gs_bm.c.

◆ gsbm_make_mask()

struct BM* gsbm_make_mask ( typbuff frombuff,
float  maskval,
int  rows,
int  cols 
)

Do combining of bitmaps, make bitmaps from other data w/maskval.

Parameters
frombuffdata buffer
maskvalmask type
rowsnumber of rows
colsnumber of cols
Returns
pointer to BM struct

Definition at line 35 of file gs_bm.c.

References typbuff::bm, BM_create(), BM_get(), BM_set(), BM::cols, GET_MAPATT, and BM::rows.

Referenced by gs_update_curmask().

◆ gsbm_or_masks()

int gsbm_or_masks ( struct BM bmvar,
struct BM bmcon 
)

Mask bitmap (mask type OR)

Must be same size, ORs bitmaps & stores in bmvar

Parameters
bmvarbitmap (BM) to changed
bmcombitmap (BM)
mask_typemask type (see mask types macros)
Returns
-1 on failure (bitmap mispatch)
0 on success

Definition at line 167 of file gs_bm.c.

Referenced by gs_update_curmask().

◆ gsbm_ornot_masks()

int gsbm_ornot_masks ( struct BM bmvar,
struct BM bmcon 
)

Mask bitmap (mask type ORNOT)

Must be same size, ORNOTs bitmaps & stores in bmvar

Parameters
bmvarbitmap (BM) to changed
bmcombitmap (BM)
mask_typemask type (see mask types macros)
Returns
-1 on failure (bitmap mispatch)
0 on success

Definition at line 184 of file gs_bm.c.

Referenced by gs_update_curmask().

◆ gsbm_xor_masks()

int gsbm_xor_masks ( struct BM bmvar,
struct BM bmcon 
)

Mask bitmap (mask type XOR)

Must be same size, XORs bitmaps & stores in bmvar

Parameters
bmvarbitmap (BM) to changed
bmcombitmap (BM)
mask_typemask type (see mask types macros)
Returns
-1 on failure (bitmap mispatch)
0 on success

Definition at line 218 of file gs_bm.c.

◆ gsbm_zero_mask()

void gsbm_zero_mask ( struct BM map)

Zero mask.

Parameters
mappointer to BM struct

Definition at line 77 of file gs_bm.c.

References BM::bytes, BM::data, and BM::rows.

Referenced by gs_update_curmask().

◆ print_bm()

void print_bm ( struct BM bm)

Print bitmap to stderr.

Parameters
bmbitmap (BM)

Definition at line 361 of file gs_bm.c.

References BM_get(), BM::cols, and BM::rows.