Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
CIccTagLut8 Class Reference

Class: CIccTagLut8. More...

#include <IccTagLut.h>

+ Inheritance diagram for CIccTagLut8:
+ Collaboration diagram for CIccTagLut8:

Public Member Functions

 CIccTagLut8 ()
 Name: CIccTagLut8::CIccTagLut8.
 
 CIccTagLut8 (const CIccTagLut8 &ITL)
 Name: CIccTagLut8::CIccTagLut8.
 
virtual icUInt8Number GetPrecision ()
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagLut8operator= (const CIccTagLut8 &ITL)
 Name: CIccTagLut8::operator=.
 
bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagLut8::Read.
 
virtual void SetColorSpaces (icColorSpaceSignature csInput, icColorSpaceSignature csOutput)
 Name: CIccTagLut8::SetColorSpaces.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
 Name: CIccTagLut8::Validate.
 
bool Write (CIccIO *pIO)
 Name: CIccTagLut8::Write.
 
virtual ~CIccTagLut8 ()
 Name: CIccTagLut8::~CIccTagLut8.
 
- Public Member Functions inherited from CIccMBB
 CIccMBB ()
 Name: CIccMBB::CIccMBB.
 
 CIccMBB (const CIccMBB &IMBB)
 Name: CIccMBB::CIccMBB.
 
void Cleanup ()
 Name: CIccMBB::Cleanup.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccMBB::Describe.
 
CIccCLUTGetCLUT () const
 
icColorSpaceSignature GetCsInput ()
 
icColorSpaceSignature GetCsOutput ()
 
LPIccCurveGetCurvesA () const
 
LPIccCurveGetCurvesB () const
 
LPIccCurveGetCurvesM () const
 
CIccMatrixGetMatrix () const
 
void Init (icUInt8Number nInputChannels, icUInt8Number nOutputChannels)
 Name: CIccMBB::Init.
 
icUInt8Number InputChannels () const
 
bool IsInputB ()
 
virtual bool IsInputMatrix ()
 
virtual bool IsMBBType ()
 
CIccCLUTNewCLUT (icUInt8Number *pGridPoints, icUInt8Number nPrecision=2)
 Name: CIccMBB::NewCLUT.
 
CIccCLUTNewCLUT (icUInt8Number nGridPoints, icUInt8Number nPrecision=2)
 Name: CIccMBB::NewCLUT.
 
LPIccCurveNewCurvesA ()
 Name: CIccMBB::NewCurvesA.
 
LPIccCurveNewCurvesB ()
 Name: CIccMBB::NewCurvesB.
 
LPIccCurveNewCurvesM ()
 Name: CIccMBB::NewCurvesM.
 
CIccMatrixNewMatrix ()
 Name: CIccMBB::NewMatrix.
 
CIccMBBoperator= (const CIccMBB &IMBB)
 Name: CIccMBB::operator=.
 
icUInt8Number OutputChannels () const
 
CIccCLUTSetCLUT (CIccCLUT *clut)
 Name: CIccMBB::SetCLUT.
 
bool SwapMBCurves ()
 
virtual bool UseLegacyPCS () const
 
virtual ~CIccMBB ()
 Name: CIccMBB::~CIccMBB.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual const icCharGetClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual bool IsArrayType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 Function: Read(size, pIO) - Read tag from file.
 
virtual bool ReadAll ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Function: Validate Each derived tag will implement it's own IsValid() function.
 
virtual ~CIccTag ()
 Name: CIccTag::CIccTag.
 

Protected Attributes

icUInt8Number m_nReservedByte
 
icS15Fixed16Number m_XYZMatrix [9]
 
- Protected Attributes inherited from CIccMBB
bool m_bInputMatrix
 
bool m_bUseMCurvesAsBCurves
 
CIccCLUTm_CLUT
 
icColorSpaceSignature m_csInput
 
icColorSpaceSignature m_csOutput
 
LPIccCurvem_CurvesA
 
LPIccCurvem_CurvesB
 
LPIccCurvem_CurvesM
 
