| 2330 | } |
| 2331 | |
| 2332 | int Config::getNumColorSpaces(SearchReferenceSpaceType searchReferenceType, |
| 2333 | ColorSpaceVisibility visibility) const |
| 2334 | { |
| 2335 | int res = 0; |
| 2336 | switch (visibility) |
| 2337 | { |
| 2338 | case COLORSPACE_ALL: |
| 2339 | { |
| 2340 | const int nbCS = getImpl()->m_allColorSpaces->getNumColorSpaces(); |
| 2341 | if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL) |
| 2342 | { |
| 2343 | return nbCS; |
| 2344 | } |
| 2345 | for (int i = 0; i < nbCS; ++i) |
| 2346 | { |
| 2347 | auto cs = getImpl()->m_allColorSpaces->getColorSpaceByIndex(i); |
| 2348 | if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType())) |
| 2349 | { |
| 2350 | ++res; |
| 2351 | } |
| 2352 | } |
| 2353 | break; |
| 2354 | } |
| 2355 | case COLORSPACE_ACTIVE: |
| 2356 | { |
| 2357 | const size_t nbCS = getImpl()->m_activeColorSpaceNames.size(); |
| 2358 | if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL) |
| 2359 | { |
| 2360 | return (int)nbCS; |
| 2361 | } |
| 2362 | for (auto csname : getImpl()->m_activeColorSpaceNames) |
| 2363 | { |
| 2364 | auto cs = getColorSpace(csname.c_str()); |
| 2365 | if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType())) |
| 2366 | { |
| 2367 | ++res; |
| 2368 | } |
| 2369 | } |
| 2370 | break; |
| 2371 | } |
| 2372 | case COLORSPACE_INACTIVE: |
| 2373 | { |
| 2374 | const auto ics = getImpl()->m_inactiveColorSpaceNames.size(); |
| 2375 | if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL) |
| 2376 | { |
| 2377 | return (int)ics; |
| 2378 | } |
| 2379 | for (auto csname : getImpl()->m_inactiveColorSpaceNames) |
| 2380 | { |
| 2381 | auto cs = getColorSpace(csname.c_str()); |
| 2382 | if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType())) |
| 2383 | { |
| 2384 | ++res; |
| 2385 | } |
| 2386 | } |
| 2387 | break; |
| 2388 | } |
| 2389 | } |