PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum RASTER_minPossibleValue ( PG_FUNCTION_ARGS  )

Definition at line 1067 of file rt_pg.c.

References PT_16BUI, PT_1BB, PT_2BUI, PT_32BUI, PT_4BUI, PT_8BUI, PT_END, rt_pixtype_get_min_value(), and rt_pixtype_index_from_name().

1068 {
1069  text *pixeltypetext = NULL;
1070  char *pixeltypechar = NULL;
1071  rt_pixtype pixtype = PT_END;
1072  double pixsize = 0;
1073 
1074  if (PG_ARGISNULL(0))
1075  PG_RETURN_NULL();
1076 
1077  pixeltypetext = PG_GETARG_TEXT_P(0);
1078  pixeltypechar = text_to_cstring(pixeltypetext);
1079 
1080  pixtype = rt_pixtype_index_from_name(pixeltypechar);
1081  if (pixtype == PT_END) {
1082  elog(ERROR, "RASTER_minPossibleValue: Invalid pixel type: %s", pixeltypechar);
1083  PG_RETURN_NULL();
1084  }
1085 
1086  pixsize = rt_pixtype_get_min_value(pixtype);
1087 
1088  /*
1089  correct pixsize of unsigned pixel types
1090  example: for PT_8BUI, the value is CHAR_MIN but if char is signed,
1091  the value returned is -127 instead of 0.
1092  */
1093  switch (pixtype) {
1094  case PT_1BB:
1095  case PT_2BUI:
1096  case PT_4BUI:
1097  case PT_8BUI:
1098  case PT_16BUI:
1099  case PT_32BUI:
1100  pixsize = 0;
1101  break;
1102  default:
1103  break;
1104  }
1105 
1106  PG_RETURN_FLOAT8(pixsize);
1107 }
Definition: rt_api.h:184
double rt_pixtype_get_min_value(rt_pixtype pixtype)
Return minimum value possible for pixel type.
Definition: rt_api.c:1206
Definition: rt_api.h:173
rt_pixtype
Definition: rt_api.h:172
rt_pixtype rt_pixtype_index_from_name(const char *pixname)
Definition: rt_api.c:1138

Here is the call graph for this function: