MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / getColorSpaceNameByIndex

Method getColorSpaceNameByIndex

src/OpenColorIO/Config.cpp:2394–2494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2392}
2393
2394const 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()))

Callers 15

test_interfaceMethod · 0.95
mainFunction · 0.45
imageColorSpace_CBFunction · 0.45
PopulateOCIOMenusFunction · 0.45
loadFunction · 0.45
saveFunction · 0.45
getRefSpaceNameFunction · 0.45
getDataSpaceNameFunction · 0.45
IdentifyInterchangeSpaceFunction · 0.45
getRefSpaceConverterFunction · 0.45

Calls 7

MatchReferenceTypeFunction · 0.85
getColorSpaceByIndexMethod · 0.80
getImplFunction · 0.50
getNumColorSpacesMethod · 0.45
getReferenceSpaceTypeMethod · 0.45
getNameMethod · 0.45
sizeMethod · 0.45

Tested by 7

test_interfaceMethod · 0.76
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
checkColorSpaceFunction · 0.36
OCIO_ADD_TESTFunction · 0.36