1239 mergeStandardTree(root);
1240 } else {
1241 throw new IllegalArgumentException("Not a recognized format!");
1242 }
1243 }
1244
1245 private void mergeNativeTree(Node root)
1246 throws IIOInvalidTreeException {
1247 Node node = root;
1248 if (!node.getNodeName().equals(nativeMetadataFormatName)) {
1249 fatal(node, "Root must be " + nativeMetadataFormatName);
1250 }
1251
1252 node = node.getFirstChild();
1253 while (node != null) {
1254 String name = node.getNodeName();
1255
1256 if (name.equals("IHDR")) {
1257 IHDR_width = getIntAttribute(node, "width");
1258 IHDR_height = getIntAttribute(node, "height");
1259 IHDR_bitDepth = getEnumeratedAttribute(node, "bitDepth",
1260 IHDR_bitDepths);
1261 IHDR_colorType = getEnumeratedAttribute(node, "colorType",
1262 IHDR_colorTypeNames);
1263 IHDR_compressionMethod =
1264 getEnumeratedAttribute(node, "compressionMethod",
1265 IHDR_compressionMethodNames);
1266 IHDR_filterMethod =
1267 getEnumeratedAttribute(node,
1268 "filterMethod",
1269 IHDR_filterMethodNames);
1270 IHDR_interlaceMethod =
1271 getEnumeratedAttribute(node, "interlaceMethod",
1272 IHDR_interlaceMethodNames);
1273 IHDR_present = true;
1274 } else if (name.equals("PLTE")) {
1275 byte[] red = new byte[256];
1276 byte[] green = new byte[256];
1277 byte[] blue = new byte[256];
1278 int maxindex = -1;
1279
|
1239 mergeStandardTree(root);
1240 } else {
1241 throw new IllegalArgumentException("Not a recognized format!");
1242 }
1243 }
1244
1245 private void mergeNativeTree(Node root)
1246 throws IIOInvalidTreeException {
1247 Node node = root;
1248 if (!node.getNodeName().equals(nativeMetadataFormatName)) {
1249 fatal(node, "Root must be " + nativeMetadataFormatName);
1250 }
1251
1252 node = node.getFirstChild();
1253 while (node != null) {
1254 String name = node.getNodeName();
1255
1256 if (name.equals("IHDR")) {
1257 IHDR_width = getIntAttribute(node, "width");
1258 IHDR_height = getIntAttribute(node, "height");
1259 // IHDR_bitDepth is number of bits, not an index of IHDR_bitDepths
1260 // getEnumeratedAttribute returns valid index of IHDR_bitDepths or
1261 // IIOInvalidTreeException, to get real number of bits we need
1262 // to do "1 << index". see 8041460
1263 IHDR_bitDepth = 1 << getEnumeratedAttribute(node, "bitDepth",
1264 IHDR_bitDepths);
1265 IHDR_colorType = getEnumeratedAttribute(node, "colorType",
1266 IHDR_colorTypeNames);
1267 IHDR_compressionMethod =
1268 getEnumeratedAttribute(node, "compressionMethod",
1269 IHDR_compressionMethodNames);
1270 IHDR_filterMethod =
1271 getEnumeratedAttribute(node,
1272 "filterMethod",
1273 IHDR_filterMethodNames);
1274 IHDR_interlaceMethod =
1275 getEnumeratedAttribute(node, "interlaceMethod",
1276 IHDR_interlaceMethodNames);
1277 IHDR_present = true;
1278 } else if (name.equals("PLTE")) {
1279 byte[] red = new byte[256];
1280 byte[] green = new byte[256];
1281 byte[] blue = new byte[256];
1282 int maxindex = -1;
1283
|