jdk/src/java.desktop/share/native/liblcms/cmscnvrt.c
changeset 40152 35cbab101a76
parent 30491 ea1c291ee28f
equal deleted inserted replaced
40151:396a601f5f8e 40152:35cbab101a76
    28 // file:
    28 // file:
    29 //
    29 //
    30 //---------------------------------------------------------------------------------
    30 //---------------------------------------------------------------------------------
    31 //
    31 //
    32 //  Little Color Management System
    32 //  Little Color Management System
    33 //  Copyright (c) 1998-2012 Marti Maria Saguer
    33 //  Copyright (c) 1998-2016 Marti Maria Saguer
    34 //
    34 //
    35 // Permission is hereby granted, free of charge, to any person obtaining
    35 // Permission is hereby granted, free of charge, to any person obtaining
    36 // a copy of this software and associated documentation files (the "Software"),
    36 // a copy of this software and associated documentation files (the "Software"),
    37 // to deal in the Software without restriction, including without limitation
    37 // to deal in the Software without restriction, including without limitation
    38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
    38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
   134     { INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC,"Relative colorimetric preserving black plane", BlackPreservingKPlaneIntents, &DefaultIntents[9] },
   134     { INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC,"Relative colorimetric preserving black plane", BlackPreservingKPlaneIntents, &DefaultIntents[9] },
   135     { INTENT_PRESERVE_K_PLANE_SATURATION,           "Saturation preserving black plane",            BlackPreservingKPlaneIntents, NULL }
   135     { INTENT_PRESERVE_K_PLANE_SATURATION,           "Saturation preserving black plane",            BlackPreservingKPlaneIntents, NULL }
   136 };
   136 };
   137 
   137 
   138 
   138 
   139 // A pointer to the begining of the list
   139 // A pointer to the beginning of the list
   140 _cmsIntentsPluginChunkType _cmsIntentsPluginChunk = { NULL };
   140 _cmsIntentsPluginChunkType _cmsIntentsPluginChunk = { NULL };
   141 
   141 
   142 // Duplicates the zone of memory used by the plug-in in the new context
   142 // Duplicates the zone of memory used by the plug-in in the new context
   143 static
   143 static
   144 void DupPluginIntentsList(struct _cmsContext_struct* ctx,
   144 void DupPluginIntentsList(struct _cmsContext_struct* ctx,
   297                                cmsMAT3* m)
   297                                cmsMAT3* m)
   298 {
   298 {
   299     cmsMAT3 Scale, m1, m2, m3, m4;
   299     cmsMAT3 Scale, m1, m2, m3, m4;
   300 
   300 
   301     // TODO: Follow Marc Mahy's recommendation to check if CHAD is same by using M1*M2 == M2*M1. If so, do nothing.
   301     // TODO: Follow Marc Mahy's recommendation to check if CHAD is same by using M1*M2 == M2*M1. If so, do nothing.
       
   302     // TODO: Add support for ArgyllArts tag
   302 
   303 
   303     // Adaptation state
   304     // Adaptation state
   304     if (AdaptationState == 1.0) {
   305     if (AdaptationState == 1.0) {
   305 
   306 
   306         // Observer is fully adapted. Keep chromatic adaptation.
   307         // Observer is fully adapted. Keep chromatic adaptation.
   915         // Cannot find a suitable value, so use colorimetric xform
   916         // Cannot find a suitable value, so use colorimetric xform
   916         // which is already stored in Out[]
   917         // which is already stored in Out[]
   917         return TRUE;
   918         return TRUE;
   918     }
   919     }
   919 
   920 
   920     // Make sure to pass thru K (which now is fixed)
   921     // Make sure to pass through K (which now is fixed)
   921     Outf[3] = LabK[3];
   922     Outf[3] = LabK[3];
   922 
   923 
   923     // Apply TAC if needed
   924     // Apply TAC if needed
   924     SumCMY   = Outf[0]  + Outf[1] + Outf[2];
   925     SumCMY   = Outf[0]  + Outf[1] + Outf[2];
   925     SumCMYK  = SumCMY + Outf[3];
   926     SumCMYK  = SumCMY + Outf[3];
   983 
   984 
   984 
   985 
   985     memset(&bp, 0, sizeof(bp));
   986     memset(&bp, 0, sizeof(bp));
   986 
   987 
   987     // We need the input LUT of the last profile, assuming this one is responsible of
   988     // We need the input LUT of the last profile, assuming this one is responsible of
   988     // black generation. This LUT will be seached in inverse order.
   989     // black generation. This LUT will be searched in inverse order.
   989     bp.LabK2cmyk = _cmsReadInputLUT(hProfiles[nProfiles-1], INTENT_RELATIVE_COLORIMETRIC);
   990     bp.LabK2cmyk = _cmsReadInputLUT(hProfiles[nProfiles-1], INTENT_RELATIVE_COLORIMETRIC);
   990     if (bp.LabK2cmyk == NULL) goto Cleanup;
   991     if (bp.LabK2cmyk == NULL) goto Cleanup;
   991 
   992 
   992     // Get total area coverage (in 0..1 domain)
   993     // Get total area coverage (in 0..1 domain)
   993     bp.MaxTAC = cmsDetectTAC(hProfiles[nProfiles-1]) / 100.0;
   994     bp.MaxTAC = cmsDetectTAC(hProfiles[nProfiles-1]) / 100.0;