Beispiel #1
0
    public Transform(
        Profile input,
        int inputType,
        Profile output,
        int outputType,
        Profile proof,
        int intent,
        int proofIntent,
        int flags) {
      TransformData td =
          new TransformData(
              input, inputType, output, outputType, proof, intent, proofIntent, flags);
      RCHandle transformHandle = (RCHandle) transformCache.get(td);

      if (transformHandle != null && transformHandle.increment() > 1)
        cmsTransform = transformHandle;
      else {
        cmsTransform =
            new RCHandle(
                cmsCreateProofingTransform(
                    input.cmsProfile.handle,
                    inputType,
                    output.cmsProfile.handle,
                    outputType,
                    proof.cmsProfile.handle,
                    intent,
                    proofIntent,
                    flags | cmsFLAGS_NOTPRECALC | cmsFLAGS_SOFTPROOFING));

        transformCache.put(td, cmsTransform);
        cmsTransform.increment(); // for the cache reference
      }
    }
Beispiel #2
0
    public Transform(
        Profile input, int inputType, Profile output, int outputType, int intent, int flags) {
      TransformData td = new TransformData(input, inputType, output, outputType, intent, flags);
      RCHandle transformHandle = (RCHandle) transformCache.get(td);

      if (transformHandle != null && transformHandle.increment() > 1)
        cmsTransform = transformHandle;
      else {
        // Don't bother hires with 8bit to 8bit transforms
        if (inputType != TYPE_RGB_8 || outputType != TYPE_RGB_8) flags |= cmsFLAGS_HIGHRESPRECALC;

        cmsTransform =
            new RCHandle(
                cmsCreateTransform(
                    input.cmsProfile.handle,
                    inputType,
                    output.cmsProfile.handle,
                    outputType,
                    intent,
                    flags));

        transformCache.put(td, cmsTransform);
        cmsTransform.increment(); // for the cache reference
      }
    }
Beispiel #3
0
    public Profile(double whitePoint[], double primaries[], double gamma) {
      RGBProfileComponents components = new RGBProfileComponents(whitePoint, primaries, gamma);
      RCHandle handle = (RCHandle) profileCache.get(components);

      if (handle != null && handle.increment() > 1) cmsProfile = handle;
      else {
        cmsProfile = new RCHandle(cmsCreateRGBProfile(whitePoint, primaries, gamma));
        profileCache.put(components, cmsProfile);
        cmsProfile.increment(); // for the cache reference
      }
    }
Beispiel #4
0
    public Profile(ICC_Profile iccProfile) {
      RCHandle handle = (RCHandle) profileCache.get(iccProfile);

      if (handle != null && handle.increment() > 1) cmsProfile = handle;
      else {
        byte data[] = iccProfile.getData();
        cmsProfile = new RCHandle(cmsOpenProfileFromMem(data, data.length));
        profileCache.put(iccProfile, cmsProfile);
        cmsProfile.increment(); // for the cache reference
      }
    }
Beispiel #5
0
 public void dispose() {
   if (cmsTransform != null && cmsTransform.decrement() == 0) {
     cmsDeleteTransform(cmsTransform.handle);
   }
   cmsTransform = null;
 }
Beispiel #6
0
 public void dispose() {
   if (cmsProfile != null && cmsProfile.decrement() == 0) {
     cmsCloseProfile(cmsProfile.handle);
   }
   cmsProfile = null;
 }