HDK
|
#include <color.h>
Public Member Functions | |
ColorConfig (string_view filename="") | |
~ColorConfig () | |
bool | reset (string_view filename="") |
bool | has_error () const |
bool | error () const |
DEPRECATED(2.4), old name for has_error(). More... | |
std::string | geterror (bool clear=true) |
int | getNumColorSpaces () const |
Get the number of ColorSpace(s) defined in this configuration. More... | |
const char * | getColorSpaceNameByIndex (int index) const |
Query the name of the specified ColorSpace. More... | |
const char * | getColorSpaceNameByRole (string_view role) const |
OIIO::TypeDesc | getColorSpaceDataType (string_view name, int *bits) const |
std::vector< std::string > | getColorSpaceNames () const |
const char * | getColorSpaceFamilyByName (string_view name) const |
int | getNumRoles () const |
const char * | getRoleByIndex (int index) const |
Query the name of the specified Role. More... | |
std::vector< std::string > | getRoles () const |
Retrieve the full list of known Roles, as a vector of strings. More... | |
int | getNumLooks () const |
Get the number of Looks defined in this configuration. More... | |
const char * | getLookNameByIndex (int index) const |
Query the name of the specified Look. More... | |
std::vector< std::string > | getLookNames () const |
Retrieve the full list of known look names, as a vector of strings. More... | |
ColorProcessorHandle | createColorProcessor (string_view inputColorSpace, string_view outputColorSpace, string_view context_key="", string_view context_value="") const |
ColorProcessorHandle | createColorProcessor (ustring inputColorSpace, ustring outputColorSpace, ustring context_key=ustring(), ustring context_value=ustring()) const |
ColorProcessorHandle | createLookTransform (string_view looks, string_view inputColorSpace, string_view outputColorSpace, bool inverse=false, string_view context_key="", string_view context_value="") const |
ColorProcessorHandle | createLookTransform (ustring looks, ustring inputColorSpace, ustring outputColorSpace, bool inverse=false, ustring context_key=ustring(), ustring context_value=ustring()) const |
int | getNumDisplays () const |
Get the number of displays defined in this configuration. More... | |
const char * | getDisplayNameByIndex (int index) const |
Query the name of the specified display. More... | |
std::vector< std::string > | getDisplayNames () const |
const char * | getDefaultDisplayName () const |
Get the name of the default display. More... | |
int | getNumViews (string_view display="") const |
const char * | getViewNameByIndex (string_view display, int index) const |
Query the name of the specified view for the specified display. More... | |
std::vector< std::string > | getViewNames (string_view display="") const |
const char * | getDefaultViewName (string_view display="") const |
ColorProcessorHandle | createDisplayTransform (string_view display, string_view view, string_view inputColorSpace, string_view looks="", string_view context_key="", string_view context_value="") const |
ColorProcessorHandle | createDisplayTransform (ustring display, ustring view, ustring inputColorSpace, ustring looks=ustring(), ustring context_key=ustring(), ustring context_value=ustring()) const |
ColorProcessorHandle | createFileTransform (string_view name, bool inverse=false) const |
ColorProcessorHandle | createFileTransform (ustring name, bool inverse=false) const |
ColorProcessorHandle | createMatrixTransform (const Imath::M44f &M, bool inverse=false) const |
string_view | getColorSpaceFromFilepath (string_view str) const |
string_view | parseColorSpaceFromString (string_view str) const |
std::string | configname () const |
Return a filename or other identifier for the config we're using. More... | |
Static Public Member Functions | |
static void | deleteColorProcessor (const ColorProcessorHandle &) |
static bool | supportsOpenColorIO () |
Return if OpenImageIO was built with OCIO support. More... | |
static int | OpenColorIO_version_hex () |
Represents the set of all color transformations that are allowed. If OpenColorIO is enabled at build time, this configuration is loaded at runtime, allowing the user to have complete control of all color transformation math. ($OCIO) (See opencolorio.org for details). If OpenColorIO is not enabled at build time, a generic color configuration is provided for minimal color support.
NOTE: ColorConfig(s) and ColorProcessor(s) are potentially heavy-weight. Their construction / destruction should be kept to a minimum.
ColorConfig::ColorConfig | ( | string_view | filename = "" | ) |
Construct a ColorConfig using the named OCIO configuration file, or if filename is empty, to the current color configuration specified by env variable $OCIO.
Multiple calls to this are potentially expensive. A ColorConfig should usually be shared by an app for its entire runtime.
ColorConfig::~ColorConfig | ( | ) |
std::string ColorConfig::configname | ( | ) | const |
Return a filename or other identifier for the config we're using.
ColorProcessorHandle ColorConfig::createColorProcessor | ( | string_view | inputColorSpace, |
string_view | outputColorSpace, | ||
string_view | context_key = "" , |
||
string_view | context_value = "" |
||
) | const |
Given the specified input and output ColorSpace, request a handle to a ColorProcessor. It is possible that this will return an empty handle, if the inputColorSpace doesn't exist, the outputColorSpace doesn't exist, or if the specified transformation is illegal (for example, it may require the inversion of a 3D-LUT, etc).
The handle is actually a shared_ptr, so when you're done with a ColorProcess, just discard it. ColorProcessor(s) remain valid even if the ColorConfig that created them no longer exists.
Created ColorProcessors are cached, so asking for the same color space transformation multiple times shouldn't be very expensive.
ColorProcessorHandle ColorConfig::createColorProcessor | ( | ustring | inputColorSpace, |
ustring | outputColorSpace, | ||
ustring | context_key = ustring() , |
||
ustring | context_value = ustring() |
||
) | const |
ColorProcessorHandle ColorConfig::createDisplayTransform | ( | string_view | display, |
string_view | view, | ||
string_view | inputColorSpace, | ||
string_view | looks = "" , |
||
string_view | context_key = "" , |
||
string_view | context_value = "" |
||
) | const |
Construct a processor to transform from the given color space to the color space of the given display and view. You may optionally override the looks that are, by default, used with the display/view combination. Looks is a potentially comma (or colon) delimited list of lookNames, where +/- prefixes are optionally allowed to denote forward/inverse transformation (and forward is assumed in the absence of either). It is possible to remove all looks from the display by passing an empty string. The context_key and context_value can optionally be used to establish extra key/value pair in the OCIO context if they are comma-separated lists of context keys and values, respectively.
It is possible that this will return an empty handle if one of the color spaces or the display or view doesn't exist or is not allowed.
The handle is actually a shared_ptr, so when you're done with a ColorProcess, just discard it. ColorProcessor(s) remain valid even if the ColorConfig that created them no longer exists.
Created ColorProcessors are cached, so asking for the same color space transformation multiple times shouldn't be very expensive.
ColorProcessorHandle ColorConfig::createDisplayTransform | ( | ustring | display, |
ustring | view, | ||
ustring | inputColorSpace, | ||
ustring | looks = ustring() , |
||
ustring | context_key = ustring() , |
||
ustring | context_value = ustring() |
||
) | const |
ColorProcessorHandle ColorConfig::createFileTransform | ( | string_view | name, |
bool | inverse = false |
||
) | const |
Construct a processor to perform color transforms determined by an OpenColorIO FileTransform. It is possible that this will return an empty handle if the FileTransform doesn't exist or is not allowed.
The handle is actually a shared_ptr, so when you're done with a ColorProcess, just discard it. ColorProcessor(s) remain valid even if the ColorConfig that created them no longer exists.
Created ColorProcessors are cached, so asking for the same color space transformation multiple times shouldn't be very expensive.
ColorProcessorHandle ColorConfig::createFileTransform | ( | ustring | name, |
bool | inverse = false |
||
) | const |
ColorProcessorHandle ColorConfig::createLookTransform | ( | string_view | looks, |
string_view | inputColorSpace, | ||
string_view | outputColorSpace, | ||
bool | inverse = false , |
||
string_view | context_key = "" , |
||
string_view | context_value = "" |
||
) | const |
Given the named look(s), input and output color spaces, request a color processor that applies an OCIO look transformation. If inverse==true, request the inverse transformation. The context_key and context_value can optionally be used to establish extra key/value pairs in the OCIO context if they are comma- separated lists of ontext keys and values, respectively.
The handle is actually a shared_ptr, so when you're done with a ColorProcess, just discard it. ColorProcessor(s) remain valid even if the ColorConfig that created them no longer exists.
Created ColorProcessors are cached, so asking for the same color space transformation multiple times shouldn't be very expensive.
ColorProcessorHandle ColorConfig::createLookTransform | ( | ustring | looks, |
ustring | inputColorSpace, | ||
ustring | outputColorSpace, | ||
bool | inverse = false , |
||
ustring | context_key = ustring() , |
||
ustring | context_value = ustring() |
||
) | const |
ColorProcessorHandle ColorConfig::createMatrixTransform | ( | const Imath::M44f & | M, |
bool | inverse = false |
||
) | const |
Construct a processor to perform color transforms specified by a 4x4 matrix.
The handle is actually a shared_ptr, so when you're done with a ColorProcess, just discard it.
Created ColorProcessors are cached, so asking for the same color space transformation multiple times shouldn't be very expensive.
|
inlinestatic |
bool ColorConfig::error | ( | ) | const |
DEPRECATED(2.4), old name for has_error().
OIIO::TypeDesc ColorConfig::getColorSpaceDataType | ( | string_view | name, |
int * | bits | ||
) | const |
Get the data type that OCIO thinks this color space is. The name may be either a color space name or a role.
const char* ColorConfig::getColorSpaceFamilyByName | ( | string_view | name | ) | const |
Get the name of the color space family of the named color space, or NULL if none could be identified.
string_view ColorConfig::getColorSpaceFromFilepath | ( | string_view | str | ) | const |
Given a filepath, ask OCIO what color space it thinks the file should be, based on how the name matches file naming rules in the OCIO config. (This is mostly a wrapper around OCIO's ColorConfig::getColorSpaceFromSFilepath.)
const char* ColorConfig::getColorSpaceNameByIndex | ( | int | index | ) | const |
Query the name of the specified ColorSpace.
const char* ColorConfig::getColorSpaceNameByRole | ( | string_view | role | ) | const |
Get the name of the color space representing the named role, or NULL if none could be identified.
std::vector<std::string> ColorConfig::getColorSpaceNames | ( | ) | const |
Retrieve the full list of known color space names, as a vector of strings.
const char* ColorConfig::getDefaultDisplayName | ( | ) | const |
Get the name of the default display.
const char* ColorConfig::getDefaultViewName | ( | string_view | display = "" | ) | const |
Query the name of the default view for the specified display. If the display is empty or not specified, the default display will be used.
const char* ColorConfig::getDisplayNameByIndex | ( | int | index | ) | const |
Query the name of the specified display.
std::vector<std::string> ColorConfig::getDisplayNames | ( | ) | const |
Retrieve the full list of known display names, as a vector of strings.
std::string ColorConfig::geterror | ( | bool | clear = true | ) |
This routine will return the error string (and by default, clear any error flags). If no error has occurred since the last time geterror() was called, it will return an empty string.
const char* ColorConfig::getLookNameByIndex | ( | int | index | ) | const |
Query the name of the specified Look.
std::vector<std::string> ColorConfig::getLookNames | ( | ) | const |
Retrieve the full list of known look names, as a vector of strings.
int ColorConfig::getNumColorSpaces | ( | ) | const |
Get the number of ColorSpace(s) defined in this configuration.
int ColorConfig::getNumDisplays | ( | ) | const |
Get the number of displays defined in this configuration.
int ColorConfig::getNumLooks | ( | ) | const |
Get the number of Looks defined in this configuration.
int ColorConfig::getNumRoles | ( | ) | const |
int ColorConfig::getNumViews | ( | string_view | display = "" | ) | const |
Get the number of views for a given display defined in this configuration. If the display is empty or not specified, the default display will be used.
const char* ColorConfig::getRoleByIndex | ( | int | index | ) | const |
Query the name of the specified Role.
std::vector<std::string> ColorConfig::getRoles | ( | ) | const |
Retrieve the full list of known Roles, as a vector of strings.
const char* ColorConfig::getViewNameByIndex | ( | string_view | display, |
int | index | ||
) | const |
Query the name of the specified view for the specified display.
std::vector<std::string> ColorConfig::getViewNames | ( | string_view | display = "" | ) | const |
Retrieve the full list of known view names for the display, as a vector of strings. If the display is empty or not specified, the default display will be used.
bool ColorConfig::has_error | ( | ) | const |
Has an error string occurred? (This will not affect the error state.)
|
static |
Return the hex OCIO version (maj<<24 + min<<16 + patch), or 0 if no OCIO support is available.
string_view ColorConfig::parseColorSpaceFromString | ( | string_view | str | ) | const |
Given a string (like a filename), look for the longest, right-most colorspace substring that appears. Returns "" if no such color space is found.
bool ColorConfig::reset | ( | string_view | filename = "" | ) |
Reset the config to the named OCIO configuration file, or if filename is empty, to the current color configuration specified by env variable $OCIO. Return true for success, false if there was an error.
Multiple calls to this are potentially expensive. A ColorConfig should usually be shared by an app for its entire runtime.
|
static |
Return if OpenImageIO was built with OCIO support.