Exemplo n.º 1
0
static
void EmitHeader(cmsIOHANDLER* m, const char* Title, cmsHPROFILE hProfile)
{
    time_t timer;
	cmsMLU *Description, *Copyright;
	char DescASCII[256], CopyrightASCII[256];
    
    time(&timer);
	
	Description = (cmsMLU*) cmsReadTag(hProfile, cmsSigProfileDescriptionTag);
	Copyright   = (cmsMLU*) cmsReadTag(hProfile, cmsSigCopyrightTag);

	DescASCII[0] = DescASCII[255] = 0;
    CopyrightASCII[0] = CopyrightASCII[255] = 0;

	if (Description != NULL) cmsMLUgetASCII(Description,  cmsNoLanguage, cmsNoCountry, DescASCII,       255);
	if (Copyright != NULL)   cmsMLUgetASCII(Copyright,    cmsNoLanguage, cmsNoCountry, CopyrightASCII,  255);

    _cmsIOPrintf(m, "%%!PS-Adobe-3.0\n");
    _cmsIOPrintf(m, "%%\n");
    _cmsIOPrintf(m, "%% %s\n", Title);
    _cmsIOPrintf(m, "%% Source: %s\n", RemoveCR(DescASCII));
    _cmsIOPrintf(m, "%%         %s\n", RemoveCR(CopyrightASCII));
    _cmsIOPrintf(m, "%% Created: %s", ctime(&timer)); // ctime appends a \n!!!
    _cmsIOPrintf(m, "%%\n");
    _cmsIOPrintf(m, "%%%%BeginResource\n");

}
Exemplo n.º 2
0
QString dkCmsTakeProductInfo(cmsHPROFILE hProfile)
{
    static char Info[4096];
    cmsMLU*     mlu = 0;
    Info[0]         = '\0';

    if (cmsIsTag(hProfile, cmsSigProfileDescriptionTag))
    {
        char Desc[1024];

        mlu = static_cast<cmsMLU*>( cmsReadTag(hProfile, cmsSigProfileDescriptionTag) );
        cmsMLUgetASCII(mlu, "en", "US", Desc, 1024);
        strcat(Info, Desc);
    }

    if (cmsIsTag(hProfile, cmsSigCopyrightTag))
    {
        char Copyright[1024];

        mlu = static_cast<cmsMLU*>( cmsReadTag(hProfile, cmsSigCopyrightTag) );
        cmsMLUgetASCII(mlu, "en", "US", Copyright, 1024);
        strcat(Info, " - ");
        strcat(Info, Copyright);
    }

#define K007 static_cast<cmsTagSignature>( 0x4B303037 )

    if (cmsIsTag(hProfile, K007))
    {
        char MonCal[1024];

        mlu = static_cast<cmsMLU*>( cmsReadTag(hProfile, K007) );
        cmsMLUgetASCII(mlu, "en", "US", MonCal, 1024);
        strcat(Info, " - ");
        strcat(Info, MonCal);
    }
    else
    {
        /*
         *  _cmsIdentifyWhitePoint is complex and partly redundant
         *  with cietonguewidget, leave this part off
         *  untill the full lcms2 implementation
         *
        cmsCIEXYZ WhitePt;
        char WhiteStr[1024];

        dkCmsTakeMediaWhitePoint(&WhitePt, hProfile);
        _cmsIdentifyWhitePoint(WhiteStr, &WhitePt);
        strcat(Info, " - ");
        strcat(Info, WhiteStr);
        */
    }

#undef K007

    return QString::fromLatin1(Info);
}
Exemplo n.º 3
0
QString dkCmsTakeProductName(cmsHPROFILE hProfile)
{
    static char Name[1024*2+4];
    char Manufacturer[1024], Model[1024];

    Name[0]         = '\0';
    Manufacturer[0] = Model[0] = '\0';
    cmsMLU* mlu     = 0;

    if (cmsIsTag(hProfile, cmsSigDeviceMfgDescTag))
    {
        mlu = static_cast<cmsMLU*>( cmsReadTag(hProfile, cmsSigDeviceMfgDescTag) );
        cmsMLUgetASCII(mlu, "en", "US", Manufacturer, 1024);
    }

    if (cmsIsTag(hProfile, cmsSigDeviceModelDescTag))
    {
        mlu = static_cast<cmsMLU*>( cmsReadTag(hProfile, cmsSigDeviceModelDescTag) );
        cmsMLUgetASCII(mlu, "en", "US", Model, 1024);
    }

    if (!Manufacturer[0] && !Model[0])
    {

        if (cmsIsTag(hProfile, cmsSigProfileDescriptionTag))
        {
            mlu = static_cast<cmsMLU*>( cmsReadTag(hProfile, cmsSigProfileDescriptionTag) );
            cmsMLUgetASCII(mlu, "en", "US", Name, 1024);
            return QString::fromLatin1(Name);
        }
        else
        {
            return QString::fromLatin1("{no name}");
        }
    }

    if (!Manufacturer[0] || strncmp(Model, Manufacturer, 8) == 0 || strlen(Model) > 30)
    {
        strcpy(Name, Model);
    }
    else
    {
        sprintf(Name, "%s - %s", Model, Manufacturer);
    }

    return QString::fromLatin1(Name);
}
Exemplo n.º 4
0
cmsUInt32Number  CMSEXPORT cmsGetProfileInfoASCII(cmsHPROFILE hProfile, cmsInfoType Info,
                                                          const char LanguageCode[3], const char CountryCode[3],
                                                          char* Buffer, cmsUInt32Number BufferSize)
{
    const cmsMLU* mlu = GetInfo(hProfile, Info);
    if (mlu == NULL) return 0;

    return cmsMLUgetASCII(mlu, LanguageCode, CountryCode, Buffer, BufferSize);
}
Exemplo n.º 5
0
QString dkCmsTakeCopyright(cmsHPROFILE hProfile)
{
    char buffer[1024];
    const cmsMLU* const mlu = (const cmsMLU* const)cmsReadTag(hProfile, cmsSigCopyrightTag);
    buffer[0]               = '\0';

    if (mlu == NULL)
        return QString();

    cmsMLUgetASCII(mlu, "en", "US", buffer, 1024);
    return QString::fromLatin1(buffer);
}
Exemplo n.º 6
0
QString dkCmsTakeProductDesc(cmsHPROFILE hProfile)
{
    static char Name[2048];

    if (cmsIsTag(hProfile, cmsSigProfileDescriptionTag))
    {
        cmsMLU* const mlu = static_cast<cmsMLU*>( cmsReadTag(hProfile, cmsSigProfileDescriptionTag) );
        cmsMLUgetASCII(mlu, "en", "US", Name, 1024);
    }
    else
    {
        return dkCmsTakeProductName(hProfile);
    }

    if (strncmp(Name, "Copyrig", 7) == 0)
    {
        return dkCmsTakeProductName(hProfile);
    }

    return QString::fromLatin1(Name);
}