Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccEncoding.cpp File Reference
#include "IccEncoding.h"
#include "IccProfile.h"
#include "IccTag.h"
#include "IccTagMPE.h"
#include "IccMpeBasic.h"
#include "IccCAM.h"
#include "IccUtil.h"
#include <string>
#include <time.h>
#include <cstring>
+ Include dependency graph for IccEncoding.cpp:

Go to the source code of this file.

Classes

class  CIccDefaultEncProfileCacheHandler
 
class  CIccDefaultEncProfileConverter
 

Functions

icStatusEncConvert icConvertEncodingProfile (CIccProfilePtr &newIcc, CIccProfile *pEncodeIcc)
 
static icFloatNumber icGetParamFloatNum (CIccTagStruct *pParams, icColorEncodingParamsMemberSignature sig, icFloatNumber defaultValue=0)
 
static void icYxy2XYZVector (icFloatNumber *XYZ, icFloatNumber Y, icFloatNumber *xy, icUInt8Number idxOffset=1)
 

Variables

static IIccEncProfileCacheHandlerg_pEncProfileCacheHandler = NULL
 
static IIccEncProfileConverterg_pEncProfileConverter = NULL
 

Function Documentation

◆ icConvertEncodingProfile()

icStatusEncConvert icConvertEncodingProfile ( CIccProfilePtr & newIcc,
CIccProfile * pEncodeIcc )

Definition at line 534 of file IccEncoding.cpp.

535{
536 newIcc = NULL;
537
538 if (!pEncodeIcc || pEncodeIcc->m_Header.deviceClass!=icSigColorEncodingClass)
540
541 CIccTag *pTag;
542 CIccTagStruct *pParams=NULL;
543 pTag = pEncodeIcc->FindTagOfType(icSigReferenceNameTag, icSigUtf8TextType);
544 if (pTag) {
545 CIccTagUtf8Text *pText = (CIccTagUtf8Text*)pTag;
546 const icUChar *szRefName = pText->GetText();
547 if (!strcmp((const char*)szRefName, "ISO 22028-1")) {
548 pTag = pEncodeIcc->FindTagOfType(icSigColorEncodingParamsTag, icSigTagStructType);
549 if (pTag)
550 pParams = (CIccTagStruct*)pTag->NewCopy();
551 }
552 else {
553 CIccTag *pNameTag = pEncodeIcc->FindTagOfType(icSigColorSpaceNameTag, icSigUtf8TextType);
554 if (pNameTag) {
555 pText = (CIccTagUtf8Text *)pNameTag;
556 const icUChar *szName = pText->GetText();
557
559 if (!pBaseIcc) {
561 }
562
563 pTag = pBaseIcc->FindTagOfType(icSigColorEncodingParamsTag, icSigTagStructType);
564 if (!pTag) {
565 delete pBaseIcc;
567 }
568 pParams = (CIccTagStruct*)pTag->NewCopy();
569 delete pBaseIcc;
570
571 //Now Copy Overrides into pParams (if they exist in pEncodeIcc
572 CIccTag *pOverridesTag = pEncodeIcc->FindTagOfType(icSigColorEncodingParamsTag, icSigTagStructType);
573 if (pOverridesTag) {
574 CIccTagStruct *pStruct = (CIccTagStruct*)pOverridesTag;
575 TagEntryList *pTags = pStruct->GetElemList();
576 if (pTags) {
577 TagEntryList::iterator entry;
578 for (entry=pTags->begin(); entry!=pTags->end(); entry++) {
579 if (entry->pTag) {
580 pStruct->DeleteElem(entry->TagInfo.sig);
581 pStruct->AttachElem(entry->TagInfo.sig, entry->pTag->NewCopy());
582 }
583 }
584 }
585 }
586 }
587 }
588 }
589
590 if (!pParams) {
592 }
593
594 //Create and initialize new profile from pEncodeIcc and pParams
595 icStatusEncConvert stat = IIccEncProfileConverter::GetHandler()->ConvertFromParams(newIcc, pParams, &pEncodeIcc->m_Header);
596
597 delete pParams;
598
599 return stat;
600}
unsigned char icUChar
Definition IccDefs.h:110
icStatusEncConvert
Definition IccEncoding.h:74
@ icEncConvertBadProfile
Definition IccEncoding.h:76
@ icEncConvertNoBaseProfile
Definition IccEncoding.h:77
@ icEncConvertBadBaseProfile
Definition IccEncoding.h:78
const icChar * szName
Class: CIccTag.
virtual CIccTag * NewCopy() const
Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
Class: CIccTagStruct.
bool AttachElem(icSignature sig, CIccTag *pTag)
Name: CIccTagStruct::AttachTag.
bool DeleteElem(icSignature sig)
Name: CIccTagStruct::DeleteSubTag.
TagEntryList * GetElemList()
Class: CIccTagUtf8Text()
const icUChar * GetText() const
virtual CIccProfile * GetEncodingProfile(const icUChar *szColorSpaceName)=0
static IIccEncProfileCacheHandler * GetHandler()
static IIccEncProfileConverter * GetHandler()
virtual icStatusEncConvert ConvertFromParams(CIccProfilePtr &newIcc, CIccTagStruct *pParams, icHeader *pHeader)=0
@ icSigColorEncodingClass
@ icSigUtf8TextType
@ icSigTagStructType
@ icSigColorSpaceNameTag
@ icSigColorEncodingParamsTag
@ icSigReferenceNameTag

