GRASS Programmer's Manual
6.4.2(2012)
|
GIS Library - Raster allocation routines. More...
#include <math.h>
#include <grass/gis.h>
Go to the source code of this file.
Defines | |
#define | F2I(map_type) (map_type == CELL_TYPE ? 0 : (map_type == FCELL_TYPE ? 1 : 2)) |
Functions | |
size_t | G_raster_size (RASTER_MAP_TYPE data_type) |
Returns size of a raster CELL in bytes. | |
CELL * | G_allocate_cell_buf (void) |
Allocate memory for a CELL type raster map. | |
void * | G_allocate_raster_buf (RASTER_MAP_TYPE data_type) |
Allocate memory for a raster map of type data_type. | |
CELL * | G_allocate_c_raster_buf (void) |
Allocates memory for a raster map of type CELL. | |
FCELL * | G_allocate_f_raster_buf (void) |
Allocates memory for a raster map of type FCELL. | |
DCELL * | G_allocate_d_raster_buf (void) |
Allocates memory for a raster map of type DCELL. | |
char * | G_allocate_null_buf (void) |
Allocates memory for a null buffer. | |
unsigned char * | G__allocate_null_bits (int cols) |
Allocates memory for null bits. | |
int | G__null_bitstream_size (int cols) |
Determines null bitstream size. |
GIS Library - Raster allocation routines.
(C) 2001-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.
Definition in file alloc_cell.c.
#define F2I | ( | map_type | ) | (map_type == CELL_TYPE ? 0 : (map_type == FCELL_TYPE ? 1 : 2)) |
Definition at line 21 of file alloc_cell.c.
Referenced by G_raster_size().
unsigned char* G__allocate_null_bits | ( | int | cols | ) |
Allocates memory for null bits.
Allocates an array of unsigned char based on cols.
[in] | cols | number of columns in region |
Definition at line 156 of file alloc_cell.c.
References G__null_bitstream_size().
Referenced by G__open_cell_old().
int G__null_bitstream_size | ( | int | cols | ) |
Determines null bitstream size.
[in] | cols | number of columns |
Definition at line 171 of file alloc_cell.c.
Referenced by G__allocate_null_bits(), G__check_null_bit(), G__convert_01_flags(), G__convert_flags_01(), G__init_null_bits(), G__set_flags_from_01_random(), and G__write_null_bits().
CELL* G_allocate_c_raster_buf | ( | void | ) |
Allocates memory for a raster map of type CELL.
Allocate an array of CELL based on the number of columns in the current region.
Definition at line 96 of file alloc_cell.c.
References G_window_cols().
Referenced by G_get_null_value_row(), and Gs_get_cat_label().
CELL* G_allocate_cell_buf | ( | void | ) |
Allocate memory for a CELL type raster map.
This routine allocates a buffer of type CELL just large enough to hold one row of raster data based on the number of columns in the active region.
CELL *cell; cell = G_allocate_cell_buf ();
If larger buffers are required, the routine G_malloc can be used. The routine is generally used with each open cell file.
Note: G_allocate_raster_buf() or G_alloc_c_raster_buf() is preferred over G_allocate_cell_buf().
Definition at line 64 of file alloc_cell.c.
References G_window_cols().
Referenced by IL_create_bitmask().
DCELL* G_allocate_d_raster_buf | ( | void | ) |
Allocates memory for a raster map of type DCELL.
Allocate an array of DCELL based on the number of columns in the current region.
Definition at line 126 of file alloc_cell.c.
References G_window_cols().
Referenced by G_get_raster_sample_bilinear(), G_get_raster_sample_cubic(), G_get_raster_sample_nearest(), and Gs_get_cat_label().
FCELL* G_allocate_f_raster_buf | ( | void | ) |
Allocates memory for a raster map of type FCELL.
Allocate an array of FCELL based on the number of columns in the current region.
Definition at line 111 of file alloc_cell.c.
References G_window_cols().
Referenced by IL_output_2d(), and IL_resample_output_2d().
char* G_allocate_null_buf | ( | void | ) |
Allocates memory for a null buffer.
Allocate an array of char based on the number of columns in the current region.
Definition at line 141 of file alloc_cell.c.
References G_window_cols().
Referenced by Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), and Gs_loadmap_as_short().
void* G_allocate_raster_buf | ( | RASTER_MAP_TYPE | data_type | ) |
Allocate memory for a raster map of type data_type.
Allocate an array of CELL, FCELL, or DCELL (depending on data_type) based on the number of columns in the current region.
[in] | data_type |
Definition at line 81 of file alloc_cell.c.
References G_raster_size(), and G_window_cols().
Referenced by N_read_rast_to_array_2d(), and N_write_array_2d_to_rast().
size_t G_raster_size | ( | RASTER_MAP_TYPE | data_type | ) |
Returns size of a raster CELL in bytes.
If data_type is CELL_TYPE, returns sizeof(CELL) If data_type is FCELL_TYPE, returns sizeof(FCELL) If data_type is DCELL_TYPE, returns sizeof(DCELL)
[in] | data_type |
Definition at line 38 of file alloc_cell.c.
References F2I.
Referenced by D_draw_raster_RGB(), G__lookup_colors(), G__set_null_value(), G_allocate_raster_buf(), G_get_raster_row_colors(), G_mark_raster_cats(), G_raster_cpy(), G_row_update_fp_range(), G_zero_raster_buf(), and N_read_rast_to_array_2d().