3ds Max C++ API Reference
Loading...
Searching...
No Matches
IColorPipeline Class Referenceabstract

Interface class that defines color conversions from source color space to target color space. More...

#include <IColorPipeline.h>

+ Inheritance diagram for IColorPipeline:

Classes

class  IParameter
 Dynamic parameters for the IColorPipeline objects. More...
 

Public Types

enum  Flags : uint32_t { FLAG_NONE = 0 , FLAG_OPTIMIZATION_NONE = 1ul << 0 , FLAG_OPTIMIZATION_LOSSLESS = 1ul << 1 }
 ColorConverter Flags. More...
 

Public Member Functions

 IColorPipeline ()=default
 
virtual ~IColorPipeline ()=default
 
template<class TSRC , class TDST >
std::unique_ptr< ColorConverter< TSRC, TDST > > GetColorConverter (uint32_t flags=FLAG_NONE)
 This function returns an optimized color converter object for the given source and destination pixel data types.
 
virtual MSTR GetDiagnosticString ()=0
 Returns list of operations this pipeline will apply.
 
Dynamic Parameters
virtual size_t GetNumParameters () const =0
 
virtual IParameterGetParameter (size_t idx) const =0
 Retrieves the pointer to the dynamic parameter object by 0-based index number.
 
virtual IParameterGetParameter (const MSTR &paramName) const =0
 Retrieves the pointer to the dynamic parameter by the parameter name. Each parameter has a unique name.
 

Protected Member Functions

virtual IColorEngineGetEngine (ImageLayoutInfo::ChannelType eTypeSrc, ImageLayoutInfo::ChannelType eTypeDst, uint32_t flags)=0
 Internal function.
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

Detailed Description

Interface class that defines color conversions from source color space to target color space.

User can get an instance by calling one of the GetXXXPipeline() functions of the class IColorPipelineMgr. Actual color conversion will be done by a ColorConverter object which can be created by calling IColorPipeline::GetColorConverter() templated factory functions with desired source and destination image formats.

See also
Color Management Overview, ColorConverter, ImageLayoutInfo
Warning
Please note that none of the functions of this class are thread safe and should ideally be called from the main thread.

Member Enumeration Documentation

◆ Flags

enum Flags : uint32_t

ColorConverter Flags.

Enumerator
FLAG_NONE 
FLAG_OPTIMIZATION_NONE 

Turn color conversion optimizations off (useful for debugging)

FLAG_OPTIMIZATION_LOSSLESS 

Perform only lossless optimizations for color conversions (higher quality but slower)

59 {
60 FLAG_NONE = 0,
61 FLAG_OPTIMIZATION_NONE = 1ul << 0,
63 };
@ FLAG_OPTIMIZATION_NONE
Turn color conversion optimizations off (useful for debugging)
Definition: IColorPipeline.h:61
@ FLAG_NONE
Definition: IColorPipeline.h:60
@ FLAG_OPTIMIZATION_LOSSLESS
Perform only lossless optimizations for color conversions (higher quality but slower)
Definition: IColorPipeline.h:62

Constructor & Destructor Documentation

◆ IColorPipeline()

IColorPipeline ( )
default

◆ ~IColorPipeline()

virtual ~IColorPipeline ( )
virtualdefault

Member Function Documentation

◆ GetNumParameters()

virtual size_t GetNumParameters ( ) const
pure virtual

Returns the number of dynamic parameters this pipeline has, can be zero.

◆ GetParameter() [1/2]

virtual IParameter * GetParameter ( size_t  idx) const
pure virtual

Retrieves the pointer to the dynamic parameter object by 0-based index number.

◆ GetParameter() [2/2]

virtual IParameter * GetParameter ( const MSTR paramName) const
pure virtual

Retrieves the pointer to the dynamic parameter by the parameter name. Each parameter has a unique name.

◆ GetColorConverter()

std::unique_ptr< ColorConverter< TSRC, TDST > > GetColorConverter ( uint32_t  flags = FLAG_NONE)
inline

This function returns an optimized color converter object for the given source and destination pixel data types.

Returned ColorConverter objects are stateless, thus can safely be used to process colors in multiple threads in parallel. Returned value is unique_ptr which means caller owns the object.

Calling IColorPipeline::GetColorConverter() for the first time for a complex pipeline may take some time, thus for time-critical tasks get a ColorConverter pointer beforehand and reuse it when needed. The system caches color converter objects for a given TSRC, TDST pair, so subsequent calls to this function with the same TSRC, TDST values may be faster than the first call.

See also
ImageLayoutInfo
Template Parameters
TSRCSource pixel data type. ImageLayoutInfo should have a specialization for this this type, otherwise you'll get a compile-time error.
TDSTDestination pixel data type. ImageLayoutInfo should have a specialization for this this type, otherwise you'll get a compile-time error.
Parameters
[in]flagscurrently not used. Always pass FLAG_NONE.
Returns
unique_ptr to optimized ColorConverter object for the specified TSRC and TDST pixel types.
106 {
107 constexpr ImageLayoutInfo::ChannelType eTypeSrc = ImageLayoutInfo::ChanType<TSRC>();
108 constexpr ImageLayoutInfo::ChannelType eTypeDst = ImageLayoutInfo::ChanType<TDST>();
109
110 auto engine = std::unique_ptr<IColorEngine>(GetEngine(eTypeSrc, eTypeDst, flags));
111 auto pCPUConverter = std::make_unique<ColorConverter<TSRC, TDST>>(std::move(engine));
112 return pCPUConverter;
113 }
virtual IColorEngine * GetEngine(ImageLayoutInfo::ChannelType eTypeSrc, ImageLayoutInfo::ChannelType eTypeDst, uint32_t flags)=0
Internal function.
ChannelType
Data type and bit-depth of each color channel of the pixel.
Definition: ImageLayoutInfo.h:48

◆ GetDiagnosticString()

virtual MSTR GetDiagnosticString ( )
pure virtual

Returns list of operations this pipeline will apply.


This function can be used for diagnostic purposed to check and verify the list of operations the pipeline will apply to transform colors.

Returns
List of operations both in non-optimized and optimized form. Operations will be listed in CTF (color transform format).

◆ GetEngine()

virtual IColorEngine * GetEngine ( ImageLayoutInfo::ChannelType  eTypeSrc,
ImageLayoutInfo::ChannelType  eTypeDst,
uint32_t  flags 
)
protectedpure virtual

Internal function.