Back to index

scribus-ng  1.3.4.dfsg+svn20071115
cmsutil.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "cmsutil.h"
00008 #include <qstring.h>
00009 
00010 cmsHTRANSFORM scCmsCreateTransform(cmsHPROFILE Input, DWORD InputFormat,
00011                                 cmsHPROFILE Output,DWORD OutputFormat,
00012                                 int Intent, DWORD dwFlags)
00013 {
00014        cmsHTRANSFORM hTransform = NULL;
00015        if ( Input == NULL || Output == NULL)
00016               return NULL;
00017        dwFlags &= (~cmsFLAGS_GAMUTCHECK);
00018        dwFlags &= (~cmsFLAGS_SOFTPROOFING);
00019        QString desc1 = cmsTakeProductDesc(Input);
00020        QString desc2 = cmsTakeProductDesc(Output);
00021        if ( desc1 == desc2 )
00022               dwFlags |= cmsFLAGS_NULLTRANSFORM;
00023        hTransform = cmsCreateTransform(Input, InputFormat, Output, OutputFormat, Intent, dwFlags);
00024        return hTransform;
00025 }
00026 
00027 cmsHTRANSFORM scCmsCreateProofingTransform(cmsHPROFILE Input, DWORD InputFormat,
00028                                                         cmsHPROFILE Output,DWORD OutputFormat,
00029                                                         cmsHPROFILE Proofing, int Intent, 
00030                                                         int ProofingIntent, DWORD dwFlags)
00031 {
00032        cmsHTRANSFORM hTransform = NULL;
00033        if ( Input == NULL || Output == NULL || Proofing == NULL)
00034               return NULL;
00035        QString desc1 = cmsTakeProductDesc(Input);
00036        QString desc2 = cmsTakeProductDesc(Output);
00037        QString desc3 = cmsTakeProductDesc(Proofing);
00038        if ( desc1 != desc3 )
00039        {
00040               if( desc2 == desc3 )
00041                      ProofingIntent = INTENT_RELATIVE_COLORIMETRIC;
00042               hTransform = cmsCreateProofingTransform(Input, InputFormat, Output, OutputFormat, Proofing, Intent, 
00043                                                                                     ProofingIntent, dwFlags);
00044        }
00045        else
00046        {
00047               dwFlags &= (~cmsFLAGS_GAMUTCHECK);
00048               dwFlags &= (~cmsFLAGS_SOFTPROOFING);
00049               if ( desc1 == desc2 )
00050                      dwFlags |= cmsFLAGS_NULLTRANSFORM;
00051               hTransform = cmsCreateTransform(Input, InputFormat, Output, OutputFormat, ProofingIntent, dwFlags);
00052        }
00053        return hTransform;
00054 }