GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
Go to the source code of this file.
Macros | |
#define | BM_col_to_byte(x) ((x) >> 3) /* x / 8 */ |
#define | BM_col_to_bit(x) ((x) & 7) /* x % 8 */ |
Functions | |
struct BM * | BM_create (int x, int y) |
Create bitmap of dimension x/y and return structure token. More... | |
int | BM_destroy (struct BM *map) |
Destroy bitmap and free all associated memory. More... | |
int | BM_set_mode (int mode, int size) |
Specify the type of data structure to use for bitmap. 'mode' can be either BM_FLAT or BM_SPARSE: More... | |
int | BM_set (struct BM *map, int x, int y, int val) |
Sets bitmap value to 'val' at location 'x' 'y'. More... | |
int | BM_get (struct BM *map, int x, int y) |
Gets 'val' from the bitmap. More... | |
size_t | BM_get_map_size (struct BM *map) |
Returns size in bytes that bitmap is taking up. More... | |
int | BM_file_write (FILE *fp, struct BM *map) |
Write bitmap out to file. More... | |
struct BM * | BM_file_read (FILE *fp) |
Create map structure and load it from file. More... | |
struct BM* BM_create | ( | int | x, |
int | y | ||
) |
Create bitmap of dimension x/y and return structure token.
Bitmap is initialized to all zeros
x | x dimension |
y | y dimension |
Definition at line 58 of file bitmap.c.
Referenced by gs_update_curmask(), gsbm_make_mask(), IL_create_bitmask(), and main().
int BM_destroy | ( | struct BM * | map | ) |
Destroy bitmap and free all associated memory.
map |
Definition at line 89 of file bitmap.c.
References BM_destroy_sparse(), BM::data, free(), and BM::sparse.
Referenced by gs_update_curmask().
struct BM* BM_file_read | ( | FILE * | fp | ) |
Create map structure and load it from file.
'fp' should previously been created by BM_file_write()
Returns struct BM * or NULL on error
fp |
int BM_file_write | ( | FILE * | fp, |
struct BM * | map | ||
) |
int BM_get | ( | struct BM * | map, |
int | x, | ||
int | y | ||
) |
Gets 'val' from the bitmap.
Returns 0 or 1 on success or -1 on error
map | |
x | |
y |
Definition at line 217 of file bitmap.c.
References BM_col_to_bit, BM_col_to_byte, BM_get_sparse(), BM::bytes, BM::cols, BM::data, BM::rows, BM::sparse, and x.
Referenced by calc_norm(), get_mapatt(), gs_masked(), gs_point_is_masked(), gsbm_make_mask(), gsd_wire_arrows(), gsd_wire_surf_const(), gsd_wire_surf_map(), IL_secpar_loop_2d(), and print_bm().
size_t BM_get_map_size | ( | struct BM * | map | ) |
Returns size in bytes that bitmap is taking up.
map |
Definition at line 241 of file bitmap.c.
References BM_get_map_size_sparse(), BM::bytes, BM::rows, and BM::sparse.
int BM_set | ( | struct BM * | map, |
int | x, | ||
int | y, | ||
int | val | ||
) |
Sets bitmap value to 'val' at location 'x' 'y'.
Returns 0 on success
map | |
x | |
y | |
val |
Definition at line 185 of file bitmap.c.
References BM_col_to_bit, BM_col_to_byte, BM_set_sparse(), BM::bytes, BM::cols, BM::data, BM::rows, BM::sparse, and x.
Referenced by gs_update_curmask(), gsbm_make_mask(), IL_create_bitmask(), and main().
int BM_set_mode | ( | int | mode, |
int | size | ||
) |
Specify the type of data structure to use for bitmap. 'mode' can be either BM_FLAT or BM_SPARSE:
BM_FLAT is a basic packed bitmap - eight values stored per byte thus creating a 1:8 compression over using char arrays and a 1:32 compression over using CELL arrays.
BM_SPARSE is a linked array of values. This is much more efficient for large, very sparse arrays. It is slower to access, especially for writing, but can save several orders of magnitude of memory on large bitmaps.
NOTE: At this time 'size' must be passed a value of 1
returns 0 on success or -1 on error
mode | |
size |