zero_cell.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #include <string.h>
  14. #include <grass/gis.h>
  15. #include <grass/raster.h>
  16. /*!
  17. * \brief Zero a raster buffer.
  18. *
  19. * This routines assigns each member of the raster buffer array
  20. * <i>rast</i> to zero. It assumes that <i>rast</i> has been allocated
  21. * using Rast_allocate_c_buf().
  22. *
  23. * \param rast data buffer
  24. * \param data_type raster type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
  25. */
  26. void Rast_zero_buf(void *rast, RASTER_MAP_TYPE data_type)
  27. {
  28. memset(rast, 0, Rast_window_cols() * Rast_cell_size(data_type));
  29. }
  30. void Rast_zero_input_buf(void *rast, RASTER_MAP_TYPE data_type)
  31. {
  32. memset(rast, 0, Rast_input_window_cols() * Rast_cell_size(data_type));
  33. }
  34. void Rast_zero_output_buf(void *rast, RASTER_MAP_TYPE data_type)
  35. {
  36. memset(rast, 0, Rast_output_window_cols() * Rast_cell_size(data_type));
  37. }