References CIccTagStruct::AttachElem(), IIccEncProfileConverter::ConvertFromParams(), CIccTagStruct::DeleteElem(), CIccTagStruct::GetElemList(), IIccEncProfileCacheHandler::GetEncodingProfile(), IIccEncProfileCacheHandler::GetHandler(), IIccEncProfileConverter::GetHandler(), CIccTagUtf8Text::GetText(), icEncConvertBadBaseProfile, icEncConvertBadProfile, icEncConvertNoBaseProfile, icSigColorEncodingClass, icSigColorEncodingParamsTag, icSigColorSpaceNameTag, icSigReferenceNameTag, icSigTagStructType, icSigUtf8TextType, CIccTag::NewCopy(), and szName.

+ Here is the call graph for this function:

◆ icGetParamFloatNum()

static icFloatNumber icGetParamFloatNum ( CIccTagStruct * pParams,
icColorEncodingParamsMemberSignature sig,
icFloatNumber defaultValue = 0 )
static

Definition at line 125 of file IccEncoding.cpp.

126{
128
129 if (!pTag || pTag->GetSize()<1)
130 return defaultValue;
131
132 return (*pTag)[0];
133}
icArraySignature sig
Class: CIccTagFloatNum.
icUInt32Number GetSize() const
Returns the size of the data array.
CIccTag * FindElemOfType(icSignature sig, icTagTypeSignature sigType)
Name: CIccTagStruct::FindElemOfType.
@ icSigFloat32ArrayType

References CIccTagStruct::FindElemOfType(), CIccTagFloatNum< T, Tsig >::GetSize(), icSigFloat32ArrayType, and sig.

+ Here is the call graph for this function:

◆ icYxy2XYZVector()

static void icYxy2XYZVector ( icFloatNumber * XYZ,
icFloatNumber Y,
icFloatNumber * xy,
icUInt8Number idxOffset = 1 )
static

Definition at line 135 of file IccEncoding.cpp.

136{
137 XYZ[0] = Y*xy[0] / xy[1];
138 XYZ[idxOffset] = Y;
139 XYZ[idxOffset<<1] = Y*(1.0f-xy[0]-xy[1]) / xy[1];
140}

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

+ Here is the caller graph for this function:

Variable Documentation

◆ g_pEncProfileCacheHandler

IIccEncProfileCacheHandler* g_pEncProfileCacheHandler = NULL
static

◆ g_pEncProfileConverter

IIccEncProfileConverter* g_pEncProfileConverter = NULL
static