893 CU_ASSERT(raster != NULL);
895 CU_ASSERT(band != NULL);
898 for (y = 0; y < 9; y++) {
899 for (x = 0; x < 9; x++) {
905 CU_ASSERT(colormap != NULL);
908 CU_ASSERT(colormap->
entry != NULL);
933 colormap->
method = CM_INTERPOLATE;
939 CU_ASSERT(rtn != NULL);
943 CU_ASSERT(band != NULL);
945 CU_ASSERT_DOUBLE_EQUAL(value, 0, DBL_EPSILON);
947 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
949 CU_ASSERT_DOUBLE_EQUAL(value, 255, DBL_EPSILON);
960 CU_ASSERT(rtn != NULL);
965 colormap->
method = CM_EXACT;
971 CU_ASSERT(rtn != NULL);
975 CU_ASSERT(band != NULL);
977 CU_ASSERT_DOUBLE_EQUAL(value, 0, DBL_EPSILON);
979 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
981 CU_ASSERT_DOUBLE_EQUAL(value, 255, DBL_EPSILON);
983 CU_ASSERT_DOUBLE_EQUAL(value, 0, DBL_EPSILON);
985 CU_ASSERT_DOUBLE_EQUAL(value, 0, DBL_EPSILON);
990 colormap->
method = CM_NEAREST;
996 CU_ASSERT(rtn != NULL);
1000 CU_ASSERT(band != NULL);
1002 CU_ASSERT_DOUBLE_EQUAL(value, 0, DBL_EPSILON);
1004 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1006 CU_ASSERT_DOUBLE_EQUAL(value, 255, DBL_EPSILON);
1008 CU_ASSERT_DOUBLE_EQUAL(value, 0, DBL_EPSILON);
1010 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1012 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1014 CU_ASSERT_DOUBLE_EQUAL(value, 255, DBL_EPSILON);
1020 colormap->
method = CM_NEAREST;
1026 CU_ASSERT(rtn != NULL);
1030 CU_ASSERT(band != NULL);
1032 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1034 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1036 CU_ASSERT_DOUBLE_EQUAL(value, 255, DBL_EPSILON);
1038 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1040 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1042 CU_ASSERT_DOUBLE_EQUAL(value, 127, DBL_EPSILON);
1044 CU_ASSERT_DOUBLE_EQUAL(value, 255, DBL_EPSILON);
1055 CU_ASSERT(raster != NULL);
1057 CU_ASSERT(band != NULL);
1060 for (y = 0; y < 10; y++) {
1061 for (x = 0; x < 10; x++) {
1067 CU_ASSERT(colormap != NULL);
1070 CU_ASSERT(colormap->
entry != NULL);
1144 colormap->
method = CM_INTERPOLATE;
1150 CU_ASSERT(rtn != NULL);
1154 CU_ASSERT(band != NULL);
1156 CU_ASSERT_DOUBLE_EQUAL(value, 0, DBL_EPSILON);
1158 CU_ASSERT_DOUBLE_EQUAL(value, 14, DBL_EPSILON);
1160 CU_ASSERT_DOUBLE_EQUAL(value, 17, DBL_EPSILON);
1162 CU_ASSERT_DOUBLE_EQUAL(value, 25, DBL_EPSILON);
1165 CU_ASSERT_DOUBLE_EQUAL(value, 28, DBL_EPSILON);
1167 CU_ASSERT_DOUBLE_EQUAL(value, 43, DBL_EPSILON);
1169 CU_ASSERT_DOUBLE_EQUAL(value, 57, DBL_EPSILON);
1172 CU_ASSERT_DOUBLE_EQUAL(value, 170, DBL_EPSILON);
1174 CU_ASSERT_DOUBLE_EQUAL(value, 198, DBL_EPSILON);
1176 CU_ASSERT_DOUBLE_EQUAL(value, 227, DBL_EPSILON);
int rt_raster_get_num_bands(rt_raster raster)
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
void * rtalloc(size_t size)
Wrappers used for managing memory.
rt_errorstate rt_band_set_nodata(rt_band band, double val, int *converted)
Set nodata value.
void cu_free_raster(rt_raster raster)
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
enum rt_colormap_t::@7 method
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
struct rt_colormap_entry_t * rt_colormap_entry
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
void rtdealloc(void *mem)
struct rt_colormap_t * rt_colormap
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
rt_raster rt_raster_colormap(rt_raster raster, int nband, rt_colormap colormap)
Returns a new raster with up to four 8BUI bands (RGBA) from applying a colormap to the user-specified...