ColorProfileConvert Class Reference

#include <c4d_basebitmap.h>

Detailed Description

A helper class to convert the ColorProfile of bitmaps.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
See also
BaseBitmap::GetPixelCnt()

Private Member Functions

 ColorProfileConvert ()
 
 ~ColorProfileConvert ()
 
 ColorProfileConvert (const ColorProfileConvert &src)
 
ColorProfileConvertoperator= (const ColorProfileConvert &src)
 

Alloc/Free

static ColorProfileConvertAlloc ()
 
static void Free (ColorProfileConvert *&convert)
 

Conversion

Bool PrepareTransform (COLORMODE srccolormode, const ColorProfile *srcprofile, COLORMODE dstcolormode, const ColorProfile *dstprofile, Bool bgr)
 
void Convert (const PIX *src, PIX *dst, Int32 cnt, Int32 SkipInputComponents, Int32 SkipOutputComponents) const
 

Constructor & Destructor Documentation

◆ ColorProfileConvert() [1/2]

ColorProfileConvert ( )
private

◆ ~ColorProfileConvert()

~ColorProfileConvert ( )
private

◆ ColorProfileConvert() [2/2]

ColorProfileConvert ( const ColorProfileConvert src)
private

Member Function Documentation

◆ operator=()

ColorProfileConvert& operator= ( const ColorProfileConvert src)
private

◆ Alloc()

static ColorProfileConvert* Alloc ( )
static

Allocates a ColorProfileConvert instance. Destroy the allocated ColorProfileConvert instance with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated ColorProfileConvert object, or nullptr if the allocation failed.

◆ Free()

static void Free ( ColorProfileConvert *&  convert)
static

Destructs ColorProfileConvert instances allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]convertThe ColorProfileConvert instance to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ PrepareTransform()

Bool PrepareTransform ( COLORMODE  srccolormode,
const ColorProfile srcprofile,
COLORMODE  dstcolormode,
const ColorProfile dstprofile,
Bool  bgr 
)

Prepares the color conversion i.e. checks if a conversion is needed.
A conversion is only necessary if true is returned. Two identical color spaces will return false.

Parameters
[in]srccolormodeThe source color mode: COLORMODE
[in]srcprofileThe source color profile: The caller owns the pointed color profile.
[in]dstcolormodeThe destination color mode: COLORMODE
[in]dstprofileThe destination color profile: The caller owns the pointed color profile.
[in]bgrtrue to swap the RGB channels, otherwise false.. Only necessary when working directly with Windows bitmaps.
Returns
true if a conversion is necessary, otherwise false.

◆ Convert()

void Convert ( const PIX src,
PIX dst,
Int32  cnt,
Int32  SkipInputComponents,
Int32  SkipOutputComponents 
) const

Converts the color profiles of the pixel data.

Parameters
[in]srcThe pointer to the source pixel buffer. The caller owns the pointed buffer.
[out]dstThe pointer to the destination pixel buffer. The caller owns the pointed buffer.
[in]cntThe number of pixels to convert.
[in]SkipInputComponentsThe number of bytes to skip in the source buffer after each converted pixel. For instance a RGB pixel contains 3 bytes.
After conversion the number of SkipInputComponents bytes is added to the source pointer.
[in]SkipOutputComponentsThe number of bytes to skip in the destination buffer after each converted pixel. For instance a RGB pixel contains 3 bytes.
After conversion the number of SkipOutputComponents bytes is added to the destination pointer.