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

#include <IccTagLut.h>

Public Member Functions

 CIccMatrix (bool bUseConstants=true)
 
 CIccMatrix (const CIccMatrix &MatrixClass)
 
virtual ~CIccMatrix ()
 
virtual void Apply (icFloatNumber *Pixel) const
 
void DumpLut (std::string &sDescription, const icChar *szName, int nVerboseness)
 
virtual bool IsIdentity ()
 
CIccMatrixoperator= (const CIccMatrix &MatrixClass)
 
icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 

Data Fields

bool m_bUseConstants
 
icFloatNumber m_e [12]
 

Detailed Description

Class: CIccMatrix

Purpose: The base matrix class

Constructor & Destructor Documentation

◆ CIccMatrix() [1/2]

CIccMatrix::CIccMatrix ( bool  bUseConstants = true)

Name: CIccMatrix::CIccMatrix

Purpose: Constructor

Args: bUseConstants = true if the matrix contains additional row for constants

1407{
1408 m_bUseConstants = bUseConstants;
1409 m_e[0] = m_e[4] = m_e[8] = 1.0;
1410 m_e[1] = m_e[2] = m_e[3] =
1411 m_e[5] = m_e[6] = m_e[7] = 0.0;
1412
1413 if (!m_bUseConstants) {
1414 m_e[9] = m_e[10] = m_e[11] = 0.0;
1415 }
1416}
icFloatNumber m_e[12]
Definition IccTagLut.h:269
bool m_bUseConstants
Definition IccTagLut.h:270

References m_bUseConstants, and m_e.

Referenced by CIccTagLutAtoB::Read().

+ Here is the caller graph for this function:

◆ CIccMatrix() [2/2]

CIccMatrix::CIccMatrix ( const CIccMatrix MatrixClass)

Name: CIccMatrix::CIccMatrix

Purpose: Copy Constructor

Args: MatrixClass = The CIccMatrix object to be copied

1430{
1431 m_bUseConstants = MatrixClass.m_bUseConstants;
1432 memcpy(m_e, MatrixClass.m_e, sizeof(m_e));
1433}

References m_bUseConstants, and m_e.

Referenced by CIccMBB::CIccMBB(), and CIccMBB::operator=().

+ Here is the caller graph for this function:

◆ ~CIccMatrix()

virtual CIccMatrix::~CIccMatrix ( )
inlinevirtual
265{}

Member Function Documentation

◆ Apply()

void CIccMatrix::Apply ( icFloatNumber Pixel) const
virtual

Name: CIccMatrix::Apply

Purpose: Multiplies the pixel by the matrix.

Args: Pixel = Pixel to be multiplied by the matrix

1544{
1545 icFloatNumber a=Pixel[0];
1546 icFloatNumber b=Pixel[1];
1547 icFloatNumber c=Pixel[2];
1548
1549 icFloatNumber x = m_e[0]*a + m_e[1]*b + m_e[2]*c;
1550 icFloatNumber y = m_e[3]*a + m_e[4]*b + m_e[5]*c;
1551 icFloatNumber z = m_e[6]*a + m_e[7]*b + m_e[8]*c;
1552
1553 if (m_bUseConstants) {
1554 x += m_e[9];
1555 y += m_e[10];
1556 z += m_e[11];
1557 }
1558
1559 Pixel[0] = x;
1560 Pixel[1] = y;
1561 Pixel[2] = z;
1562}
float icFloatNumber
Definition IccDefs.h:101

References m_bUseConstants, and m_e.

◆ DumpLut()

void CIccMatrix::DumpLut ( std::string &  sDescription,
const icChar szName,
int  nVerboseness 
)

Name: CIccTagParametricCurve::DumpLut

Purpose: Dump the matrix data to a string.

Args: sDescription = string to concatenate tag dump to, szName = name of the curve to be printed

1470{
1471 icChar buf[128];
1472
1473 sprintf(buf, "BEGIN_MATRIX %s\n", szName);
1474 sDescription += buf;
1475
1476 if (!m_bUseConstants) {
1477 sprintf(buf, "%8.4lf %8.4lf %8.4lf\n",
1478 m_e[0], m_e[1], m_e[2]);
1479 sDescription += buf;
1480 sprintf(buf, "%8.4lf %8.4lf %8.4lf\n",
1481 m_e[3], m_e[4], m_e[5]);
1482 sDescription += buf;
1483 sprintf(buf, "%8.4lf %8.4lf %8.4lf\n",
1484 m_e[6], m_e[7], m_e[8]);
1485 sDescription += buf;
1486 }
1487 else {
1488 sprintf(buf, "%8.4lf %8.4lf %8.4lf + %8.4lf\n",
1489 m_e[0], m_e[1], m_e[2], m_e[9]);
1490 sDescription += buf;
1491 sprintf(buf, "%8.4lf %8.4lf %8.4lf + %8.4lf\n",
1492 m_e[3], m_e[4], m_e[5], m_e[10]);
1493 sDescription += buf;
1494 sprintf(buf, "%8.4lf %8.4lf %8.4lf + %8.4lf\n",
1495 m_e[6], m_e[7], m_e[8], m_e[11]);
1496 sDescription += buf;
1497 }
1498}
char icChar
Definition IccDefs.h:110

References m_bUseConstants, and m_e.

Referenced by CIccMBB::Describe().

+ Here is the caller graph for this function:

◆ IsIdentity()

bool CIccMatrix::IsIdentity ( )
virtual

Name: CIccMatrix::IsIdentity

Purpose: Checks if the matrix is identity

Return: true if matrix is identity and uses no constants, else false

1512{
1513 if (m_bUseConstants) {
1514 if (fabs(m_e[9])>0.0 || fabs(m_e[10])>0.0 || fabs(m_e[11])>0.0) {
1515 return false;
1516 }
1517 }
1518
1519 if (!IsUnity(m_e[0]) || !IsUnity(m_e[4]) || !IsUnity(m_e[8])) {
1520 return false;
1521 }
1522
1523 if (fabs(m_e[1])>0.0 || fabs(m_e[2])>0.0 || fabs(m_e[3])>0.0 ||
1524 fabs(m_e[5])>0.0 || fabs(m_e[6])>0.0 || fabs(m_e[7])>0.0)
1525 {
1526 return false;
1527 }
1528
1529 return true;
1530}
static bool IsUnity(const icFloatNumber &num)
Definition IccTagLut.cpp:520

References IsUnity(), m_bUseConstants, and m_e.

+ Here is the call graph for this function:

◆ operator=()

CIccMatrix & CIccMatrix::operator= ( const CIccMatrix MatrixClass)

Name: CIccMatrix::operator=

Purpose: Copy Operator

Args: MatrixClass = The CIccMatrix object to be copied

1447{
1448 if (&MatrixClass == this)
1449 return *this;
1450
1451 m_bUseConstants = MatrixClass.m_bUseConstants;
1452 memcpy(m_e, MatrixClass.m_e, sizeof(m_e));
1453
1454 return *this;
1455}

References m_bUseConstants, and m_e.

◆ Validate()

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

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

1580{
1582 icSignature sig = icGetFirstSigPathSig(sigPath);
1583
1584 if (sig==icSigLut8Type || sig==icSigLut16Type) {
1585 if (pProfile->m_Header.pcs!=icSigXYZData) {
1586 CIccInfo Info;
1587 std::string sSigPathName = Info.GetSigPathName(sigPath);
1588 icFloatNumber sum=0.0;
1589 for (int i=0; i<9; i++) {
1590 sum += m_e[i];
1591 }
1592 if (m_e[0]!=1.0 || m_e[4]!=1.0 || m_e[9]!=1.0 || sum!=3.0) {
1593 sReport += icMsgValidateNonCompliant;
1594 sReport += sSigPathName;
1595 sReport += " - Matrix must be identity.\n";
1597 }
1598 }
1599 }
1600
1601 return rv;
1602}
@ icSigXYZData
Definition icProfileHeader.h:846
icUInt32Number icSignature
Definition icProfileHeader.h:271
@ icSigLut8Type
Definition icProfileHeader.h:545
@ icSigLut16Type
Definition icProfileHeader.h:544
icValidateStatus
Definition IccDefs.h:119
@ icValidateOK
Definition IccDefs.h:120
@ icValidateNonCompliant
Definition IccDefs.h:122
ICCPROFLIB_API icSignature icGetFirstSigPathSig(std::string sigPath)
Definition IccUtil.cpp:1201
ICCPROFLIB_API const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614

References CIccInfo::GetSigPathName(), icGetFirstSigPathSig(), icMsgValidateNonCompliant, icSigLut16Type, icSigLut8Type, icSigXYZData, icValidateNonCompliant, icValidateOK, m_e, and icHeader::pcs.

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

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

Field Documentation

◆ m_bUseConstants

◆ m_e


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