GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
zero_cell.c
Go to the documentation of this file.
1 /*!
2  * \file lib/raster/zero_cell.c
3  *
4  * \brief Raster Library - Zero cell buffer functions.
5  *
6  * (C) 2001-2009 by the GRASS Development Team
7  *
8  * This program is free software under the GNU General Public License
9  * (>=v2). Read the file COPYING that comes with GRASS for details.
10  *
11  * \author Original author CERL
12  */
13 
14 #include <string.h>
15 #include <grass/gis.h>
16 #include <grass/raster.h>
17 
18 /*!
19  * \brief Zero a raster buffer.
20  *
21  * This routines assigns each member of the raster buffer array
22  * <i>rast</i> to zero. It assumes that <i>rast</i> has been allocated
23  * using Rast_allocate_c_buf().
24  *
25  * \param rast data buffer
26  * \param data_type raster type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
27  */
28 void Rast_zero_buf(void *rast, RASTER_MAP_TYPE data_type)
29 {
30  memset(rast, 0, Rast_window_cols() * Rast_cell_size(data_type));
31 }
32 
33 void Rast_zero_input_buf(void *rast, RASTER_MAP_TYPE data_type)
34 {
35  memset(rast, 0, Rast_input_window_cols() * Rast_cell_size(data_type));
36 }
37 
38 void Rast_zero_output_buf(void *rast, RASTER_MAP_TYPE data_type)
39 {
40  memset(rast, 0, Rast_output_window_cols() * Rast_cell_size(data_type));
41 }
int Rast_input_window_cols(void)
Number of columns in active input window.
void Rast_zero_output_buf(void *rast, RASTER_MAP_TYPE data_type)
Definition: zero_cell.c:38
void Rast_zero_buf(void *rast, RASTER_MAP_TYPE data_type)
Zero a raster buffer.
Definition: zero_cell.c:28
void Rast_zero_input_buf(void *rast, RASTER_MAP_TYPE data_type)
Definition: zero_cell.c:33
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
Definition: alloc_cell.c:39
int Rast_window_cols(void)
Number of columns in active window.
int RASTER_MAP_TYPE
Definition: raster.h:25
int Rast_output_window_cols(void)
Number of columns in active output window.