@@ -1252,20 +1252,22 @@ ColorConfig::createLookTransform(ustring looks, ustring inputColorSpace,
1252
1252
ColorProcessorHandle
1253
1253
ColorConfig::createDisplayTransform (string_view display, string_view view,
1254
1254
string_view inputColorSpace,
1255
- string_view looks, string_view context_key,
1255
+ string_view looks, bool inverse,
1256
+ string_view context_key,
1256
1257
string_view context_value) const
1257
1258
{
1258
1259
return createDisplayTransform (ustring (display), ustring (view),
1259
1260
ustring (inputColorSpace), ustring (looks),
1260
- ustring (context_key), ustring (context_value));
1261
+ inverse, ustring (context_key),
1262
+ ustring (context_value));
1261
1263
}
1262
1264
1263
1265
1264
1266
1265
1267
ColorProcessorHandle
1266
1268
ColorConfig::createDisplayTransform (ustring display, ustring view,
1267
1269
ustring inputColorSpace, ustring looks,
1268
- ustring context_key,
1270
+ bool inverse, ustring context_key,
1269
1271
ustring context_value) const
1270
1272
{
1271
1273
if (display.empty ())
@@ -1275,7 +1277,8 @@ ColorConfig::createDisplayTransform(ustring display, ustring view,
1275
1277
// First, look up the requested processor in the cache. If it already
1276
1278
// exists, just return it.
1277
1279
ColorProcCacheKey prockey (inputColorSpace, ustring () /* outputColorSpace*/ ,
1278
- context_key, context_value, looks, display, view);
1280
+ context_key, context_value, looks, display, view,
1281
+ ustring () /* file*/ , inverse);
1279
1282
ColorProcessorHandle handle = getImpl ()->findproc (prockey);
1280
1283
if (handle)
1281
1284
return handle;
@@ -1302,6 +1305,8 @@ ColorConfig::createDisplayTransform(ustring display, ustring view,
1302
1305
transform->setLooksOverrideEnabled (false );
1303
1306
}
1304
1307
# endif
1308
+ OCIO::TransformDirection dir = inverse ? OCIO::TRANSFORM_DIR_INVERSE
1309
+ : OCIO::TRANSFORM_DIR_FORWARD;
1305
1310
transform->setDisplay (display.c_str ());
1306
1311
transform->setView (view.c_str ());
1307
1312
auto context = config->getCurrentContext ();
@@ -1317,8 +1322,7 @@ ColorConfig::createDisplayTransform(ustring display, ustring view,
1317
1322
OCIO::ConstProcessorRcPtr p;
1318
1323
try {
1319
1324
// Get the processor corresponding to this transform.
1320
- p = getImpl ()->config_ ->getProcessor (context, transform,
1321
- OCIO::TRANSFORM_DIR_FORWARD);
1325
+ p = getImpl ()->config_ ->getProcessor (context, transform, dir);
1322
1326
getImpl ()->clear_error ();
1323
1327
handle = ColorProcessorHandle (new ColorProcessor_OCIO (p));
1324
1328
} catch (OCIO::Exception& e) {
@@ -1335,6 +1339,30 @@ ColorConfig::createDisplayTransform(ustring display, ustring view,
1335
1339
1336
1340
1337
1341
1342
+ ColorProcessorHandle
1343
+ ColorConfig::createDisplayTransform (string_view display, string_view view,
1344
+ string_view inputColorSpace,
1345
+ string_view looks, string_view context_key,
1346
+ string_view context_value) const
1347
+ {
1348
+ return createDisplayTransform (ustring (display), ustring (view),
1349
+ ustring (inputColorSpace), ustring (looks),
1350
+ false , ustring (context_key),
1351
+ ustring (context_value));
1352
+ }
1353
+
1354
+ ColorProcessorHandle
1355
+ ColorConfig::createDisplayTransform (ustring display, ustring view,
1356
+ ustring inputColorSpace, ustring looks,
1357
+ ustring context_key,
1358
+ ustring context_value) const
1359
+ {
1360
+ return createDisplayTransform (display, view, inputColorSpace, looks, false ,
1361
+ context_key, context_value);
1362
+ }
1363
+
1364
+
1365
+
1338
1366
ColorProcessorHandle
1339
1367
ColorConfig::createFileTransform (string_view name, bool inverse) const
1340
1368
{
@@ -1850,7 +1878,7 @@ bool
1850
1878
ImageBufAlgo::ociodisplay (ImageBuf& dst, const ImageBuf& src,
1851
1879
string_view display, string_view view,
1852
1880
string_view from, string_view looks, bool unpremult,
1853
- string_view key, string_view value,
1881
+ bool inverse, string_view key, string_view value,
1854
1882
ColorConfig* colorconfig, ROI roi, int nthreads)
1855
1883
{
1856
1884
pvt::LoggedTimer logtime (" IBA::ociodisplay" );
@@ -1871,7 +1899,8 @@ ImageBufAlgo::ociodisplay(ImageBuf& dst, const ImageBuf& src,
1871
1899
return false ;
1872
1900
}
1873
1901
processor = colorconfig->createDisplayTransform (display, view, from,
1874
- looks, key, value);
1902
+ looks, inverse, key,
1903
+ value);
1875
1904
if (!processor) {
1876
1905
if (colorconfig->error ())
1877
1906
dst.errorfmt (" {}" , colorconfig->geterror ());
@@ -1891,19 +1920,47 @@ ImageBufAlgo::ociodisplay(ImageBuf& dst, const ImageBuf& src,
1891
1920
ImageBuf
1892
1921
ImageBufAlgo::ociodisplay (const ImageBuf& src, string_view display,
1893
1922
string_view view, string_view from, string_view looks,
1894
- bool unpremult, string_view key, string_view value,
1895
- ColorConfig* colorconfig, ROI roi, int nthreads)
1923
+ bool unpremult, bool inverse, string_view key,
1924
+ string_view value, ColorConfig* colorconfig, ROI roi,
1925
+ int nthreads)
1896
1926
{
1897
1927
ImageBuf result;
1898
1928
bool ok = ociodisplay (result, src, display, view, from, looks, unpremult,
1899
- key, value, colorconfig, roi, nthreads);
1929
+ inverse, key, value, colorconfig, roi, nthreads);
1900
1930
if (!ok && !result.has_error ())
1901
1931
result.errorfmt (" ImageBufAlgo::ociodisplay() error" );
1902
1932
return result;
1903
1933
}
1904
1934
1905
1935
1906
1936
1937
+ // DEPRECATED(2.5)
1938
+ bool
1939
+ ImageBufAlgo::ociodisplay (ImageBuf& dst, const ImageBuf& src,
1940
+ string_view display, string_view view,
1941
+ string_view from, string_view looks, bool unpremult,
1942
+ string_view key, string_view value,
1943
+ ColorConfig* colorconfig, ROI roi, int nthreads)
1944
+ {
1945
+ return ociodisplay (dst, src, display, view, from, looks, unpremult, false ,
1946
+ key, value, colorconfig, roi, nthreads);
1947
+ }
1948
+
1949
+
1950
+
1951
+ // DEPRECATED(2.5)
1952
+ ImageBuf
1953
+ ImageBufAlgo::ociodisplay (const ImageBuf& src, string_view display,
1954
+ string_view view, string_view from, string_view looks,
1955
+ bool unpremult, string_view key, string_view value,
1956
+ ColorConfig* colorconfig, ROI roi, int nthreads)
1957
+ {
1958
+ return ociodisplay (src, display, view, from, looks, unpremult, false , key,
1959
+ value, colorconfig, roi, nthreads);
1960
+ }
1961
+
1962
+
1963
+
1907
1964
bool
1908
1965
ImageBufAlgo::ociofiletransform (ImageBuf& dst, const ImageBuf& src,
1909
1966
string_view name, bool unpremult, bool inverse,
0 commit comments