本文整理汇总了C++中ocio_namespace::ConstConfigRcPtr::getCurrentContext方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstConfigRcPtr::getCurrentContext方法的具体用法?C++ ConstConfigRcPtr::getCurrentContext怎么用?C++ ConstConfigRcPtr::getCurrentContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocio_namespace::ConstConfigRcPtr
的用法示例。
在下文中一共展示了ConstConfigRcPtr::getCurrentContext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLocalContext
OCIO::ConstContextRcPtr OCIOColorSpace::getLocalContext()
{
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
OCIO::ConstContextRcPtr context = config->getCurrentContext();
OCIO::ContextRcPtr mutableContext;
if(!m_contextKey1.empty())
{
if(!mutableContext) mutableContext = context->createEditableCopy();
mutableContext->setStringVar(m_contextKey1.c_str(), m_contextValue1.c_str());
}
if(!m_contextKey2.empty())
{
if(!mutableContext) mutableContext = context->createEditableCopy();
mutableContext->setStringVar(m_contextKey2.c_str(), m_contextValue2.c_str());
}
if(!m_contextKey3.empty())
{
if(!mutableContext) mutableContext = context->createEditableCopy();
mutableContext->setStringVar(m_contextKey3.c_str(), m_contextValue3.c_str());
}
if(!m_contextKey4.empty())
{
if(!mutableContext) mutableContext = context->createEditableCopy();
mutableContext->setStringVar(m_contextKey4.c_str(), m_contextValue4.c_str());
}
if(mutableContext) context = mutableContext;
return context;
}
示例2: ColorProcessor_OCIO
ColorProcessor*
ColorConfig::createLookTransform (string_view looks,
string_view inputColorSpace,
string_view outputColorSpace,
bool inverse,
string_view context_key,
string_view context_val) const
{
#ifdef USE_OCIO
// Ask OCIO to make a Processor that can handle the requested
// transformation.
if (getImpl()->config_) {
OCIO::ConstConfigRcPtr config = getImpl()->config_;
OCIO::LookTransformRcPtr transform = OCIO::LookTransform::Create();
transform->setLooks (looks.c_str());
OCIO::TransformDirection dir;
if (inverse) {
// The TRANSFORM_DIR_INVERSE applies an inverse for the
// end-to-end transform, which would otherwise do dst->inv
// look -> src. This is an unintuitive result for the
// artist (who would expect in, out to remain unchanged), so
// we account for that here by flipping src/dst
transform->setSrc (outputColorSpace.c_str());
transform->setDst (inputColorSpace.c_str());
dir = OCIO::TRANSFORM_DIR_INVERSE;
} else { // forward
transform->setSrc (inputColorSpace.c_str());
transform->setDst (outputColorSpace.c_str());
dir = OCIO::TRANSFORM_DIR_FORWARD;
}
OCIO::ConstContextRcPtr context = config->getCurrentContext();
if (context_key.size() && context_val.size()) {
OCIO::ContextRcPtr ctx = context->createEditableCopy();
ctx->setStringVar (context_key.c_str(), context_val.c_str());
context = ctx;
}
OCIO::ConstProcessorRcPtr p;
try {
// Get the processor corresponding to this transform.
p = getImpl()->config_->getProcessor (context, transform, dir);
}
catch(OCIO::Exception &e) {
getImpl()->error_ = e.what();
return NULL;
}
catch(...) {
getImpl()->error_ = "An unknown error occurred in OpenColorIO, getProcessor";
return NULL;
}
getImpl()->error_ = "";
return new ColorProcessor_OCIO(p);
}
#endif
return NULL; // if we get this far, we've failed
}