Search in sources :

Example 6 with ICC_Profile

use of java.awt.color.ICC_Profile in project jdk8u_jdk by JetBrains.

the class DisposalCrashTest method getCopyOf.

private static ICC_Profile getCopyOf(int id) {
    ICC_Profile std = ICC_Profile.getInstance(id);
    byte[] data = std.getData();
    ICC_Profile p = ICC_Profile.getInstance(data);
    WeakReference<ICC_Profile> ref = new WeakReference<>(p, queue);
    v.add(ref);
    return p;
}
Also used : WeakReference(java.lang.ref.WeakReference) ICC_Profile(java.awt.color.ICC_Profile)

Example 7 with ICC_Profile

use of java.awt.color.ICC_Profile in project jdk8u_jdk by JetBrains.

the class ReadProfileTest method run.

public void run() {
    for (int i = 0; i < cspaces.length; i++) {
        ICC_Profile pf = ICC_Profile.getInstance(cspaces[i]);
        byte[] data = pf.getData();
        if (!Arrays.equals(data, profiles[i])) {
            status = false;
            System.err.println("Incorrect result of getData() " + "with " + csNames[i] + " profile");
            throw new RuntimeException("Incorrect result of getData()");
        }
        Iterator<Integer> iter = tags[i].keySet().iterator();
        while (iter.hasNext()) {
            int tagSig = iter.next();
            byte[] tagData = pf.getData(tagSig);
            if (!Arrays.equals(tagData, (byte[]) tags[i].get(tagSig))) {
                status = false;
                System.err.println("Incorrect result of getData(int) with" + " tag " + Integer.toHexString(tagSig) + " of " + csNames[i] + " profile");
                throw new RuntimeException("Incorrect result of " + "getData(int)");
            }
        }
    }
}
Also used : ICC_Profile(java.awt.color.ICC_Profile)

Example 8 with ICC_Profile

use of java.awt.color.ICC_Profile in project jdk8u_jdk by JetBrains.

the class ReadWriteProfileTest method run.

public void run() {
    for (int i = 0; i < cspaces.length; i++) {
        System.out.println("Profile: " + csNames[i]);
        ICC_Profile pf = ICC_Profile.getInstance(cspaces[i]);
        byte[] data = pf.getData();
        pf = ICC_Profile.getInstance(data);
        if (!Arrays.equals(data, profiles[i])) {
            System.err.println("Incorrect result of getData() " + "with " + csNames[i] + " profile");
            throw new RuntimeException("Incorrect result of getData()");
        }
        for (int tagSig : tags[i].keySet()) {
            String signature = SigToString(tagSig);
            System.out.printf("Tag: %s\n", signature);
            System.out.flush();
            byte[] tagData = pf.getData(tagSig);
            byte[] empty = new byte[tagData.length];
            boolean emptyDataRejected = false;
            try {
                pf.setData(tagSig, empty);
            } catch (IllegalArgumentException e) {
                emptyDataRejected = true;
            }
            if (!emptyDataRejected) {
                throw new RuntimeException("Test failed: empty tag data was not rejected.");
            }
            try {
                pf.setData(tagSig, tagData);
            } catch (IllegalArgumentException e) {
                // let's ignore this exception for Kodak proprietary tags
                if (isKodakExtention(signature)) {
                    System.out.println("Ignore Kodak tag: " + signature);
                } else {
                    throw new RuntimeException("Test failed!", e);
                }
            }
            byte[] tagData1 = pf.getData(tagSig);
            if (!Arrays.equals(tagData1, tags[i].get(tagSig))) {
                System.err.println("Incorrect result of getData(int) with" + " tag " + SigToString(tagSig) + " of " + csNames[i] + " profile");
                throw new RuntimeException("Incorrect result of " + "getData(int)");
            }
        }
    }
}
Also used : ICC_Profile(java.awt.color.ICC_Profile)

Aggregations

ICC_Profile (java.awt.color.ICC_Profile)8 ICC_ColorSpace (java.awt.color.ICC_ColorSpace)3 CMMException (java.awt.color.CMMException)2 ColorSpace (java.awt.color.ColorSpace)1 BufferedImage (java.awt.image.BufferedImage)1 ColorConvertOp (java.awt.image.ColorConvertOp)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 WeakReference (java.lang.ref.WeakReference)1