Create a new band duplicated from source band.
Memory is allocated for band path (if band is offline) or band data (if band is online). The caller is responsible for freeing the memory when the returned rt_band is destroyed.
- Parameters
-
- Returns
- an rt_band or NULL on failure
Definition at line 186 of file rt_band.c.
References ovdump::data, rt_band_t::data, rt_band_t::hasnodata, rt_band_t::height, rt_band_t::mem, rt_band_t::nodataval, rt_band_t::offline, rt_band_t::pixtype, rt_band_new_inline(), rt_band_new_offline(), rt_band_set_ownsdata_flag(), rt_pixtype_size(), rtalloc(), rterror(), and rt_band_t::width.
Referenced by rt_raster_copy_band().
189 assert(band != NULL);
205 rterror(
"rt_band_duplicate: Out of memory allocating online band data");
220 rterror(
"rt_band_duplicate: Could not copy band");
rt_band rt_band_new_offline(uint16_t width, uint16_t height, rt_pixtype pixtype, uint32_t hasnodata, double nodataval, uint8_t bandNum, const char *path)
Create an out-db rt_band.
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
void rt_band_set_ownsdata_flag(rt_band band, int flag)
int rt_pixtype_size(rt_pixtype pixtype)
Return size in bytes of a value in the given pixtype.
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.