ColorProfileInterface Class Reference

#include <gfx_image_colorprofile.h>

Detailed Description

This class allows to deal with color profiles. Color profiles are used to map colors from a given color space (e.g. image color space) into a destination color space (e.g. calibrated monitor).

Public Member Functions

MAXON_METHOD Bool IsEqual (const ColorProfileInterface *other) const
 
MAXON_METHOD Result< void > WriteProfileToMemory (WritableArrayInterface< Char > &mem) const
 
MAXON_METHOD Result< void > WriteProfileToFile (const Url &fn) const
 
MAXON_METHOD String GetInfo (COLORPROFILEINFO info) const
 
MAXON_METHOD UInt32 GetCrc () const
 
MAXON_METHOD Bool HasProfile () const
 
MAXON_METHOD Bool CheckCompatiblePixelFormat (const PixelFormat &pixelFormat) const
 
MAXON_METHOD Bool IsMonitorProfileMode () const
 
MAXON_METHOD HashInt GetHashCode () const
 
MAXON_METHOD UniqueHash GetUniqueHashCode () const
 
MAXON_METHOD ColorSpace GetColorSpace () const
 
MAXON_METHOD String ToString (const FormatStatement *formatStatement=nullptr) const
 
MAXON_METHOD void GetOcioConfig (OcioConfig &config) const
 

Static Public Member Functions

static MAXON_METHOD Result< ColorProfileOpenProfileFromFile (const Url &fn)
 
static MAXON_METHOD Result< ColorProfileOpenProfileFromMemory (const Block< const Byte > &mem)
 
static MAXON_METHOD Result< ColorProfileCreateProfile (const OcioConfig &config, const CString &name)
 
static MAXON_METHOD Result< ColorProfileCreateProfile (const OcioConfig &config, const Url &iccPath)
 
static MAXON_METHOD Result< ColorProfileCreateProfile (const OcioConfig &config, const CString &viewTransform, const CString &displayColorSpace)
 
static MAXON_METHOD Result< ColorProfileCreateProfile (const ColorProfile &viewTransform, const ColorProfile &displayColorSpace)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (ColorProfileInterface, MAXON_REFERENCE_ALWAYS_COPY_ON_WRITE, "net.maxon.image.interface.colorprofile")
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( ColorProfileInterface  ,
MAXON_REFERENCE_ALWAYS_COPY_ON_WRITE  ,
"net.maxon.image.interface.colorprofile"   
)
private

◆ IsEqual()

MAXON_METHOD Bool IsEqual ( const ColorProfileInterface other) const

◆ OpenProfileFromFile()

static MAXON_METHOD Result<ColorProfile> OpenProfileFromFile ( const Url fn)
static

Create a color profile from a Url.

Parameters
[in]fnUrl of the preset. This could be an icc file from the hard drive.
Returns
A valid color profile if the operation was successful.

◆ OpenProfileFromMemory()

static MAXON_METHOD Result<ColorProfile> OpenProfileFromMemory ( const Block< const Byte > &  mem)
static

Create a color profile from a memory block. This can be used to read the color profiles within images.

Parameters
[in]memMemory block representing the icc color profile.
Returns
A valid color profile if the operation was successful.

◆ CreateProfile() [1/4]

static MAXON_METHOD Result<ColorProfile> CreateProfile ( const OcioConfig &  config,
const CString name 
)
static

Private.

◆ CreateProfile() [2/4]

static MAXON_METHOD Result<ColorProfile> CreateProfile ( const OcioConfig &  config,
const Url iccPath 
)
static

Private., requires a virtual profile in the config.

◆ CreateProfile() [3/4]

static MAXON_METHOD Result<ColorProfile> CreateProfile ( const OcioConfig &  config,
const CString viewTransform,
const CString displayColorSpace 
)
static

Private.

◆ CreateProfile() [4/4]

static MAXON_METHOD Result<ColorProfile> CreateProfile ( const ColorProfile viewTransform,
const ColorProfile displayColorSpace 
)
static

Private., both profiles must be OCIO.

◆ WriteProfileToMemory()

MAXON_METHOD Result<void> WriteProfileToMemory ( WritableArrayInterface< Char > &  mem) const

Write the current profile to memory.

Parameters
[out]memArray which receives the memory.
Returns
True if the function operates successful.

◆ WriteProfileToFile()

MAXON_METHOD Result<void> WriteProfileToFile ( const Url fn) const

Write the current profile to a file stream.

Parameters
[in]fnName of the file/stream.
Returns
True if the function operates successful.

◆ GetInfo()

MAXON_METHOD String GetInfo ( COLORPROFILEINFO  info) const

Returns additional informations to the color profile.

Parameters
[in]infoRequested information. See COLORPROFILEINFO.
Returns
String with the information stored in the color profile.

◆ GetCrc()

MAXON_METHOD UInt32 GetCrc ( ) const

Returns the crc representing this color profile.

◆ HasProfile()

MAXON_METHOD Bool HasProfile ( ) const

Returns wether the profile instance is based on an ICC profile file or not.

◆ CheckCompatiblePixelFormat()

MAXON_METHOD Bool CheckCompatiblePixelFormat ( const PixelFormat &  pixelFormat) const

Check the color profile if it's compatible with the given pixel format. (e.g. if gray scale matches)

Returns
True if the pixel format is compatible with the color profile.

◆ IsMonitorProfileMode()

MAXON_METHOD Bool IsMonitorProfileMode ( ) const

Returns whether the color profile is linked to a color profile of a monitor.

◆ GetHashCode()

MAXON_METHOD HashInt GetHashCode ( ) const

Returns the hash code of this @CLASS.

Returns
Hash code of this @CLASS.

◆ GetUniqueHashCode()

MAXON_METHOD UniqueHash GetUniqueHashCode ( ) const

Returns the 128-bit hash value of this @CLASS. The implementation ensures uniform distribution, so for practical purposes you can safely assume that two objects are equal if their hash values are equal.

Returns
Hash value of this @CLASS.

◆ GetColorSpace()

MAXON_METHOD ColorSpace GetColorSpace ( ) const

Returns the color space for which the profile is valid.

◆ ToString()

MAXON_METHOD String ToString ( const FormatStatement formatStatement = nullptr) const

Returns a readable string of the content.

Parameters
[in]formatStatementNullptr or additional formatting instruction. Currently no additional formatting instructions are supported.
Returns
The converted result. By default, this is the name of the class, followed by @, followed by the hexadecimal memory address of this object.

◆ GetOcioConfig()

MAXON_METHOD void GetOcioConfig ( OcioConfig &  config) const

Get the OCIO config for this color profile. Returns an empty OcioConfig when this is not an OCIO profile.

Parameters
[out]configThe OCIO conig.