- Timestamp:
- Feb 23, 2019, 10:34:16 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kapa2/src/SetColormap.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/src/SetColormap.c
r38465 r40627 214 214 215 215 /* anuenue */ 216 if (!strncmp (graphic->colormapName, "file:", 5)) { 216 if (!strncmp (graphic->colormapName, "file:", 5) || 217 !strncmp (graphic->colormapName, "lgcy:", 5) || 218 !strncmp (graphic->colormapName, "cetf:", 5) || 219 !strncmp (graphic->colormapName, "csvf:", 5)) { 220 217 221 FILE *f = fopen (&graphic->colormapName[5], "r"); 218 222 if (!f) { … … 227 231 float lastGreen = 0.0; 228 232 233 int isCSV = !strncmp (graphic->colormapName, "csvf:", 5); 234 int isCET = !strncmp (graphic->colormapName, "cetf:", 5); 235 int isLegacy = !strncmp (graphic->colormapName, "lgcy:", 5); 236 229 237 float fracIndex, fracRed, fracBlue, fracGreen; 238 239 if (isCET) fracIndex = 0.0; 230 240 231 241 while (scan_line_maxlen (f, line, 1024) != EOF) { 232 242 // file contains f R G B : f = 0.0 - 1.0, R,G,B = 0.0 - 1.0 233 int Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen); 234 if (Nscan != 4) continue; 243 244 int Nscan; 245 if (isCSV) { 246 Nscan = sscanf (line, "%f,%f,%f,%f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 247 if (Nscan != 4) continue; 248 } 249 if (isCET) { 250 Nscan = sscanf (line, "%f,%f,%f", &fracRed, &fracGreen, &fracBlue); 251 fracIndex += 1.0 / 256.0; 252 if (Nscan != 3) continue; 253 } 254 if (isLegacy) { 255 Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen); 256 if (Nscan != 4) continue; 257 } 258 if (!isCSV && !isLegacy && !isCET) { 259 Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 260 if (Nscan != 4) continue; 261 } 235 262 236 263 int nextIndex = fracIndex * MaxValue;
Note:
See TracChangeset
for help on using the changeset viewer.
