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.
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.
446 {
448
449 assert(band != NULL);
450
451
457 band->data.offline.bandNum, (
const char *)
band->data.offline.path
458 );
459 }
460
461 else {
462 uint8_t *
data = NULL;
464 if (data == NULL) {
465 rterror(
"rt_band_duplicate: Out of memory allocating online band data");
466 return NULL;
467 }
469
474 data
475 );
477 }
478
479 if (rtn == NULL) {
480 rterror(
"rt_band_duplicate: Could not copy band");
481 return NULL;
482 }
483
484 return rtn;
485}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
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.
void rt_band_set_ownsdata_flag(rt_band band, int flag)
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.