CIccMatrixm_Matrix
 
icUInt8Number m_nInput
 
icUInt8Number m_nOutput
 

Additional Inherited Members

- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 

Detailed Description

Class: CIccTagLut8.

Purpose: The Lut8 tag type

Definition at line 547 of file IccTagLut.h.

Constructor & Destructor Documentation

◆ CIccTagLut8() [1/2]

CIccTagLut8::CIccTagLut8 ( )

Name: CIccTagLut8::CIccTagLut8.

Purpose: Constructor

Definition at line 4450 of file IccTagLut.cpp.

4451{
4452 memset(m_XYZMatrix, 0, sizeof(m_XYZMatrix));
4453 m_XYZMatrix[0] = m_XYZMatrix[4] = m_XYZMatrix[8] = icDtoF(1.0);
4454 m_nReservedByte = 0;
4455}
icS15Fixed16Number icDtoF(icFloatNumber num)
Definition IccUtil.cpp:545
icUInt8Number m_nReservedByte
Definition IccTagLut.h:566
icS15Fixed16Number m_XYZMatrix[9]
Definition IccTagLut.h:567

References icDtoF(), m_nReservedByte, and m_XYZMatrix.

+ Here is the call graph for this function:

◆ CIccTagLut8() [2/2]

CIccTagLut8::CIccTagLut8 ( const CIccTagLut8 & ITL)

Name: CIccTagLut8::CIccTagLut8.

Purpose: Copy Constructor

Args: ITL = The CIccTagLut8 object to be copied

Definition at line 4468 of file IccTagLut.cpp.

4468 : CIccMBB(ITL)
4469{
4470 memcpy(&m_XYZMatrix, &ITL.m_XYZMatrix, sizeof(m_XYZMatrix));
4471 m_nReservedByte = 0;
4472}
CIccMBB()
Name: CIccMBB::CIccMBB.

References m_nReservedByte, and m_XYZMatrix.

◆ ~CIccTagLut8()

CIccTagLut8::~CIccTagLut8 ( )
virtual

Name: CIccTagLut8::~CIccTagLut8.

Purpose: Destructor

Definition at line 4505 of file IccTagLut.cpp.

4506{
4507}

Member Function Documentation

◆ GetPrecision()

virtual icUInt8Number CIccTagLut8::GetPrecision ( )
inlinevirtual

Reimplemented from CIccMBB.

Definition at line 557 of file IccTagLut.h.

557{ return 1; }

◆ GetType()

virtual icTagTypeSignature CIccTagLut8::GetType ( ) const
inlinevirtual

Function: GetType()

Purpose: Get Tag Type. Each derived tag will implement it's own GetType() function.

Reimplemented from CIccTag.

Definition at line 556 of file IccTagLut.h.

556{ return icSigLut8Type; }
@ icSigLut8Type

References icSigLut8Type.

Referenced by Read(), Validate(), and Write().

+ Here is the caller graph for this function:

◆ NewCopy()

virtual CIccTag * CIccTagLut8::NewCopy ( ) const
inlinevirtual

Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.

Parameter(s): none

Returns a new CIccTag object that is a copy of this object.

Reimplemented from CIccMBB.

Definition at line 553 of file IccTagLut.h.

553{return new CIccTagLut8(*this);}
CIccTagLut8()
Name: CIccTagLut8::CIccTagLut8.

◆ operator=()

CIccTagLut8 & CIccTagLut8::operator= ( const CIccTagLut8 & ITL)

Name: CIccTagLut8::operator=.

Purpose: Copy Operator

Args: ITL = The CIccTagLut8 object to be copied

Definition at line 4485 of file IccTagLut.cpp.

4486{
4487 if (&ITL==this)
4488 return *this;
4489
4490 CIccMBB::operator=(ITL);
4491 memcpy(&m_XYZMatrix, &ITL.m_XYZMatrix, sizeof(m_XYZMatrix));
4492
4493 return *this;
4494}
CIccMBB & operator=(const CIccMBB &IMBB)
Name: CIccMBB::operator=.

References m_XYZMatrix, and CIccMBB::operator=().

+ Here is the call graph for this function:

◆ Read()

bool CIccTagLut8::Read ( icUInt32Number size,
CIccIO * pIO )
virtual

Name: CIccTagLut8::Read.

Purpose: Read in the tag contents into a data block

Args: size - # of bytes in tag, pIO - IO object to read tag from

Return: true = successful, false = failure

Reimplemented from CIccTag.

Definition at line 4524 of file IccTagLut.cpp.

4525{
4527 icUInt32Number nStart, nEnd;
4528 icUInt8Number i, nGrid;
4529 LPIccCurve *pCurves;
4530 CIccTagCurve *pCurve;
4531
4532 if (size<13*sizeof(icUInt32Number) || !pIO) {
4533 return false;
4534 }
4535
4536 nStart = pIO->Tell();
4537 nEnd = nStart + size;
4538
4539 if (!pIO->Read32(&sig) ||
4540 !pIO->Read32(&m_nReserved) ||
4541 !pIO->Read8(&m_nInput) ||
4542 !pIO->Read8(&m_nOutput) ||
4543 !pIO->Read8(&nGrid) ||
4544 !pIO->Read8(&m_nReservedByte) ||
4545 pIO->Read32(m_XYZMatrix, 9) != 9)
4546 return false;
4547
4548 if (sig!=GetType())
4549 return false;
4550
4551 //B Curves
4552 pCurves = NewCurvesB();
4553
4554 for (i=0; i<m_nInput; i++) {
4555 if (256 > nEnd - pIO->Tell())
4556 return false;
4557
4558 pCurves[i] = pCurve = (CIccTagCurve*)CIccTag::Create(icSigCurveType);
4559
4560 if (!pCurve->SetSize(256))
4561 return false;
4562
4563 if (pIO->ReadUInt8Float(&(*pCurve)[0], 256) != 256)
4564 return false;
4565 }
4566
4567 //CLUT
4569 if (m_CLUT == NULL)
4570 return false;
4571
4572 if (!m_CLUT->Init(nGrid, nEnd - pIO->Tell(), 1))
4573 return false;
4574
4575 if (!m_CLUT->ReadData(nEnd - pIO->Tell(), pIO, 1))
4576 return false;
4577
4578 //A Curves
4579 pCurves = NewCurvesA();
4580 if (pCurves == NULL)
4581 return false;
4582
4583 for (i=0; i<m_nOutput; i++) {
4584 if (256 > nEnd - pIO->Tell())
4585 return false;
4586
4587 pCurves[i] = pCurve = (CIccTagCurve*)CIccTag::Create(icSigCurveType);
4588
4589 if (!pCurve->SetSize(256))
4590 return false;
4591
4592 if (pIO->ReadUInt8Float(&(*pCurve)[0], 256) != 256)
4593 return false;
4594 }
4595 return true;
4596}
icArraySignature sig
icTagTypeSignature
unsigned int icUInt32Number
Class: CIccCLUT.
Definition IccTagLut.h:326
bool ReadData(icUInt32Number size, CIccIO *pIO, icUInt8Number nPrecision)
Name: CIccCLUT::ReadData.
bool Init(icUInt8Number nGridPoints, icUInt32Number nMaxSize=0, icUInt8Number nBytesPerPoint=4)
Name: CIccCLUT::Init.
Class: CIccCurve.
Definition IccTagLut.h:91
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:104
virtual icInt32Number Tell()
Definition IccIO.h:133
icInt32Number ReadUInt8Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:203
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
LPIccCurve * NewCurvesB()
Name: CIccMBB::NewCurvesB.
CIccCLUT * m_CLUT
Definition IccTagLut.h:487
icUInt8Number m_nOutput
Definition IccTagLut.h:481
LPIccCurve * NewCurvesA()
Name: CIccMBB::NewCurvesA.
icUInt8Number m_nInput
Definition IccTagLut.h:480
Class: CIccTagCurve.
Definition IccTagLut.h:128
bool SetSize(icUInt32Number nSize, icTagCurveSizeInit nSizeOpt=icInitZero)
Name: CIccTagCurve::SetSize.
icUInt32Number m_nReserved
static CIccTag * Create(icTagTypeSignature sig)
Name: CIccTag::Create.
virtual icTagTypeSignature GetType() const
Function: GetType()
Definition IccTagLut.h:556
unsigned char icUInt8Number
Number definitions.
@ icSigCurveType

References CIccTag::Create(), GetType(), icSigCurveType, CIccCLUT::Init(), CIccMBB::m_CLUT, CIccMBB::m_nInput, CIccMBB::m_nOutput, CIccTag::m_nReserved, m_nReservedByte, m_XYZMatrix, CIccMBB::NewCurvesA(), CIccMBB::NewCurvesB(), CIccIO::Read32(), CIccIO::Read8(), CIccCLUT::ReadData(), CIccIO::ReadUInt8Float(), CIccTagCurve::SetSize(), sig, and CIccIO::Tell().

+ Here is the call graph for this function:

◆ SetColorSpaces()

void CIccTagLut8::SetColorSpaces ( icColorSpaceSignature csInput,
icColorSpaceSignature csOutput )
virtual

Name: CIccTagLut8::SetColorSpaces.

Purpose: Sets the input and output color spaces

Args: csInput = input color space signature, csOutput = output color space signature

Reimplemented from CIccMBB.

Definition at line 4611 of file IccTagLut.cpp.

4612{
4613 if (csInput==icSigXYZData) {
4614 int i;
4615
4616 if (!m_CurvesM && IsInputMatrix()) { //Transfer ownership of curves
4618 m_CurvesB = NULL;
4619
4620 LPIccCurve *pCurves = NewCurvesB();
4621 CIccTagCurve *pCurve;
4622 for (i=0; i<m_nInput; i++) {
4623 pCurves[i] = pCurve = (CIccTagCurve*)CIccTag::Create(icSigCurveType);
4624 pCurve->SetSize(0);
4625 }
4626
4628 }
4629
4630 if (!m_Matrix) {
4631 CIccMatrix *pMatrix = NewMatrix();
4632 for (i=0; i<9; i++) {
4633 pMatrix->m_e[i] = icFtoD(m_XYZMatrix[i]);
4634 }
4635
4636 pMatrix->m_bUseConstants=false;
4637 }
4638 }
4639 else {
4640 m_XYZMatrix[0] = m_XYZMatrix[4] = m_XYZMatrix[8] = icDtoF(1.0);
4641 m_XYZMatrix[1] = m_XYZMatrix[2] = m_XYZMatrix[3] =
4642 m_XYZMatrix[5] = m_XYZMatrix[6] = m_XYZMatrix[7] = 0;
4643 }
4644
4645 CIccMBB::SetColorSpaces(csInput, csOutput);
4646}
icFloatNumber icFtoD(icS15Fixed16Number num)
Definition IccUtil.cpp:559
LPIccCurve * m_CurvesB
Definition IccTagLut.h:490
CIccMatrix * NewMatrix()
Name: CIccMBB::NewMatrix.
virtual bool IsInputMatrix()
Definition IccTagLut.h:442
LPIccCurve * m_CurvesM
Definition IccTagLut.h:489
virtual void SetColorSpaces(icColorSpaceSignature csInput, icColorSpaceSignature csOutput)
Name: CIccMBB::SetColorSpaces.
bool m_bUseMCurvesAsBCurves
Definition IccTagLut.h:478
CIccMatrix * m_Matrix
Definition IccTagLut.h:488
Class: CIccMatrix.
Definition IccTagLut.h:260
icFloatNumber m_e[12]
Definition IccTagLut.h:269
bool m_bUseConstants
Definition IccTagLut.h:270
@ icSigXYZData

References CIccTag::Create(), icDtoF(), icFtoD(), icSigCurveType, icSigXYZData, CIccMBB::IsInputMatrix(), CIccMatrix::m_bUseConstants, CIccMBB::m_bUseMCurvesAsBCurves, CIccMBB::m_CurvesB, CIccMBB::m_CurvesM, CIccMatrix::m_e, CIccMBB::m_Matrix, CIccMBB::m_nInput, m_XYZMatrix, CIccMBB::NewCurvesB(), CIccMBB::NewMatrix(), CIccMBB::SetColorSpaces(), and CIccTagCurve::SetSize().

+ Here is the call graph for this function:

◆ Validate()

icValidateStatus CIccTagLut8::Validate ( std::string sigPath,
std::string & sReport,
const CIccProfile * pProfile = NULL )
virtual

Name: CIccTagLut8::Validate.

Purpose: Check tag data validity.

Args: sig = signature of tag being validated, sReport = String to add report information to

Return: icValidateStatusOK if valid, or other error status.

Reimplemented from CIccMBB.

Definition at line 4777 of file IccTagLut.cpp.

4778{
4779 icValidateStatus rv = CIccMBB::Validate(sigPath, sReport, pProfile);
4780
4781 CIccInfo Info;
4782 std::string sSigPathName = Info.GetSigPathName(sigPath);
4784
4785 if (!pProfile) {
4786 return rv;
4787 }
4788
4789 switch(sig) {
4790 case icSigAToB0Tag:
4791 case icSigAToB1Tag:
4792 case icSigAToB2Tag:
4793 case icSigBToA0Tag:
4794 case icSigBToA1Tag:
4795 case icSigBToA2Tag:
4796 case icSigGamutTag:
4797 {
4798 icUInt32Number nInput, nOutput;
4800 nInput = icGetSpaceSamples(pProfile->m_Header.pcs);
4801 nOutput = icGetSpaceSamples(pProfile->m_Header.colorSpace);
4802 }
4803 else {
4804 nInput = icGetSpaceSamples(pProfile->m_Header.colorSpace);
4805 nOutput = icGetSpaceSamples(pProfile->m_Header.pcs);
4806 }
4807
4808 if (sig==icSigGamutTag) {
4809 nOutput = 1;
4810 }
4811
4812 icUInt8Number i;
4813 if (m_CurvesB) {
4814 for (i=0; i<nInput; i++) {
4815 if (m_CurvesB[i]) {
4816 rv = icMaxStatus(rv, m_CurvesB[i]->Validate(sigPath+icGetSigPath(GetType()), sReport, pProfile));
4817 if (m_CurvesB[i]->GetType()==icSigCurveType) {
4818 CIccTagCurve *pTagCurve = (CIccTagCurve*)m_CurvesB[i];
4819 if (pTagCurve->GetSize()==1) {
4820 sReport += icMsgValidateCriticalError;
4821 sReport += sSigPathName;
4822 sReport += " - lut8Tags do not support single entry gamma curves.\n";
4824 }
4825 }
4826 }
4827 else {
4828 sReport += icMsgValidateCriticalError;
4829 sReport += sSigPathName;
4830 sReport += " - Incorrect number of B-curves.\n";
4832 }
4833 }
4834 }
4835
4836 if (m_Matrix) {
4837 rv = icMaxStatus(rv, m_Matrix->Validate(sigPath + icGetSigPath(GetType()), sReport, pProfile));
4838 }
4839 else {
4840 int sum=0;
4841 for (int i=0; i<9; i++) {
4842 sum += m_XYZMatrix[i];
4843 }
4844 if (m_XYZMatrix[0]!=1.0 || m_XYZMatrix[4]!=1.0 || m_XYZMatrix[8]!=1.0 || sum!=3.0) {
4845 sReport += icMsgValidateWarning;
4846 sReport += sSigPathName;
4847 sReport += " - Matrix must be identity.\n";
4849 }
4850 }
4851
4852 if (m_CurvesA) {
4853
4854 for (i=0; i<nOutput; i++) {
4855 if (m_CurvesA[i]) {
4856 rv = icMaxStatus(rv, m_CurvesA[i]->Validate(sigPath+icGetSigPath(GetType()), sReport, pProfile));
4857 if (m_CurvesA[i]->GetType()==icSigCurveType) {
4858 CIccTagCurve *pTagCurve = (CIccTagCurve*)m_CurvesA[i];
4859 if (pTagCurve->GetSize()==1) {
4860 sReport += icMsgValidateCriticalError;
4861 sReport += sSigPathName;
4862 sReport += " - lut8Tags do not support single entry gamma curves.\n";
4864 }
4865 }
4866 }
4867 else {
4868 sReport += icMsgValidateCriticalError;
4869 sReport += sSigPathName;
4870 sReport += " - Incorrect number of A-curves.\n";
4872 }
4873 }
4874
4875 }
4876
4877 break;
4878 }
4879 default:
4880 {
4881 }
4882 }
4883
4884
4885 return rv;
4886}
icValidateStatus
Definition IccDefs.h:118
@ icValidateWarning
Definition IccDefs.h:120
@ icValidateCriticalError
Definition IccDefs.h:122
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
Definition IccUtil.cpp:244
std::string icGetSigPath(icUInt32Number nSig)
Definition IccUtil.cpp:1191
const char * icMsgValidateWarning
Definition IccUtil.cpp:90
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
icSignature icGetFirstSigPathSig(std::string sigPath)
Definition IccUtil.cpp:1201
Type: Class.
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
Name: CIccMBB::Validate.
LPIccCurve * m_CurvesA
Definition IccTagLut.h:486
icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccMatrix::Validate.
icUInt32Number GetSize() const
Definition IccTagLut.h:148
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
Name: CIccTagLut8::Validate.
icUInt32Number icSignature
@ icSigBToA2Tag
@ icSigAToB0Tag
@ icSigBToA1Tag
@ icSigAToB2Tag
@ icSigBToA0Tag
@ icSigAToB1Tag
@ icSigGamutTag

References CIccInfo::GetSigPathName(), CIccTagCurve::GetSize(), GetType(), icGetFirstSigPathSig(), icGetSigPath(), icGetSpaceSamples(), icMaxStatus(), icMsgValidateCriticalError, icMsgValidateWarning, icSigAToB0Tag, icSigAToB1Tag, icSigAToB2Tag, icSigBToA0Tag, icSigBToA1Tag, icSigBToA2Tag, icSigCurveType, icSigGamutTag, icValidateCriticalError, icValidateWarning, CIccMBB::m_CurvesA, CIccMBB::m_CurvesB, CIccMBB::m_Matrix, m_XYZMatrix, sig, CIccMatrix::Validate(), CIccMBB::Validate(), and Validate().

Referenced by Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Write()

bool CIccTagLut8::Write ( CIccIO * pIO)
virtual

Name: CIccTagLut8::Write.

Purpose: Write the tag to a file

Args: pIO - The IO object to write tag to.

Return: true = succesful, false = failure

Reimplemented from CIccTag.

Definition at line 4662 of file IccTagLut.cpp.

4663{
4665 icUInt8Number i, nGrid;
4666 icS15Fixed16Number XYZMatrix[9];
4667 icUInt16Number nInputEntries, nOutputEntries;
4668 LPIccCurve *pCurves;
4669 CIccTagCurve *pCurve;
4671
4672 if (m_Matrix) {
4673 for (i=0; i<9; i++)
4674 XYZMatrix[i] = icDtoF(m_Matrix->m_e[i]);
4675 }
4676 else {
4677 memset(XYZMatrix, 0, 9*sizeof(icS15Fixed16Number));
4678 XYZMatrix[0] = XYZMatrix[4] = XYZMatrix[8] = icDtoF(1.0);
4679 }
4680
4682 pCurves = m_CurvesM;
4683 }
4684 else {
4685 pCurves = m_CurvesB;
4686 }
4687
4688 if (!pCurves || !m_CurvesA || !m_CLUT)
4689 return false;
4690
4691 nGrid = m_CLUT->GridPoints();
4692
4693 nInputEntries = (icUInt16Number)(((CIccTagCurve*)pCurves[0])->GetSize());
4694 nOutputEntries = (icUInt16Number)(((CIccTagCurve*)m_CurvesA[0])->GetSize());
4695
4696 if (!pIO->Write32(&sig) ||
4697 !pIO->Write32(&m_nReserved) ||
4698 !pIO->Write8(&m_nInput) ||
4699 !pIO->Write8(&m_nOutput) ||
4700 !pIO->Write8(&nGrid) ||
4701 !pIO->Write8(&m_nReservedByte) ||
4702 pIO->Write32(XYZMatrix, 9) != 9)
4703 return false;
4704
4705 //B Curves
4706 for (i=0; i<m_nInput; i++) {
4707 if (pCurves[i]->GetType()!=icSigCurveType)
4708 return false;
4709
4710 pCurve = (CIccTagCurve*)pCurves[i];
4711 if (!pCurve)
4712 return false;
4713
4714 if (pCurve->GetSize()!=256) {
4716
4717 for (j=0; j<256; j++) {
4718 v = pCurve->Apply((icFloat32Number)j / 255.0F);
4719 if (!pIO->WriteUInt8Float(&v, 1))
4720 return false;
4721 }
4722 }
4723 else {
4724 if (pIO->WriteUInt8Float(&(*pCurve)[0], 256)!=256)
4725 return false;
4726 }
4727 }
4728
4729 //CLUT
4730 if (!m_CLUT->WriteData(pIO, 1))
4731 return false;
4732
4733 //A Curves
4734 pCurves = m_CurvesA;
4735
4736 for (i=0; i<m_nOutput; i++) {
4737 if (pCurves[i]->GetType()!=icSigCurveType)
4738 return false;
4739
4740 pCurve = (CIccTagCurve*)pCurves[i];
4741
4742 if (!pCurve)
4743 return false;
4744
4745 if (pCurve->GetSize()!=256) {
4747
4748 for (j=0; j<256; j++) {
4749 v = pCurve->Apply((icFloat32Number)j / 255.0F);
4750 if (!pIO->WriteUInt8Float(&v, 1))
4751 return false;
4752 }
4753 }
4754 else {
4755 if (pIO->WriteUInt8Float(&(*pCurve)[0], 256)!=256)
4756 return false;
4757 }
4758 }
4759 return true;
4760}
bool WriteData(CIccIO *pIO, icUInt8Number nPrecision)
Name: CIccCLUT::WriteData.
icUInt8Number GridPoints() const
Definition IccTagLut.h:349
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:105
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
icInt32Number WriteUInt8Float(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:219
virtual icFloatNumber Apply(icFloatNumber v) const
Name: CIccTagCurve::Apply.
float icFloat32Number
unsigned short icUInt16Number
icInt32Number icS15Fixed16Number
Fixed numbers.

References CIccTagCurve::Apply(), CIccTagCurve::GetSize(), GetType(), CIccCLUT::GridPoints(), icDtoF(), icSigCurveType, CIccMBB::m_bUseMCurvesAsBCurves, CIccMBB::m_CLUT, CIccMBB::m_CurvesA, CIccMBB::m_CurvesB, CIccMBB::m_CurvesM, CIccMatrix::m_e, CIccMBB::m_Matrix, CIccMBB::m_nInput, CIccMBB::m_nOutput, CIccTag::m_nReserved, m_nReservedByte, sig, CIccIO::Write32(), CIccIO::Write8(), CIccCLUT::WriteData(), and CIccIO::WriteUInt8Float().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_nReservedByte

icUInt8Number CIccTagLut8::m_nReservedByte
protected

Definition at line 566 of file IccTagLut.h.

Referenced by CIccTagLut8(), CIccTagLut8(), Read(), and Write().

◆ m_XYZMatrix

icS15Fixed16Number CIccTagLut8::m_XYZMatrix[9]
protected

Definition at line 567 of file IccTagLut.h.

Referenced by CIccTagLut8(), CIccTagLut8(), operator=(), Read(), SetColorSpaces(), and Validate().


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