本文整理汇总了C++中ocio_namespace::ConstConfigRcPtr::getIndexForColorSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstConfigRcPtr::getIndexForColorSpace方法的具体用法?C++ ConstConfigRcPtr::getIndexForColorSpace怎么用?C++ ConstConfigRcPtr::getIndexForColorSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocio_namespace::ConstConfigRcPtr
的用法示例。
在下文中一共展示了ConstConfigRcPtr::getIndexForColorSpace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static std::string
canonicalizeColorSpace(OCIO_NAMESPACE::ConstConfigRcPtr config, const std::string &csname)
{
if (!config) {
return csname;
}
const int defaultcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_DEFAULT);
const int referencecs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_REFERENCE);
const int datacs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_DATA);
const int colorpickingcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_COLOR_PICKING);
const int scenelinearcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_SCENE_LINEAR);
const int compositinglogcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_COMPOSITING_LOG);
const int colortimingcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_COLOR_TIMING);
const int texturepaintcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_TEXTURE_PAINT);
const int mattepaintcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_MATTE_PAINT);
int inputSpaceIndex = config->getIndexForColorSpace(csname.c_str());
if (inputSpaceIndex == scenelinearcs) {
return OCIO_NAMESPACE::ROLE_SCENE_LINEAR;
} else if (inputSpaceIndex == defaultcs) {
return OCIO_NAMESPACE::ROLE_DEFAULT;
} else if (inputSpaceIndex == referencecs) {
return OCIO_NAMESPACE::ROLE_REFERENCE;
} else if (inputSpaceIndex == datacs) {
return OCIO_NAMESPACE::ROLE_DATA;
} else if (inputSpaceIndex == colorpickingcs) {
return OCIO_NAMESPACE::ROLE_COLOR_PICKING;
} else if (inputSpaceIndex == compositinglogcs) {
return OCIO_NAMESPACE::ROLE_COMPOSITING_LOG;
} else if (inputSpaceIndex == colortimingcs) {
return OCIO_NAMESPACE::ROLE_COLOR_TIMING;
} else if (inputSpaceIndex == texturepaintcs) {
return OCIO_NAMESPACE::ROLE_TEXTURE_PAINT;
} else if (inputSpaceIndex == mattepaintcs) {
return OCIO_NAMESPACE::ROLE_MATTE_PAINT;
}
return csname;
}
示例2: assert
static void
buildChoiceMenu(OCIO::ConstConfigRcPtr config,
ChoiceParamType* choice,
bool cascading,
const std::string& name = "")
{
#ifdef DEBUG
//printf("%p->resetOptions\n", (void*)choice);
#endif
choice->resetOptions();
assert(choice->getNOptions() == 0);
if (!config) {
return;
}
int def = -1;
int defaultcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_DEFAULT);
int referencecs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_REFERENCE);
int datacs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_DATA);
int colorpickingcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_COLOR_PICKING);
int scenelinearcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_SCENE_LINEAR);
int compositinglogcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_COMPOSITING_LOG);
int colortimingcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_COLOR_TIMING);
int texturepaintcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_TEXTURE_PAINT);
int mattepaintcs = config->getIndexForColorSpace(OCIO_NAMESPACE::ROLE_MATTE_PAINT);
for (int i = 0; i < config->getNumColorSpaces(); ++i) {
std::string csname = config->getColorSpaceNameByIndex(i);
std::string msg;
// set the default value, in case the GUI uses it
if (!name.empty() && csname == name) {
def = i;
}
OCIO_NAMESPACE::ConstColorSpaceRcPtr cs = config->getColorSpace(csname.c_str());
if (cascading) {
std::string family = config->getColorSpace(csname.c_str())->getFamily();
if (!family.empty()) {
csname = family + "/" + csname;
}
}
std::string csdesc = cs ? cs->getDescription() : "(no colorspace)";
csdesc = whitespacify(trim(csdesc));
int csdesclen = csdesc.size();
if ( csdesclen > 0 ) {
msg += csdesc;
}
bool first = true;
int roles = 0;
if (i == defaultcs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_DEFAULT;
first = false;
++roles;
}
if (i == referencecs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_REFERENCE;
first = false;
++roles;
}
if (i == datacs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_DATA;
first = false;
++roles;
}
if (i == colorpickingcs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_COLOR_PICKING;
first = false;
++roles;
}
if (i == scenelinearcs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_SCENE_LINEAR;
first = false;
++roles;
}
if (i == compositinglogcs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_COMPOSITING_LOG;
first = false;
++roles;
}
if (i == colortimingcs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_COLOR_TIMING;
first = false;
++roles;
}
if (i == texturepaintcs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_TEXTURE_PAINT;
first = false;
++roles;
}
if (i == mattepaintcs) {
msg += first ? " (" : ", ";
msg += OCIO_NAMESPACE::ROLE_MATTE_PAINT;
first = false;
++roles;
}
//.........这里部分代码省略.........