863 {
865 uint8_t *
data = NULL;
867 int width = 5;
868 int height = 5;
869 int err = 0;
870 int clamped = 0;
871 double val = 0;
874
875
877 CU_ASSERT(data != NULL);
879
881 width, height,
882 pixtype,
883 0, 0,
884 data
885 );
886 CU_ASSERT(band != NULL);
889
892 CU_ASSERT(!clamped);
894 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
895
898 CU_ASSERT(!clamped);
900 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
901
904 CU_ASSERT(!clamped);
906 CU_ASSERT_DOUBLE_EQUAL(val, 65535, DBL_EPSILON);
907
910 CU_ASSERT(!clamped);
912 CU_ASSERT_DOUBLE_EQUAL(val, 4294967295UL, DBL_EPSILON);
913
914
917 CU_ASSERT(clamped);
918
919
922 CU_ASSERT(clamped);
923
924
927
934 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
935
940 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
941
946 CU_ASSERT_DOUBLE_EQUAL(val, 65535, DBL_EPSILON);
947
952 CU_ASSERT_DOUBLE_EQUAL(val, 4294967295UL, DBL_EPSILON);
953 }
954 }
955
957}
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)
void * rtalloc(size_t size)
Wrappers used for managing memory.
uint16_t rt_band_get_width(rt_band band)
Return width of this band.
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
rt_errorstate rt_band_set_nodata(rt_band band, double val, int *converted)
Set nodata value.
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
void rt_band_destroy(rt_band band)
Destroy a raster band.
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
int rt_band_get_ownsdata_flag(rt_band band)
Return 0 (FALSE) or non-zero (TRUE) indicating if rt_band is responsible for managing the memory for ...
uint16_t rt_band_get_height(rt_band band)
Return height of this band.
int rt_pixtype_size(rt_pixtype pixtype)
Return size in bytes of a value in the given pixtype.