| 192 | } |
| 193 | |
| 194 | void Palette::saveCurrentToJson( Json::Value& root ) const |
| 195 | { |
| 196 | Json::Value colorsArray = Json::arrayValue; |
| 197 | const std::vector<Color>& colors = texture_.pixels; |
| 198 | const auto colorsSize = colors.size() / 2; // second half is gray color |
| 199 | for ( int i = 0; i < colorsSize; ++i ) |
| 200 | serializeToJson( colors[i], colorsArray[i] ); |
| 201 | root["Colors"] = colorsArray; |
| 202 | |
| 203 | Json::Value ranges = Json::arrayValue; |
| 204 | const int rangesSize = int( parameters_.ranges.size() ); |
| 205 | for ( int i = 0; i < rangesSize; ++i ) |
| 206 | ranges[i] = parameters_.ranges[i]; |
| 207 | root["Ranges"] = ranges; |
| 208 | |
| 209 | root["Discretization"] = parameters_.discretization; |
| 210 | |
| 211 | std::string str = texture_.filter == FilterType::Linear ? "Linear" : "Discrete"; |
| 212 | root["Filter"] = str; |
| 213 | } |
| 214 | |
| 215 | void Palette::setZeroCentredLabels_() |
| 216 | { |
no test coverage detected