143{
144 newIcc = NULL;
145
148
151
154 }
155
156 if (!pMediaWhitePt)
157 pMediaWhitePt = pWhitePt;
158
159 if (!pMediaWhitePt || pMediaWhitePt->
GetNumValues()<2) {
161 }
162
163 CIccProfile *pIcc = new CIccProfile;
164 pIcc->m_Header = *pHeader;
165
166 struct tm *newtime;
167 time_t long_time;
168
169 time( &long_time );
170 newtime = gmtime( &long_time );
171
172 pIcc->m_Header.date.year = newtime->tm_year+1900;
173 pIcc->m_Header.date.month = newtime->tm_mon+1;
174 pIcc->m_Header.date.day = newtime->tm_mday;
175 pIcc->m_Header.date.hours = newtime->tm_hour;
176 pIcc->m_Header.date.minutes = newtime->tm_min;
177 pIcc->m_Header.date.seconds = newtime->tm_sec;
178
179 float XYZWhite[3];
181
184 pIcc->m_Header.illuminant.X =
icDtoF(XYZWhite[0]);
185 pIcc->m_Header.illuminant.Y =
icDtoF(XYZWhite[1]);
186 pIcc->m_Header.illuminant.Z =
icDtoF(XYZWhite[2]);
187
188
190 float XYZMedia[3];
194
195 (*pXYZ)[0].X =
icDtoF(XYZMedia[0]);
196 (*pXYZ)[0].Y =
icDtoF(XYZMedia[1]);
197 (*pXYZ)[0].Z =
icDtoF(XYZMedia[2]);
199
200
202 if (!pMpeTag) {
203 delete pIcc;
205 }
206
208
212 bool bHaveLumMtx = false;
213 if (pLumMtx) {
215 delete pMpeTag;
216 delete pIcc;
218 }
220 if (!pMtx) {
221 delete pMpeTag;
222 delete pIcc;
224 }
227
231 delete pLumMtx;
232 bHaveLumMtx = true;
233 }
234
236 if (pSegCurve && pSegCurve->
GetCurve()) {
239 if (!pCurves) {
240 delete pMpeTag;
241 delete pIcc;
243 }
249 }
251 if (!pMtx) {
252 delete pMpeTag;
253 delete pIcc;
255 }
256
259 delete pMtx;
260 delete pMpeTag;
261 delete pIcc;
263 }
265
267 if (!pxy || pxy->
GetSize()<2) {
268 delete pMpeTag;
269 delete pIcc;
271 }
272 mtx[0]=(*pxy)[0] * XYZMedia[0];
273 mtx[3]=(*pxy)[1] * XYZMedia[1];
274 mtx[6]=(1.0f - (*pxy)[0] - (*pxy)[1]) * XYZMedia[2];
275
277 if (!pxy || pxy->
GetSize()<2) {
278 delete pMpeTag;
279 delete pIcc;
281 }
282 mtx[1]=(*pxy)[0] * XYZMedia[0];
283 mtx[4]=(*pxy)[1] * XYZMedia[1];
284 mtx[7]=(1.0f - (*pxy)[0] - (*pxy)[1]) * XYZMedia[2];
285
287 if (!pxy || pxy->
GetSize()<2) {
288 delete pMpeTag;
289 delete pIcc;
291 }
292 mtx[2]=(*pxy)[0] * XYZMedia[0];
293 mtx[5]=(*pxy)[1] * XYZMedia[1];
294 mtx[8]=(1.0f - (*pxy)[0] - (*pxy)[1]) * XYZMedia[2];
295
298
300
302 delete pMtx2;
303 delete pIcc;
305 }
306
307
309 if (!pMpeTag) {
310 delete pMtx2;
311 delete pIcc;
313 }
314
316
318
320 if (pSegCurve && pSegCurve->
GetCurve()) {
323 if (!pCurves || !pCurves->
SetSize(3)) {
324 delete pMpeTag;
325 delete pIcc;
327 }
332 }
333
334 if (bHaveLumMtx) {
336 delete pMpeTag;
337 delete pIcc;
339 }
340
342 if (!pMtx) {
343 delete pMpeTag;
344 delete pIcc;
346 }
348 }
350
351
355
356
358 if (!pCond) {
359 delete pIcc;
361 }
362
366
370
373 if (pSurround && pSurround->
GetSize()>=2) {
379 }
380 else {
384 }
385
387
390 if (!pCstmConvert) {
391 delete pIcc;
393 }
397
399
400 if (SWr>0.2) {
404 }
405 else if (SWr>0.0) {
409 }
410 else {
414 }
415
417 if (!pCstmConvert2) {
418 delete pCstmConvert;
419 delete pIcc;
421 }
422 *pCstmConvert2 = *pCstmConvert;
423
424
426 if (!pStdConvert) {
427 delete pCstmConvert;
428 delete pCstmConvert2;
429 delete pIcc;
431 }
433 if (!pStdConvert2) {
434 delete pCstmConvert;
435 delete pCstmConvert2;
436 delete pStdConvert;
437 delete pIcc;
439 }
440
443 if (!pMpeTag) {
444 delete pCstmConvert;
445 delete pStdConvert;
446 delete pCstmConvert2;
447 delete pStdConvert2;
448 delete pIcc;
450 }
452
454 if (!pCam) {
455 delete pCstmConvert;
456 delete pStdConvert;
457 delete pCstmConvert2;
458 delete pStdConvert2;
459 delete pIcc;
461 }
462 pCam->
SetCAM(pCstmConvert);
464
466 if (!pCam) {
467 delete pStdConvert;
468 delete pCstmConvert2;
469 delete pStdConvert2;
470 delete pIcc;
472 }
473 pCam->
SetCAM(pStdConvert);
476
478 if (!pMpeTag) {
479 delete pIcc;
481 }
483
485 if (!pCam) {
486 delete pCstmConvert2;
487 delete pStdConvert2;
488 delete pIcc;
490 }
491 pCam->
SetCAM(pStdConvert2);
493
495 if (!pCam) {
496 delete pCstmConvert2;
497 delete pIcc;
499 }
500 pCam->
SetCAM(pCstmConvert2);
503 }
504
505#if 1 && defined(_DEBUG)
507#endif
508
509 newIcc = pIcc;
511}
icFloatNumber icD50XYZ[3]
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
static void icYxy2XYZVector(icFloatNumber *XYZ, icFloatNumber Y, icFloatNumber *xy, icUInt8Number idxOffset=1)
@ icEncConvertMemoryError
bool SaveIccProfile(const icChar *szFilename, CIccProfile *pIcc, icProfileIDSaveMethod nWriteId)
Name: SaveIccProfile.
bool icMatrixInvert3x3(icFloatNumber *M)
Name: icMatrixInvert3x3.
icS15Fixed16Number icDtoF(icFloatNumber num)
void SetParameter_Nc(icFloatNumber Nc)
void SetParameter_La(icFloatNumber La)
void SetParameter_F(icFloatNumber F)
void SetParameter_C(icFloatNumber c)
void SetParameter_Yb(icFloatNumber YB)
void SetParameter_WhitePoint(icFloatNumber *whitePoint)
void SetCAM(CIccCamConverter *pCAM)
bool SetSize(int nNewSize)
Name: CIccMpeCurveSet::SetSize.
bool SetCurve(int nIndex, icCurveSetCurvePtr newCurve)
Name: CIccMpeCurveSet::SetCurve.
icFloatNumber * GetMatrix() const
bool SetSize(icUInt16Number nInputChannels, icUInt16Number nOutputChannels, bool bUseConstants=true)
Name: CIccMpeMatrix::SetSize.
virtual CIccMultiProcessElement * NewCopy() const
static CIccMultiProcessElement * Create(icElemTypeSignature sig)
Name: CIccMultiProcessElement::Create.
Class: CIccSegmentedCurve.
virtual CIccCurveSetCurve * NewCopy() const
virtual bool GetValues(icFloatNumber *DstVector, icUInt32Number nStart=0, icUInt32Number nVectorSize=1) const
Name: CIccTagFloatNum::GetValues.
virtual icUInt32Number GetNumValues() const
icUInt32Number GetSize() const
Returns the size of the data array.
static CIccTag * Create(icTagTypeSignature sig)
Name: CIccTag::Create.
Class: CIccTagMultiProcessElement.
virtual void Attach(CIccMultiProcessElement *pElement)
Name: CIccTagMultiProcessElement::Attach.
void SetChannels(icUInt16Number nInputChannels, icUInt16Number nOutputChannels)
Class: CIccTagSegmentedCurve.
CIccSegmentedCurve * GetCurve()
Class: CIccTagSpectralViewingConditions.
icFloatXYZNumber m_surroundXYZ
icFloatXYZNumber m_illuminantXYZ
bool setIlluminant(icIlluminant illumId, const icSpectralRange &illumRange, const icFloatNumber *illum, icFloatNumber illumCCT=0.0f)
CIccTag * FindElemOfType(icSignature sig, icTagTypeSignature sigType)
Name: CIccTagStruct::FindElemOfType.
icFloatNumber GetElemNumberValue(icSignature sig, icFloatNumber defaultValue=0)
Name: CIccTagStruct::GetElemNumberValue.
virtual icStructSignature GetTagStructType() const
bool SetSize(icUInt32Number nSize, bool bZeroNew=true)
Name: CIccTagXYZ::SetSize.