HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfColorSpace Class Reference

#include <colorSpace.h>

Public Member Functions

GF_API GfColorSpace (const TfToken &name)
 
GF_API GfColorSpace (const TfToken &name, const GfVec2f &redChroma, const GfVec2f &greenChroma, const GfVec2f &blueChroma, const GfVec2f &whitePoint, float gamma, float linearBias)
 
GF_API GfColorSpace (const TfToken &name, const GfMatrix3f &rgbToXYZ, float gamma, float linearBias)
 
GF_API TfToken GetName () const
 
GF_API bool operator== (const GfColorSpace &rh) const
 
bool operator!= (const GfColorSpace &rh) const
 
GF_API void ConvertRGBSpan (const GfColorSpace &srcColorSpace, TfSpan< float > rgb) const
 
GF_API void ConvertRGBASpan (const GfColorSpace &srcColorSpace, TfSpan< float > rgba) const
 
GF_API GfColor Convert (const GfColorSpace &srcColorSpace, const GfVec3f &rgb) const
 Convert a rgb triplet in a certain color space to "this" color space. More...
 
GF_API GfMatrix3f GetRGBToXYZ () const
 
GF_API float GetGamma () const
 
GF_API float GetLinearBias () const
 
GF_API std::pair< float, floatGetTransferFunctionParams () const
 
GF_API std::tuple< GfVec2f,
GfVec2f, GfVec2f, GfVec2f
GetPrimariesAndWhitePoint () const
 

Static Public Member Functions

static GF_API bool IsValid (const TfToken &name)
 

Friends

class GfColor
 

Detailed Description

Basic type: ColorSpace

This class represents a colorspace. Color spaces may be created by name, parameterization, or by a 3x3 matrix and a gamma operator.

The parameters used to construct the color space are not available for introspection ~ the color space object is intended for color conversion operations on a GfColor.

The color spaces natively recognized by GfColorSpace are listed in GfColorSpaceNames.

Definition at line 115 of file colorSpace.h.

Constructor & Destructor Documentation

GF_API GfColorSpace::GfColorSpace ( const TfToken name)
explicit

Construct a GfColorSpace from a name token.

Parameters
nameThe name token of the color space.
GF_API GfColorSpace::GfColorSpace ( const TfToken name,
const GfVec2f redChroma,
const GfVec2f greenChroma,
const GfVec2f blueChroma,
const GfVec2f whitePoint,
float  gamma,
float  linearBias 
)
explicit

Construct a custom color space from raw values.

Parameters
nameThe name token of the color space.
redChromaThe red chromaticity coordinates.
greenChromaThe green chromaticity coordinates.
blueChromaThe blue chromaticity coordinates.
whitePointThe white point chromaticity coordinates.
gammaThe gamma value of the log section.
linearBiasThe linear bias of the log section.
GF_API GfColorSpace::GfColorSpace ( const TfToken name,
const GfMatrix3f rgbToXYZ,
float  gamma,
float  linearBias 
)
explicit

Construct a color space from a 3x3 matrix and linearization parameters.

Parameters
nameThe name token of the color space.
rgbToXYZThe RGB to XYZ conversion matrix.
gammaThe gamma value of the log section.
linearBiasThe linear bias of the log section.

Member Function Documentation

GF_API GfColor GfColorSpace::Convert ( const GfColorSpace srcColorSpace,
const GfVec3f rgb 
) const

Convert a rgb triplet in a certain color space to "this" color space.

GF_API void GfColorSpace::ConvertRGBASpan ( const GfColorSpace srcColorSpace,
TfSpan< float rgba 
) const

Convert in place a packed array of RGBA values from one color space to "this one.

Parameters
toThe target color space.
rgbaThe packed array of RGBA values to convert.
GF_API void GfColorSpace::ConvertRGBSpan ( const GfColorSpace srcColorSpace,
TfSpan< float rgb 
) const

Convert in place a packed array of RGB values from one color space to "this" one.

Parameters
toThe target color space.
rgbThe packed array of RGB values to convert.
GF_API float GfColorSpace::GetGamma ( ) const

Get the gamma value of the color space.

Returns
The gamma value of the color space.
GF_API float GfColorSpace::GetLinearBias ( ) const

Get the linear bias of the color space.

Returns
The linear bias of the color space.
GF_API TfToken GfColorSpace::GetName ( ) const

Get the name of the color space.

Returns
The name of the color space.
GF_API std::tuple<GfVec2f, GfVec2f, GfVec2f, GfVec2f> GfColorSpace::GetPrimariesAndWhitePoint ( ) const

Get the chromaticity coordinates and white point if the color space was constructed from primaries. The primaries and white points will be in the order red, green, blue, white. The values will be valid if the color space was constructed from primaries or a well formed primary matrix.

Returns
The chromaticity coordinates and white point; an empty optional if the color space was not constructed from primaries.
GF_API GfMatrix3f GfColorSpace::GetRGBToXYZ ( ) const

Get the RGB to XYZ conversion matrix.

Returns
The RGB to XYZ conversion matrix.
GF_API std::pair<float, float> GfColorSpace::GetTransferFunctionParams ( ) const

Get the computed K0 and Phi values for use in the transfer function.

static GF_API bool GfColorSpace::IsValid ( const TfToken name)
static

Check if a color space name is valid for constructing a GfColorSpace by name.

bool GfColorSpace::operator!= ( const GfColorSpace rh) const
inline

Check if two color spaces are not equal.

Parameters
rhThe rigt-hand side color space.
Returns
True if the color spaces are not equal, false otherwise.

Definition at line 176 of file colorSpace.h.

GF_API bool GfColorSpace::operator== ( const GfColorSpace rh) const

Check if two color spaces are equal.

Parameters
lhThe left-hand side color space.
Returns
True if the color spaces are equal, false otherwise.

Friends And Related Function Documentation

friend class GfColor
friend

Definition at line 116 of file colorSpace.h.


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