| 2392 | } |
| 2393 | |
| 2394 | const char * Config::getColorSpaceNameByIndex(SearchReferenceSpaceType searchReferenceType, |
| 2395 | ColorSpaceVisibility visibility, int index) const |
| 2396 | { |
| 2397 | if (index < 0) |
| 2398 | { |
| 2399 | return ""; |
| 2400 | } |
| 2401 | |
| 2402 | int current = 0; |
| 2403 | switch (visibility) |
| 2404 | { |
| 2405 | case COLORSPACE_ALL: |
| 2406 | { |
| 2407 | if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL) |
| 2408 | { |
| 2409 | if (index < getImpl()->m_allColorSpaces->getNumColorSpaces()) |
| 2410 | { |
| 2411 | return getImpl()->m_allColorSpaces->getColorSpaceNameByIndex(index); |
| 2412 | } |
| 2413 | else |
| 2414 | { |
| 2415 | return ""; |
| 2416 | } |
| 2417 | } |
| 2418 | const int nbCS = getImpl()->m_allColorSpaces->getNumColorSpaces(); |
| 2419 | for (int i = 0; i < nbCS; ++i) |
| 2420 | { |
| 2421 | auto cs = getImpl()->m_allColorSpaces->getColorSpaceByIndex(i); |
| 2422 | if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType())) |
| 2423 | { |
| 2424 | if (current == index) |
| 2425 | { |
| 2426 | return cs->getName(); |
| 2427 | } |
| 2428 | ++current; |
| 2429 | } |
| 2430 | } |
| 2431 | break; |
| 2432 | } |
| 2433 | case COLORSPACE_ACTIVE: |
| 2434 | { |
| 2435 | if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL) |
| 2436 | { |
| 2437 | if (index < (int)getImpl()->m_activeColorSpaceNames.size()) |
| 2438 | { |
| 2439 | return getImpl()->m_activeColorSpaceNames[index].c_str(); |
| 2440 | } |
| 2441 | else |
| 2442 | { |
| 2443 | return ""; |
| 2444 | } |
| 2445 | } |
| 2446 | const int nbCS = (int)getImpl()->m_activeColorSpaceNames.size(); |
| 2447 | for (int i = 0; i < nbCS; ++i) |
| 2448 | { |
| 2449 | auto csname = getImpl()->m_activeColorSpaceNames[i]; |
| 2450 | auto cs = getColorSpace(csname.c_str()); |
| 2451 | if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType())) |