31 #ifndef OPENIMAGEIO_COLOR_H
32 #define OPENIMAGEIO_COLOR_H
45 class OIIO_API ColorProcessor;
88 int getNumColorSpaces()
const;
91 const char * getColorSpaceNameByIndex(
int index)
const;
95 const char * getColorSpaceNameByRole (
const char *role)
const;
98 int getNumLooks()
const;
101 const char * getLookNameByIndex(
int index)
const;
116 ColorProcessor* createColorProcessor(
const char * inputColorSpace,
117 const char * outputColorSpace)
const;
136 ColorProcessor* createLookTransform (
const char * looks,
137 const char * inputColorSpace,
138 const char * outputColorSpace,
140 const char *context_key=NULL,
141 const char *context_value=NULL)
const;
144 static void deleteColorProcessor(ColorProcessor * processor);
147 static bool supportsOpenColorIO();
156 Impl * getImpl() {
return m_impl; }
157 const Impl * getImpl()
const {
return m_impl; }
164 inline float sRGB_to_linear (
float x)
166 return (x <= 0.04045f) ? (x / 12.92f)
167 : powf ((x + 0.055f) / 1.055f, 2.4f);
171 inline float linear_to_sRGB (
float x)
175 return (x <= 0.0031308f) ? (12.92f * x)
176 : (1.055f * powf (x, 1.f/2.4f) - 0.055f);
182 inline float Rec709_to_linear (
float x)
185 return (x < 0.0f) ? 0.0f : x * (1.0f/4.5f);
187 return powf ((x + 0.099f) * (1.0f/1.099f), (1.0f/0.45f));
191 inline float linear_to_Rec709 (
float x)
194 return (x < 0.0f)? 0.0f : x * 4.5f;
196 return 1.099f * powf(x, 0.45f) - 0.099f;
203 #endif // OPENIMAGEIO_COLOR_H