OpenImageIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
ColorConfig Class Reference

#include <color.h>

Public Member Functions

 ColorConfig ()
 
 ColorConfig (const char *filename)
 
bool error () const
 
std::string geterror ()
 
int getNumColorSpaces () const
 Get the number of ColorSpace(s) defined in this configuration.
 
const char * getColorSpaceNameByIndex (int index) const
 Query the name of the specified ColorSpace.
 
const char * getColorSpaceNameByRole (const char *role) const
 
int getNumLooks () const
 Get the number of Looks defined in this configuration.
 
const char * getLookNameByIndex (int index) const
 Query the name of the specified Look.
 
ColorProcessor * createColorProcessor (const char *inputColorSpace, const char *outputColorSpace) const
 
ColorProcessor * createLookTransform (const char *looks, const char *inputColorSpace, const char *outputColorSpace, bool inverse=false, const char *context_key=NULL, const char *context_value=NULL) const
 

Static Public Member Functions

static void deleteColorProcessor (ColorProcessor *processor)
 Delete the specified ColorProcessor.
 
static bool supportsOpenColorIO ()
 Return if OpenImageIO was built with OCIO support.
 

Friends

class Impl
 

Detailed Description

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.

Constructor & Destructor Documentation

ColorConfig::ColorConfig ( )

If OpenColorIO is enabled at build time, initialize with the current color configuration. ($OCIO) If OpenColorIO is not enabled, this does nothing.

Multiple calls to this are inexpensive.

ColorConfig::ColorConfig ( const char *  filename)

If OpenColorIO is enabled at build time, initialize with the specified color configuration (.ocio) file If OpenColorIO is not enabled, this will result in an error.

Multiple calls to this are potentially expensive.

Member Function Documentation

ColorProcessor* ColorConfig::createColorProcessor ( const char *  inputColorSpace,
const char *  outputColorSpace 
) const

Given the specified input and output ColorSpace, construct the processor. It is possible that this will return NULL, if the inputColorSpace doesnt 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). When the user is finished with a ColorProcess, deleteColorProcessor should be called. ColorProcessor(s) remain valid even if the ColorConfig that created them no longer exists.

Multiple calls to this are potentially expensive, so you should call once to create a ColorProcessor to use on an entire image (or multiple images), NOT for every scanline or pixel separately!

ColorProcessor* ColorConfig::createLookTransform ( const char *  looks,
const char *  inputColorSpace,
const char *  outputColorSpace,
bool  inverse = false,
const char *  context_key = NULL,
const char *  context_value = NULL 
) const

Given the named look(s), input and output color spaces, construct a color processor that applies an OCIO look transformation. If inverse==true, construct the inverse transformation. The context_key and context_value can optionally be used to establish an extra token/value pair in the OCIO context.

It is possible that this will return NULL, if one of the color spaces or the look itself doesnt exist or is not allowed. When the user is finished with a ColorProcess, deleteColorProcessor should be called. ColorProcessor(s) remain valid even if the ColorConfig that created them no longer exists.

Multiple calls to this are potentially expensive, so you should call once to create a ColorProcessor to use on an entire image (or multiple images), NOT for every scanline or pixel separately!

static void ColorConfig::deleteColorProcessor ( ColorProcessor *  processor)
static

Delete the specified ColorProcessor.

bool ColorConfig::error ( ) const

Has an error string occurred? (This will not affect the error state.)

const char* ColorConfig::getColorSpaceNameByIndex ( int  index) const

Query the name of the specified ColorSpace.

const char* ColorConfig::getColorSpaceNameByRole ( const char *  role) const

Get the name of the color space representing the named role, or NULL if none could be identified.

std::string ColorConfig::geterror ( )

This routine will return the error string (and 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.

int ColorConfig::getNumColorSpaces ( ) const

Get the number of ColorSpace(s) defined in this configuration.

int ColorConfig::getNumLooks ( ) const

Get the number of Looks defined in this configuration.

static bool ColorConfig::supportsOpenColorIO ( )
static

Return if OpenImageIO was built with OCIO support.


The documentation for this class was generated from the following file: