Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
CCubeWriter Class Reference
+ Inheritance diagram for CCubeWriter:
+ Collaboration diagram for CCubeWriter:

Public Member Functions

virtual bool begin (icColorSpaceSignature srcSpace, icColorSpaceSignature dstSpace)
 
 CCubeWriter ()
 
virtual bool finish ()
 
virtual void iterate (const CIccXform *pXform)
 
virtual void setCmm (CIccCmm *pCmm)
 
virtual bool setFile (const char *szOutputFile)
 
virtual void setInputRange (icFloatNumber fMinInput, icFloatNumber fMaxInput)
 
virtual bool setLutSize (icUInt8Number nGridSize)
 
virtual void setNextNode (icFloatNumber *pPixel)
 
virtual void setOption (int nOptionValue)
 
virtual void setTitle (const char *szTitle)
 
virtual ~CCubeWriter ()
 

Protected Attributes

FILE * m_f = nullptr
 
std::string m_filename
 
icFloatNumber m_fMaxInput = 1.0
 
icFloatNumber m_fMinInput = 0.0
 
int m_grid = 0
 
CIccCmm * m_pCmm = nullptr
 
int m_precision = 4
 
std::string m_title
 

Detailed Description

Definition at line 115 of file iccApplyToLink.cpp.

Constructor & Destructor Documentation

◆ CCubeWriter()

CCubeWriter::CCubeWriter ( )
inline

Definition at line 118 of file iccApplyToLink.cpp.

118{ }

◆ ~CCubeWriter()

virtual CCubeWriter::~CCubeWriter ( )
inlinevirtual

Definition at line 119 of file iccApplyToLink.cpp.

120 {
121 if (m_f)
122 fclose(m_f);
123 }

References m_f.

Member Function Documentation

◆ begin()

virtual bool CCubeWriter::begin ( icColorSpaceSignature srcSpace,
icColorSpaceSignature dstSpace )
inlinevirtual

Implements ILinkWriter.

Definition at line 160 of file iccApplyToLink.cpp.

161 {
162 icUInt32Number nSrcSamples = icGetSpaceSamples(srcSpace);
163 icUInt32Number nDstSamples = icGetSpaceSamples(dstSpace);
164
165 if (nSrcSamples != 3) {
166 printf("# of source Samples is not 3\n");
167 return false;
168 }
169
170 if (nDstSamples != 3) {
171 printf("# of destination samples is not 3\n");
172 return false;
173 }
174
175 m_f = fopen(m_filename.c_str(), "wb");
176 if (!m_f) {
177 printf("Unable to open '%s'\n", m_filename.c_str());
178 return false;
179 }
180
181 fprintf(m_f, "TITLE \"%s\"\n\n", m_title.c_str());
182
183 fprintf(m_f, "# cube file created by iccApplyToLink version " ICCPROFLIBVER "\n#\n");
184 if (m_pCmm) {
185 fprintf(m_f, "# Profiles applied (by profile description):\n");
186 m_pCmm->IterateXforms(this);
187 }
188 fprintf(m_f, "\n");
189
190 fprintf(m_f, "LUT_3D_SIZE %d\n", m_grid);
191
192 if (!icIsNear(m_fMinInput, 0.0f) || !icIsNear(m_fMaxInput, 1.0f)) {
193 char fmt[100];
194 sprintf(fmt, "LUT_3D_INPUT_RANGE %%.%df %%.%df\n", m_precision, m_precision);
195 fprintf(m_f, fmt, m_fMinInput, m_fMaxInput);
196 }
197
198 fprintf(m_f, "\n");
199
200 return true;
201 }
#define ICCPROFLIBVER
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
bool icIsNear(icFloatNumber v1, icFloatNumber v2, icFloatNumber nearRange)
Name: icIsNear.
Definition IccUtil.cpp:142
unsigned int icUInt32Number
icFloatNumber m_fMinInput
std::string m_title
std::string m_filename
icFloatNumber m_fMaxInput

References ICCPROFLIBVER, icGetSpaceSamples(), icIsNear(), m_f, m_filename, m_fMaxInput, m_fMinInput, m_grid, m_pCmm, m_precision, and m_title.

+ Here is the call graph for this function:

◆ finish()

virtual bool CCubeWriter::finish ( )
inlinevirtual

Implements ILinkWriter.

Definition at line 231 of file iccApplyToLink.cpp.

232 {
233 if (m_f)
234 fclose(m_f);
235
236 m_f = nullptr;
237
238 return true;
239 }

References m_f.

◆ iterate()

virtual void CCubeWriter::iterate ( const CIccXform * pXform)
inlinevirtual

Definition at line 203 of file iccApplyToLink.cpp.

204 {
205 if (pXform) {
206 const CIccProfile* pProfile = pXform->GetProfile();
207 if (pProfile) {
208 const CIccTag* pDesc = pProfile->FindTagConst(icSigProfileDescriptionTag);
209 std::string text;
210 if (icGetTagText(pDesc, text)) {
211 fprintf(m_f, "# - %s\n", text.c_str());
212 }
213
214 }
215 }
216 }
bool icGetTagText(const CIccTag *pTag, std::string &text)
Class: CIccTag.
@ icSigProfileDescriptionTag

References icGetTagText(), icSigProfileDescriptionTag, and m_f.

+ Here is the call graph for this function:

◆ setCmm()

virtual void CCubeWriter::setCmm ( CIccCmm * pCmm)
inlinevirtual

Implements ILinkWriter.

Definition at line 142 of file iccApplyToLink.cpp.

143 {
144 m_pCmm = pCmm;
145 }

References m_pCmm.

◆ setFile()

virtual bool CCubeWriter::setFile ( const char * szOutputFile)
inlinevirtual

Implements ILinkWriter.

Definition at line 125 of file iccApplyToLink.cpp.

126 {
127 m_filename = szOutputFile;
128
129 return true;
130 }

References m_filename.

◆ setInputRange()

virtual void CCubeWriter::setInputRange ( icFloatNumber fMinInput,
icFloatNumber fMaxInput )
inlinevirtual

Implements ILinkWriter.

Definition at line 154 of file iccApplyToLink.cpp.

155 {
156 m_fMinInput = fMinInput;
157 m_fMaxInput = fMaxInput;
158 }

References m_fMaxInput, and m_fMinInput.

◆ setLutSize()

virtual bool CCubeWriter::setLutSize ( icUInt8Number nGridSize)
inlinevirtual

Implements ILinkWriter.

Definition at line 147 of file iccApplyToLink.cpp.

148 {
149 m_grid = nGridSize;
150
151 return true;
152 }

References m_grid.

◆ setNextNode()

virtual void CCubeWriter::setNextNode ( icFloatNumber * pPixel)
inlinevirtual

Implements ILinkWriter.

Definition at line 218 of file iccApplyToLink.cpp.

219 {
220 char fmt[30];
221 sprintf(fmt, "%%.%df", m_precision);
222
223 for (int i = 0; i < 3; i++) {
224 if (i)
225 fprintf(m_f, " ");
226 fprintf(m_f, fmt, pPixel[i]);
227 }
228 fprintf(m_f, "\n");
229 }

References m_f, and m_precision.

◆ setOption()

virtual void CCubeWriter::setOption ( int nOptionValue)
inlinevirtual

Implements ILinkWriter.

Definition at line 132 of file iccApplyToLink.cpp.

133 {
134 m_precision = nOptionValue;
135 }

References m_precision.

◆ setTitle()

virtual void CCubeWriter::setTitle ( const char * szTitle)
inlinevirtual

Implements ILinkWriter.

Definition at line 137 of file iccApplyToLink.cpp.

138 {
139 m_title = szTitle;
140 }

References m_title.

Member Data Documentation

◆ m_f

FILE* CCubeWriter::m_f = nullptr
protected

Definition at line 253 of file iccApplyToLink.cpp.

Referenced by begin(), finish(), iterate(), setNextNode(), and ~CCubeWriter().

◆ m_filename

std::string CCubeWriter::m_filename
protected

Definition at line 242 of file iccApplyToLink.cpp.

Referenced by begin(), and setFile().

◆ m_fMaxInput

icFloatNumber CCubeWriter::m_fMaxInput = 1.0
protected

Definition at line 251 of file iccApplyToLink.cpp.

Referenced by begin(), and setInputRange().

◆ m_fMinInput

icFloatNumber CCubeWriter::m_fMinInput = 0.0
protected

Definition at line 250 of file iccApplyToLink.cpp.

Referenced by begin(), and setInputRange().

◆ m_grid

int CCubeWriter::m_grid = 0
protected

Definition at line 248 of file iccApplyToLink.cpp.

Referenced by begin(), and setLutSize().

◆ m_pCmm

CIccCmm* CCubeWriter::m_pCmm = nullptr
protected

Definition at line 246 of file iccApplyToLink.cpp.

Referenced by begin(), and setCmm().

◆ m_precision

int CCubeWriter::m_precision = 4
protected

Definition at line 243 of file iccApplyToLink.cpp.

Referenced by begin(), setNextNode(), and setOption().

◆ m_title

std::string CCubeWriter::m_title
protected

Definition at line 244 of file iccApplyToLink.cpp.

Referenced by begin(), and setTitle().


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