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

Function getTransformForDir

src/OpenColorIO/ConfigUtils.cpp:867–896  ·  view source on GitHub ↗

Return a transform in either the to_ref or from_ref direction for this color space. Return an identity matrix, if the color space has no transforms.

Source from the content-addressed store, hash-verified

865// Return an identity matrix, if the color space has no transforms.
866//
867ConstTransformRcPtr getTransformForDir(const ConstColorSpaceRcPtr & cs, ColorSpaceDirection dir)
868{
869 ColorSpaceDirection otherDir = COLORSPACE_DIR_TO_REFERENCE;
870 if (dir == COLORSPACE_DIR_TO_REFERENCE)
871 {
872 otherDir = COLORSPACE_DIR_FROM_REFERENCE;
873 }
874
875 ConstTransformRcPtr t = cs->getTransform(dir);
876 if (t)
877 {
878 return t;
879 }
880
881 ConstTransformRcPtr tOther = cs->getTransform(otherDir);
882 if (tOther)
883 {
884 return invertTransform(tOther);
885 }
886
887 // If it's the reference space, it won't have a transform, so return an identity matrix.
888 double m44[16];
889 double offset4[4];
890 MatrixTransform::Identity(m44, offset4);
891 MatrixTransformRcPtr p = MatrixTransform::Create();
892 p->setMatrix(m44);
893 p->setOffset(offset4);
894
895 return p;
896}
897
898// Get a transform to convert from the source config reference space to the
899// destination config reference space. The ref_space_type specifies whether

Callers 3

getRefSpaceConverterFunction · 0.85
initializeTestValsFunction · 0.85

Calls 4

invertTransformFunction · 0.85
getTransformMethod · 0.45
setMatrixMethod · 0.45
setOffsetMethod · 0.45

Tested by

no test coverage detected