equal
deleted
inserted
replaced
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 import java.awt.color.ColorSpace; |
24 import java.awt.color.ColorSpace; |
|
25 import java.awt.color.ICC_Profile; |
25 import java.awt.image.BufferedImage; |
26 import java.awt.image.BufferedImage; |
26 import java.awt.image.DataBuffer; |
27 import java.awt.image.DataBuffer; |
27 |
28 |
28 public abstract class ColConvTest implements Runnable { |
29 public abstract class ColConvTest implements Runnable { |
29 |
30 |
124 |
125 |
125 /* returns result of the test */ |
126 /* returns result of the test */ |
126 public boolean isPassed() { |
127 public boolean isPassed() { |
127 return passed; |
128 return passed; |
128 } |
129 } |
|
130 |
|
131 private static Boolean isOpenProfile = null; |
|
132 |
|
133 public static boolean isOpenProfile() { |
|
134 if (isOpenProfile == null) { |
|
135 ICC_Profile p = ICC_Profile.getInstance(ColorSpace.CS_sRGB); |
|
136 |
|
137 byte[] h = p.getData(ICC_Profile.icSigHead); |
|
138 |
|
139 if (h == null || h.length < 128) { |
|
140 throw new RuntimeException("Test failed: invalid sRGB header"); |
|
141 } |
|
142 |
|
143 final byte[] lcmsID = new byte[] { |
|
144 (byte)0x6c, // l |
|
145 (byte)0x63, // c |
|
146 (byte)0x6d, // m |
|
147 (byte)0x73, // s |
|
148 }; |
|
149 |
|
150 int off = ICC_Profile.icHdrCmmId; |
|
151 |
|
152 isOpenProfile = ((h[off + 0] == lcmsID[0]) |
|
153 && (h[off + 1] == lcmsID[1]) |
|
154 && (h[off + 2] == lcmsID[2]) |
|
155 && (h[off + 3] == lcmsID[3])); |
|
156 } |
|
157 return isOpenProfile; |
|
158 } |
129 } |
159 } |