~vorlon/ubuntu/oneiric/lcms/multiarch

« back to all changes in this revision

Viewing changes to src/cmsps2.c

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2007-04-12 16:48:49 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070412164849-a5h7vxb1bzjdqg1t
Tags: 1.16-3
Revert liblcms1-dev file location from /usr/include/liblcms1 to
/usr/include before people start complaining about FTBFS bugs in other
packages. Temporarily remove python-liblcms to avoid NEW queue.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
//  Little cms
3
 
//  Copyright (C) 1998-2005 Marti Maria
 
3
//  Copyright (C) 1998-2006 Marti Maria
4
4
//
5
5
// Permission is hereby granted, free of charge, to any person obtaining 
6
6
// a copy of this software and associated documentation files (the "Software"), 
952
952
    return 1;
953
953
}
954
954
 
 
955
// Generates a curve from a gray profile
 
956
 
 
957
static
 
958
LPGAMMATABLE ExtractGray2Y(cmsHPROFILE hProfile, int Intent)
 
959
{
 
960
    LPGAMMATABLE Out = cmsAllocGamma(256);
 
961
    cmsHPROFILE hXYZ = cmsCreateXYZProfile();
 
962
    cmsHTRANSFORM xform = cmsCreateTransform(hProfile, TYPE_GRAY_8, hXYZ, TYPE_XYZ_DBL, Intent, cmsFLAGS_NOTPRECALC);
 
963
    int i;
 
964
 
 
965
    for (i=0; i < 256; i++) {
 
966
        
 
967
      BYTE Gray = (BYTE) i;
 
968
      cmsCIEXYZ XYZ;
 
969
      
 
970
        cmsDoTransform(xform, &Gray, &XYZ, 1);
 
971
        
 
972
        Out ->GammaTable[i] =_cmsClampWord((int) floor(XYZ.Y * 65535.0 + 0.5));
 
973
    }
 
974
 
 
975
    cmsDeleteTransform(xform);
 
976
    cmsCloseProfile(hXYZ);
 
977
    return Out;
 
978
}
 
979
 
955
980
 
956
981
 
957
982
// Because PostScrip has only 8 bits in /Table, we should use
1021
1046
 
1022
1047
    switch (nChannels) {
1023
1048
 
1024
 
    case 1: {
1025
 
 
1026
 
            // LPGAMMATABLE Gray2Y = ExtractGray2Y(xform);
1027
 
            // rc = EmitCIEBasedA(m, Gray2Y->GammaTable, Gray2Y ->nEntries, hProfile);
1028
 
            // cmsFreeGamma(Gray2Y);
1029
 
 
1030
 
            cmsSignalError(LCMS_ERRC_ABORTED, "Monochrome LUT-based currently unsupported for CSA generation");
 
1049
    case 1: {            
 
1050
            LPGAMMATABLE Gray2Y = ExtractGray2Y(hProfile, Intent);
 
1051
            EmitCIEBasedA(m, Gray2Y->GammaTable, Gray2Y ->nEntries, &BlackPointAdaptedToD50);            
 
1052
            cmsFreeGamma(Gray2Y);            
1031
1053
            }
1032
1054
            break;
1033
1055
 
1482
1504
    if (DeviceLink ->wFlags & LUT_HASTL1) {
1483
1505
 
1484
1506
        // Shouldn't happen
1485
 
        cmsSignalError(LCMS_ERRC_ABORTED, "Internal error (prelinearization on CRD)");       
 
1507
        cmsSignalError(LCMS_ERRC_ABORTED, "Internal error (prelinearization on CRD)");
 
1508
        return 0;
1486
1509
    }
1487
1510
    
1488
1511