PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ cu_add_band()

rt_band cu_add_band ( rt_raster  raster,
rt_pixtype  pixtype,
int  hasnodata,
double  nodataval 

Definition at line 224 of file raster/test/cunit/cu_tester.c.

224  {
225  void* mem = NULL;
226  int32_t bandNum = 0;
227  size_t datasize = 0;
228  rt_band band = NULL;
229  uint16_t width = 0;
230  uint16_t height = 0;
232  width = rt_raster_get_width(raster);
233  height = rt_raster_get_height(raster);
235  datasize = rt_pixtype_size(pixtype) * width * height;
236  mem = rtalloc(datasize);
237  CU_ASSERT(mem != NULL);
239  if (hasnodata)
240  memset(mem, nodataval, datasize);
241  else
242  memset(mem, 0, datasize);
244  band = rt_band_new_inline(width, height, pixtype, hasnodata, nodataval, mem);
245  CU_ASSERT(band != NULL);
249  CU_ASSERT(bandNum >= 0);
251  return band;
252 }
rt_band rt_band_new_inline(uint16_t width, uint16_t height, rt_pixtype pixtype, uint32_t hasnodata, double nodataval, uint8_t *data)
Create an in-db rt_band with no data.
Definition: rt_band.c:63
void rt_band_set_ownsdata_flag(rt_band band, int flag)
Definition: rt_band.c:667
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:171
int rt_raster_add_band(rt_raster raster, rt_band band, int index)
Add band data to a raster.
Definition: rt_raster.c:405
uint16_t rt_raster_get_num_bands(rt_raster raster)
Definition: rt_raster.c:372
uint16_t rt_raster_get_height(rt_raster raster)
Definition: rt_raster.c:129
uint16_t rt_raster_get_width(rt_raster raster)
Definition: rt_raster.c:121
int rt_pixtype_size(rt_pixtype pixtype)
Return size in bytes of a value in the given pixtype.
Definition: rt_pixel.c:39
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...

References ovdump::band, rtrowdump::raster, rt_band_new_inline(), rt_band_set_ownsdata_flag(), rt_pixtype_size(), rt_raster_add_band(), rt_raster_get_height(), rt_raster_get_num_bands(), rt_raster_get_width(), and rtalloc().

Referenced by fillRasterToPolygonize(), test_band_get_nearest_pixel(), test_band_get_pixel_line(), test_band_get_pixel_of_value(), test_band_reclass(), test_band_stats(), test_band_value_count(), test_gdal_to_raster(), test_gdal_warp(), test_pixel_set_to_array(), test_raster_clone(), test_raster_colormap(), test_raster_from_band(), test_raster_fully_within_distance(), test_raster_geos_contains(), test_raster_geos_contains_properly(), test_raster_geos_covered_by(), test_raster_geos_covers(), test_raster_geos_overlaps(), test_raster_geos_touches(), test_raster_intersects(), test_raster_iterator(), test_raster_perimeter(), test_raster_pixel_as_polygon(), test_raster_replace_band(), test_raster_surface(), test_raster_to_gdal(), and test_raster_within_distance().

Here is the call graph for this function:
Here is the caller graph for this function: