IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
CIccTagCurve Class Reference

#include <IccTagLut.h>

+ Inheritance diagram for CIccTagCurve:
+ Collaboration diagram for CIccTagCurve:

Public Member Functions

 CIccTagCurve (const CIccTagCurve &ITCurve)
 
 CIccTagCurve (int nSize=0)
 
virtual ~CIccTagCurve ()
 
virtual icFloatNumber Apply (icFloatNumber v) const
 
virtual void Begin ()
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
virtual void DumpLut (std::string &sDescription, const icChar *szName, icColorSpaceSignature csSig, int nIndex, int nVerboseness)
 
icFloatNumber Find (icFloatNumber v)
 
virtual const icCharGetClassName () const
 
icFloatNumberGetData (icUInt32Number index)
 
virtual IIccExtensionTagGetExtension ()
 
icUInt32Number GetSize () const
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual icTagTypeSignature GetType () const
 
virtual bool IsArrayType ()
 
virtual bool IsIdentity ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 
virtual CIccTagNewCopy () const
 
CIccTagCurveoperator= (const CIccTagCurve &CurveTag)
 
icFloatNumberoperator[] (icUInt32Number index)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 
virtual bool ReadAll ()
 
bool SetGamma (icFloatNumber gamma)
 
bool SetSize (icUInt32Number nSize, icTagCurveSizeInit nSizeOpt=icInitZero)
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 
virtual bool Write (CIccIO *pIO)
 

Static Public Member Functions

static CIccTagCreate (icTagTypeSignature sig)
 

Data Fields

icUInt32Number m_nReserved
 

Protected Member Functions

icFloatNumber Find (icFloatNumber v, icFloatNumber p0, icFloatNumber v0, icFloatNumber p1, icFloatNumber v1)
 

Protected Attributes

icFloatNumberm_Curve
 
icUInt16Number m_nMaxIndex
 
icUInt32Number m_nSize
 

Detailed Description

Class: CIccTagCurve

Purpose: The curveType tag

Constructor & Destructor Documentation

◆ CIccTagCurve() [1/2]

CIccTagCurve::CIccTagCurve ( int  nSize = 0)

Name: CIccTagCurve::CIccTagCurve

Purpose: Constructor

144{
145 m_nSize = nSize <0 ? 0 : nSize;
146 if (m_nSize>0)
147 m_Curve = (icFloatNumber*)calloc(nSize, sizeof(icFloatNumber));
148 else
149 m_Curve = NULL;
150}
float icFloatNumber
Definition IccDefs.h:101
icUInt32Number m_nSize
Definition IccTagLut.h:159
icFloatNumber * m_Curve
Definition IccTagLut.h:158

References m_Curve, and m_nSize.

Referenced by CDevLinkWriter::begin(), and main().

+ Here is the caller graph for this function:

◆ CIccTagCurve() [2/2]

CIccTagCurve::CIccTagCurve ( const CIccTagCurve ITCurve)

Name: CIccTagCurve::CIccTagCurve

Purpose: Copy Constructor

Args: ITCurve = The CIccTagCurve object to be copied

164{
165 m_nSize = ITCurve.m_nSize;
166 m_nMaxIndex = ITCurve.m_nMaxIndex;
167
168 m_Curve = (icFloatNumber*)calloc(m_nSize, sizeof(icFloatNumber));
169 memcpy(m_Curve, ITCurve.m_Curve, m_nSize*sizeof(icFloatNumber));
170}
icUInt16Number m_nMaxIndex
Definition IccTagLut.h:160

References m_Curve, m_nMaxIndex, and m_nSize.

Referenced by NewCopy().

+ Here is the caller graph for this function:

◆ ~CIccTagCurve()

CIccTagCurve::~CIccTagCurve ( )
virtual

Name: CIccTagCurve::~CIccTagCurve

Purpose: Destructor

209{
210 if (m_Curve)
211 free(m_Curve);
212}

References m_Curve.

Member Function Documentation

◆ Apply()

icFloatNumber CIccTagCurve::Apply ( icFloatNumber  v) const
virtual

Name: CIccTagCurve::Apply

Purpose: Applies the curve to the value passed.

Args: v = value to be passed through the curve.

Return: The value modified by the curve.

Reimplemented from CIccCurve.

569{
570 if(v<0.0) v = 0.0;
571 else if(v>1.0) v = 1.0;
572
574
575 if (!m_nSize) {
576 return v;
577 }
578 if (m_nSize==1) {
579 //Convert 0.0 to 1.0 float to 16bit and then convert from u8Fixed8Number
580 icFloatNumber dGamma = (icFloatNumber)(m_Curve[0] * 65535.0 / 256.0);
581 return (icFloatNumber)pow(v, dGamma);
582 }
583 if (nIndex == m_nMaxIndex) {
584 return m_Curve[nIndex];
585 }
586 else {
587 icFloatNumber nDif = v*m_nMaxIndex - nIndex;
588 icFloatNumber p0 = m_Curve[nIndex];
589
590 icFloatNumber rv = p0 + (m_Curve[nIndex+1]-p0)*nDif;
591 if (rv>1.0)
592 rv=1.0;
593
594 return rv;
595 }
596}
unsigned long icUInt32Number
Definition icProfileHeader.h:262

References m_Curve, m_nMaxIndex, and m_nSize.

Referenced by CIccTagLut8::Write().

+ Here is the caller graph for this function:

◆ Begin()

virtual void CIccTagCurve::Begin ( )
inlinevirtual

Reimplemented from CIccCurve.

unsigned short icUInt16Number
Definition icProfileHeader.h:256

References m_nMaxIndex, and m_nSize.

◆ Create()

CIccTag * CIccTag::Create ( icTagTypeSignature  sig)
staticinherited

Name: CIccTag::Create

Purpose: This is a static tag creator based upon tag signature type

Args: sig = tag type signature

Return: Pointer to Allocated tag

144{
145 return CIccTagCreator::CreateTag(sig);
146}
static CIccTag * CreateTag(icTagTypeSignature tagTypeSig)
Definition IccTagFactory.h:279

References CIccTagCreator::CreateTag().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccTagStruct::LoadElem(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeTintArray::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagLut8::SetColorSpaces(), CIccTagLut16::SetColorSpaces(), and CIccProfileDescText::SetType().

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

◆ Describe()

void CIccTagCurve::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtual

Name: CIccTagCurve::Describe

Purpose: Dump data associated with the tag to a string

Args: sDescription - string to concatenate tag dump to

Reimplemented from CIccTag.

319{
320 icChar buf[128], *ptr;
321
322 if (!m_nSize) {
323 sprintf(buf, "BEGIN_CURVE In_Out\n");
324 sDescription += buf;
325 sDescription += "Y = X\n";
326 }
327 else if (m_nSize==1) {
328 icFloatNumber dGamma = (icFloatNumber)(m_Curve[0] * 256.0);
329 sprintf(buf, "BEGIN_CURVE In_Out\n");
330 sDescription += buf;
331 sprintf(buf, "Y = X ^ %.4lf\n", dGamma);
332 sDescription += buf;
333 }
334 else {
335 int i;
336
337 sprintf(buf, "BEGIN_LUT In_Out 1 1\n");
338 sDescription += buf;
339
340 if (nVerboseness > 75) {
341 sDescription += "IN OUT\n";
342
343 for (i=0; i<(int)m_nSize; i++) {
344 ptr = buf;
345
347 ptr += strlen(buf);
348
349 strcpy(ptr, " ");
350 ptr ++;
351
353
354 ptr += strlen(ptr);
355
356 strcpy(ptr, "\n");
357 sDescription += buf;
358 }
359 }
360 }
361}
@ icSigMCH1Data
Definition icProfileHeader.h:875
char icChar
Definition IccDefs.h:110
ICCPROFLIB_API void icColorValue(icChar *szValue, icFloatNumber nValue, icColorSpaceSignature csSig, int nIndex, bool bUseLegacy=false)
Definition IccUtil.cpp:330

References icColorValue(), icSigMCH1Data, m_Curve, and m_nSize.

+ Here is the call graph for this function:

◆ DetachIO()

virtual void CIccTag::DetachIO ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

183{}

◆ DumpLut()

void CIccTagCurve::DumpLut ( std::string &  sDescription,
const icChar szName,
icColorSpaceSignature  csSig,
int  nIndex,
int  nVerboseness 
)
virtual

Name: CIccTagCurve::DumpLut

Purpose: Dump data associated with the tag to a string. Basically has the same function as Describe()

Args: sDescription = string to concatenate tag dump to, szName = name of the curve to be printed, csSig = color space signature of the LUT data, nIndex = the channel number of color space

Reimplemented from CIccCurve.

380{
381 icChar buf[128], *ptr;
382
383 if (!m_nSize) {
384 sprintf(buf, "BEGIN_CURVE %s\n", szName);
385 sDescription += buf;
386 sDescription += "Y = X\n";
387 }
388 else if (m_nSize==1) {
389 icFloatNumber dGamma = (icFloatNumber)(m_Curve[0] * 256.0);
390 sprintf(buf, "BEGIN_CURVE %s\n", szName);
391 sDescription += buf;
392 sprintf(buf, "Y = X ^ %.4lf\n", dGamma);
393 sDescription += buf;
394 }
395 else {
396 int i;
397
398 sprintf(buf, "BEGIN_LUT %s 1 1\n", szName);
399
400 if (nVerboseness > 75) {
401 sDescription += buf;
402 sDescription += "IN OUT\n";
403
404 sDescription.reserve(sDescription.size() + m_nSize * 20);
405
406 for (i=0; i<(int)m_nSize; i++) {
407 ptr = buf;
408
409 icColorValue(buf, (icFloatNumber)i/(m_nSize-1), csSig, nIndex);
410 ptr += strlen(buf);
411
412 strcpy(ptr, " ");
413 ptr ++;
414
415 icColorValue(ptr, m_Curve[i], csSig, nIndex);
416
417 ptr += strlen(ptr);
418
419 strcpy(ptr, "\n");
420
421 sDescription += buf;
422 }
423 }
424 }
425}

References icColorValue(), m_Curve, and m_nSize.

+ Here is the call graph for this function:

◆ Find() [1/2]

icFloatNumber CIccCurve::Find ( icFloatNumber  v)
inlineinherited
103{ return Find(v, 0, Apply(0), 1.0, Apply(1.0)); }
virtual icFloatNumber Apply(icFloatNumber v) const
Definition IccTagLut.h:101
icFloatNumber Find(icFloatNumber v)
Definition IccTagLut.h:103

References CIccCurve::Apply(), and CIccCurve::Find().

+ Here is the call graph for this function:

◆ Find() [2/2]

icFloatNumber CIccCurve::Find ( icFloatNumber  v,
icFloatNumber  p0,
icFloatNumber  v0,
icFloatNumber  p1,
icFloatNumber  v1 
)
protectedinherited

Name: CIccCurve::Find

Purpose: Read in the tag contents into a data block

Args: v = index to be searched, v0 = index less than/equal to v, p0 = the value at index v0, v1 = index greater than/equal to v, p1 = value at index v1

Return: The value at the requested index

110{
111 if (v<=v0)
112 return p0;
113 if (v>=v1)
114 return p1;
115
116 if (p1-p0 <= 0.00001) {
117 icFloatNumber d0 = (icFloatNumber)fabs(v-v0);
118 icFloatNumber d1 = (icFloatNumber)fabs(v1-v);
119
120 if (d0<d1)
121 return p0;
122 return p1;
123 }
124
125 icFloatNumber np = (icFloatNumber)((p0 + p1)/2.0);
126 icFloatNumber nv = Apply(np);
127
128 if (v<=nv) {
129 return Find(v, p0, v0, np, nv);
130 }
131 return Find(v, np, nv, p1, v1);
132}

References CIccCurve::Apply(), and CIccCurve::Find().

Referenced by CIccCurve::Find(), and CIccCurve::Find().

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

◆ GetClassName()

virtual const icChar * CIccTagCurve::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlCurve.

137{ return "CIccTagCurve"; }

◆ GetData()

icFloatNumber * CIccTagCurve::GetData ( icUInt32Number  index)
inline
147{return &m_Curve[index];}

References m_Curve.

Referenced by CIccTagXmlCurve::ParseXml().

+ Here is the caller graph for this function:

◆ GetExtension()

virtual IIccExtensionTag * CIccTag::GetExtension ( )
inlinevirtualinherited

Reimplemented in CIccTagXmlUnknown, CIccTagXmlText, CIccTagXmlUtf8Text, CIccTagXmlZipUtf8Text, CIccTagXmlZipXml, CIccTagXmlUtf16Text, CIccTagXmlTextDescription, CIccTagXmlSignature, CIccTagXmlNamedColor2, CIccTagXmlXYZ, CIccTagXmlChromaticity, CIccTagXmlCicp, CIccTagXmlSparseMatrixArray, CIccTagXmlFixedNum< T, Tsig >, CIccTagXmlNum< T, A, Tsig >, CIccTagXmlFloatNum< T, A, Tsig >, CIccTagXmlMeasurement, CIccTagXmlMultiLocalizedUnicode, CIccTagXmlTagData, CIccTagXmlDateTime, CIccTagXmlColorantOrder, CIccTagXmlColorantTable, CIccTagXmlViewingConditions, CIccTagXmlSpectralDataInfo, CIccTagXmlSpectralViewingConditions, CIccTagXmlProfileSeqDesc, CIccTagXmlResponseCurveSet16, CIccTagXmlCurve, CIccTagXmlParametricCurve, CIccTagXmlSegmentedCurve, CIccTagXmlLutAtoB, CIccTagXmlLutBtoA, CIccTagXmlLut8, CIccTagXmlLut16, CIccTagXmlMultiProcessElement, CIccTagXmlProfileSequenceId, CIccTagXmlDict, CIccTagXmlStruct, CIccTagXmlArray, CIccTagXmlGamutBoundaryDesc, CIccTagXmlEmbeddedHeightImage, CIccTagXmlEmbeddedNormalImage, and CIccTagXmlEmbeddedProfile.

143{return NULL;}

Referenced by icCurvesFromXml(), icCurvesToXml(), icProfDescToXml(), icXmlParseProfDesc(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeXmlTintArray::ToXml(), CIccTagXmlStruct::ToXml(), CIccTagXmlArray::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ GetSize()

icUInt32Number CIccTagCurve::GetSize ( ) const
inline
148{ return m_nSize; }

References m_nSize.

Referenced by CIccTagLut8::Validate(), CIccTagLut16::Validate(), CIccTagLut8::Write(), and CIccTagLut16::Write().

+ Here is the caller graph for this function:

◆ GetTagArrayType()

virtual icArraySignature CIccTag::GetTagArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagArray.

133{ return icSigUndefinedArray; }
@ icSigUndefinedArray
Definition icProfileHeader.h:617

References icSigUndefinedArray.

Referenced by icGetTagArrayHandlerOfType(), and CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ GetTagStructType()

virtual icStructSignature CIccTag::GetTagStructType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagStruct.

132{ return icSigUndefinedStruct; }
@ icSigUndefinedStruct
Definition icProfileHeader.h:606

References icSigUndefinedStruct.

Referenced by icGetTagStructHandlerOfType(), CIccArrayColorantInfo::Validate(), and CIccArrayNamedColor::Validate().

+ Here is the caller graph for this function:

◆ GetType()

virtual icTagTypeSignature CIccTagCurve::GetType ( ) const
inlinevirtual

Function: GetType()

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

Reimplemented from CIccTag.

136{ return icSigCurveType; }
@ icSigCurveType
Definition icProfileHeader.h:533

References icSigCurveType.

Referenced by Write().

+ Here is the caller graph for this function:

◆ IsArrayType()

virtual bool CIccTag::IsArrayType ( )
inlinevirtualinherited

Reimplemented in CIccTagXYZ, CIccTagChromaticity, CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, CIccTagFloatNum< T, Tsig >, and CIccTagData.

135{ return false; }

Referenced by MyTagDialog::MyTagDialog(), and DumpTag().

+ Here is the caller graph for this function:

◆ IsIdentity()

bool CIccTagCurve::IsIdentity ( )
virtual

Name: CIccTagCurve::IsIdentity

Purpose: Checks if this is an identity curve.

Return: true if the curve is an identity

Reimplemented from CIccCurve.

536{
537 if (!m_nSize) {
538 return true;
539 }
540
541 if (m_nSize==1) {
542 return IsUnity(icFloatNumber(m_Curve[0]*65535.0/256.0));
543 }
544
546 for (i=0; i<m_nSize; i++) {
548 return false;
549 }
550 }
551
552 return true;
553}
static bool IsUnity(const icFloatNumber &num)
Definition IccTagLut.cpp:520
const icFloatNumber VERYSMALLNUM
Definition IccTagLut.cpp:519

References IsUnity(), m_Curve, m_nMaxIndex, m_nSize, and VERYSMALLNUM.

Referenced by CIccTagXmlCurve::ToXml().

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

◆ IsMBBType()

virtual bool CIccTag::IsMBBType ( )
inlinevirtualinherited

Reimplemented in CIccMBB.

136{ return false; } //If true then CIccTag can be cast as an CIccMBB

Referenced by CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ IsNumArrayType()

virtual bool CIccTag::IsNumArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, and CIccTagFloatNum< T, Tsig >.

137{ return false;} //If true then CIccTag can be cast as a CIccTagNumArray

Referenced by CIccArrayNamedColor::FindDeviceColor(), CIccArrayNamedColor::FindPcsColor(), CIccArrayNamedColor::FindSpectralColor(), CIccTagStruct::GetElemNumberValue(), CIccStructNamedColor::GetNumArray(), CIccMpeXmlTintArray::ParseXml(), and CIccMpeTintArray::Read().

+ Here is the caller graph for this function:

◆ IsSupported()

virtual bool CIccTag::IsSupported ( )
inlinevirtualinherited

Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes. By Default inherited classes are supported. Unknown tag types are not supported.

Returns true if tag type is supported.

Reimplemented in CIccTagUnknown, CIccTagEmbeddedProfile, and CIccTagMultiProcessElement.

153{ return true; }

◆ NewCopy()

virtual CIccTag * CIccTagCurve::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 CIccCurve.

133{ return new CIccTagCurve(*this);}
Definition IccTagLut.h:128

References CIccTagCurve().

+ Here is the call graph for this function:

◆ operator=()

CIccTagCurve & CIccTagCurve::operator= ( const CIccTagCurve CurveTag)

Name: CIccTagCurve::operator=

Purpose: Copy Operator

Args: CurveTag = The CIccTagCurve object to be copied

184{
185 if (&CurveTag == this)
186 return *this;
187
188 m_nSize = CurveTag.m_nSize;
189 m_nMaxIndex = CurveTag.m_nMaxIndex;
190
191 if (m_Curve)
192 free(m_Curve);
193 m_Curve = (icFloatNumber*)calloc(m_nSize, sizeof(icFloatNumber));
194 memcpy(m_Curve, CurveTag.m_Curve, m_nSize*sizeof(icFloatNumber));
195
196 return *this;
197}

References m_Curve, m_nMaxIndex, and m_nSize.

◆ operator[]()

icFloatNumber & CIccTagCurve::operator[] ( icUInt32Number  index)
inline
146{return m_Curve[index];}

References m_Curve.

Referenced by main(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagLut8::Write(), and CIccTagLut16::Write().

+ Here is the caller graph for this function:

◆ Read() [1/2]

bool CIccTagCurve::Read ( icUInt32Number  size,
CIccIO pIO 
)
virtual

Name: CIccTagCurve::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.

230{
232
233 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
234 sizeof(icUInt32Number) +
235 sizeof(icUInt32Number);
236 if (headerSize > size)
237 return false;
238
239 if (!pIO) {
240 return false;
241 }
242
243 if (!pIO->Read32(&sig))
244 return false;
245
246 if (!pIO->Read32(&m_nReserved))
247 return false;
248
249 icUInt32Number nSize;
250
251 if (!pIO->Read32(&nSize))
252 return false;
253
254 if (headerSize + (icUInt64Number)nSize * sizeof(icUInt16Number) > size)
255 return false;
256
257 if (!SetSize(nSize, icInitNone))
258 return false;
259
260 if (m_nSize) {
262 return false;
263 }
264
265 return true;
266}
long icInt32Number
Definition icProfileHeader.h:291
icTagTypeSignature
Definition icProfileHeader.h:526
icUInt32Number icUInt64Number[2]
Definition icProfileHeader.h:268
@ icInitNone
Definition IccTagLut.h:115
icInt32Number ReadUInt16Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:236
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
Definition IccTagBasic.h:235
bool SetSize(icUInt32Number nSize, icTagCurveSizeInit nSizeOpt=icInitZero)
Definition IccTagLut.cpp:439

References icInitNone, m_Curve, CIccTag::m_nReserved, m_nSize, CIccIO::Read32(), CIccIO::ReadUInt16Float(), and SetSize().

+ Here is the call graph for this function:

◆ Read() [2/2]

virtual bool CIccTag::Read ( icUInt32Number  size,
CIccIO pIO,
CIccProfile pProfile 
)
inlinevirtualinherited

Function: Read(size, pIO) - Read tag from file. Each derived tag will implement it's own Read() function.

Parameter(s): size - number of bytes in tag including the type signature. pIO - IO object used to read in tag. The IO object should already be initialized to point to the begining of the tag.

Returns true if Read is successful.

Reimplemented in CIccTagEmbeddedProfile.

197{ return Read(size, pIO); }
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagBasic.h:167

References CIccTag::Read().

+ Here is the call graph for this function:

◆ ReadAll()

virtual bool CIccTag::ReadAll ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

Reimplemented in CIccTagEmbeddedProfile.

175{ return true; }

◆ SetGamma()

bool CIccTagCurve::SetGamma ( icFloatNumber  gamma)

Name: refIccMAX::CIccTagCurve::SetGamma

Purpose: Set the curve with a single gamma value.

Args: gamma - gamma value to use

503{
504 if (!SetSize(1, icInitNone))
505 return false;
506
507 icInt16Number whole = (icInt16Number)gamma;
508 icFloatNumber frac = gamma - (icFloatNumber)whole;
509
510 m_Curve[0] = (icFloatNumber)((whole * 256) + (frac*256.0)) / (icFloatNumber)65535.0;
511 return true;
512}
short icInt16Number
Definition icProfileHeader.h:285

References icInitNone, m_Curve, and SetSize().

+ Here is the call graph for this function:

◆ SetSize()

bool CIccTagCurve::SetSize ( icUInt32Number  nSize,
icTagCurveSizeInit  nSizeOpt = icInitZero 
)

Name: CIccTagCurve::SetSize

Purpose: Sets the size of the curve array.

Args: nSize - number of entries in the curve, nSizeOpt - flag to zero newly formed values

440{
441 if (nSize==m_nSize)
442 return true;
443
444 if (!nSize && m_Curve) {
445 free(m_Curve);
446 m_Curve = NULL;
447 }
448 else {
449 if (!m_Curve)
450 m_Curve = (icFloatNumber*)malloc(nSize*sizeof(icFloatNumber));
451 else
453
454 if (!m_Curve) {
455 m_nSize = 0;
456 return false;
457 }
458
459 switch (nSizeOpt) {
460 case icInitNone:
461 default:
462 break;
463
464 case icInitZero:
465 if (m_nSize < nSize) {
466 memset(&m_Curve[m_nSize], 0, (nSize-m_nSize)*sizeof(icFloatNumber));
467 }
468 break;
469
470 case icInitIdentity:
471 if (nSize>1) {
473 icFloatNumber last = (icFloatNumber)(nSize-1);
474
475 for (i=0; i<nSize; i++) {
476 m_Curve[i] = (icFloatNumber)i/last;
477 }
478 }
479 else if (nSize==1) {
480 //Encode a gamma 1.0 u8Fixed8Number converted to 16 bit as a 0.0 to 1.0 float
481 m_Curve[0] = (icFloatNumber)(0x0100) / (icFloatNumber)65535.0;
482 }
483 break;
484 }
485 }
486 m_nSize = nSize;
487 m_nMaxIndex = (icUInt16Number)(nSize - 1);
488
489 return true;
490}
@ icInitZero
Definition IccTagLut.h:116
@ icInitIdentity
Definition IccTagLut.h:117
ICCPROFLIB_API void * icRealloc(void *ptr, size_t size)
Definition IccUtil.cpp:111

References icInitIdentity, icInitNone, icInitZero, icRealloc(), m_Curve, m_nMaxIndex, and m_nSize.

Referenced by CIccTagXmlCurve::ParseXml(), Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagLut8::SetColorSpaces(), CIccTagLut16::SetColorSpaces(), and SetGamma().

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

◆ Validate()

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

Name: CIccTagCurve::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 CIccTag.

614{
615 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
616
617 CIccInfo Info;
618 std::string sSigPathName = Info.GetSigPathName(sigPath);
619 icSignature sig = icGetFirstSigPathSig(sigPath);
620
621 if (sig==icSigBlueTRCTag || sig==icSigRedTRCTag || sig==icSigGreenTRCTag || sig==icSigGrayTRCTag) {
622 if (m_nSize>1) {
623 if (m_Curve) {
624 if (m_Curve[0]>0.0 || m_Curve[m_nSize-1]<1.0) {
625 sReport += icMsgValidateWarning;
626 sReport += sSigPathName;
627 sReport += " - Curve cannot be accurately inverted.\n";
629 }
630 }
631 }
632 }
633
634 return rv;
635}
icUInt32Number icSignature
Definition icProfileHeader.h:271
@ icSigGrayTRCTag
Definition icProfileHeader.h:421
@ icSigGreenTRCTag
Definition icProfileHeader.h:424
@ icSigRedTRCTag
Definition icProfileHeader.h:463
@ icSigBlueTRCTag
Definition icProfileHeader.h:349
icValidateStatus
Definition IccDefs.h:119
@ icValidateWarning
Definition IccDefs.h:121
ICCPROFLIB_API icSignature icGetFirstSigPathSig(std::string sigPath)
Definition IccUtil.cpp:1201
ICCPROFLIB_API const char * icMsgValidateWarning
Definition IccUtil.cpp:90
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
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) const
Definition IccTagBasic.cpp:164

References CIccInfo::GetSigPathName(), icGetFirstSigPathSig(), icMaxStatus(), icMsgValidateWarning, icSigBlueTRCTag, icSigGrayTRCTag, icSigGreenTRCTag, icSigRedTRCTag, icValidateWarning, m_Curve, m_nSize, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagCurve::Write ( CIccIO pIO)
virtual

Name: CIccTagCurve::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.

283{
285
286 if (!pIO)
287 return false;
288
289 if (!pIO->Write32(&sig))
290 return false;
291
292 if (!pIO->Write32(&m_nReserved))
293 return false;
294
295 if (!pIO->Write32(&m_nSize))
296 return false;
297
298 if (m_nSize)
300 return false;
301
302 pIO->Align32();
303
304 return true;
305}
bool Align32()
Write operation to make sure that filelength is evenly divisible by 4.
Definition IccIO.cpp:341
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
icInt32Number WriteUInt16Float(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:252
virtual icTagTypeSignature GetType() const
Definition IccTagLut.h:136

References CIccIO::Align32(), GetType(), m_Curve, CIccTag::m_nReserved, m_nSize, CIccIO::Write32(), and CIccIO::WriteUInt16Float().

+ Here is the call graph for this function:

Field Documentation

◆ m_Curve

◆ m_nMaxIndex

icUInt16Number CIccTagCurve::m_nMaxIndex
protected

◆ m_nReserved

icUInt32Number CIccTag::m_nReserved
inherited

Referenced by CIccTag::CIccTag(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::operator=(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagText::Read(), CIccTagUtf8Text::Read(), CIccTagZipUtf8Text::Read(), CIccTagUtf16Text::Read(), CIccTagTextDescription::Read(), CIccTagSignature::Read(), CIccTagNamedColor2::Read(), CIccTagXYZ::Read(), CIccTagChromaticity::Read(), CIccTagCicp::Read(), CIccTagSparseMatrixArray::Read(), CIccTagFixedNum< T, Tsig >::Read(), CIccTagNum< T, Tsig >::Read(), CIccTagFloatNum< T, Tsig >::Read(), CIccTagMeasurement::Read(), CIccTagMultiLocalizedUnicode::Read(), CIccTagData::Read(), CIccTagDateTime::Read(), CIccTagColorantOrder::Read(), CIccTagColorantTable::Read(), CIccTagViewingConditions::Read(), CIccTagProfileSeqDesc::Read(), CIccTagResponseCurveSet16::Read(), CIccTagSpectralDataInfo::Read(), CIccTagSpectralViewingConditions::Read(), CIccTagEmbeddedHeightImage::Read(), CIccTagEmbeddedNormalImage::Read(), CIccTagStruct::Read(), CIccTagArray::Read(), CIccTagDict::Read(), Read(), CIccTagParametricCurve::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagGamutBoundaryDesc::Read(), CIccTagMultiProcessElement::Read(), CIccTagProfileSequenceId::Read(), CIccTagEmbeddedProfile::Read(), CIccTag::Validate(), CIccTagText::Write(), CIccTagUtf8Text::Write(), CIccTagZipUtf8Text::Write(), CIccTagUtf16Text::Write(), CIccTagTextDescription::Write(), CIccTagSignature::Write(), CIccTagNamedColor2::Write(), CIccTagXYZ::Write(), CIccTagChromaticity::Write(), CIccTagCicp::Write(), CIccTagSparseMatrixArray::Write(), CIccTagFixedNum< T, Tsig >::Write(), CIccTagNum< T, Tsig >::Write(), CIccTagFloatNum< T, Tsig >::Write(), CIccTagMeasurement::Write(), CIccTagMultiLocalizedUnicode::Write(), CIccTagData::Write(), CIccTagDateTime::Write(), CIccTagColorantOrder::Write(), CIccTagColorantTable::Write(), CIccTagViewingConditions::Write(), CIccTagProfileSeqDesc::Write(), CIccTagResponseCurveSet16::Write(), CIccTagSpectralDataInfo::Write(), CIccTagSpectralViewingConditions::Write(), CIccTagEmbeddedHeightImage::Write(), CIccTagEmbeddedNormalImage::Write(), CIccTagStruct::Write(), CIccTagArray::Write(), CIccTagDict::Write(), CIccTagEmbeddedProfile::Write(), Write(), CIccTagParametricCurve::Write(), CIccTagLutAtoB::Write(), CIccTagLut8::Write(), CIccTagLut16::Write(), CIccTagGamutBoundaryDesc::Write(), CIccTagMultiProcessElement::Write(), and CIccTagProfileSequenceId::Write().

◆ m_nSize


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