public void addNode(Box node) { if (boxes == null) boxes = new ArrayList(); replace(Box.getName(node.getType()), node); }
private void createColorSpecificationBoxFromStandardNode(Node node) { if (node.getNodeName() != "ColorSpaceType") throw new IllegalArgumentException(I18N.getString("J2KMetadata4")); String name = (String)Box.getAttribute(node, "name"); int ecs = name.equals("RGB") ? ColorSpecificationBox.ECS_sRGB : (name.equals("Gray") ? ColorSpecificationBox.ECS_GRAY : 0); if (ecs == ColorSpecificationBox.ECS_sRGB || ecs ==ColorSpecificationBox.ECS_GRAY) { replace ("JPEG2000ColorSpecificationBox", new ColorSpecificationBox((byte)1, (byte)0, (byte)0, ecs, null)); } }
replace("JPEG2000CaptureResolutionBox", new ResolutionBox(0x72657363, hRes, vRes));
replace("JPEG2000BitsPerComponent", new BitsPerComponentBox(bits));
ChannelDefinitionBox.fillBasedOnBands(numComps, isPremultiplied, channels, types, associations); replace("JPEG2000ChannelDefinitionBox", new ChannelDefinitionBox(channels, types, associations));
icm = new IndexColorModel(numBits, size, red, green, blue, alpha); replace("JPEG2000PaletteBox", new PaletteBox(icm));
private void mergeNativeTree(Node root) throws IIOInvalidTreeException { NodeList list = root.getChildNodes(); for (int i = list.getLength() - 1; i >= 0; i--) { Node node = list.item(i); String name = node.getNodeName(); if (format.getParent(name) != null) { if (format.isLeaf(name)) { String s = (String)Box.getAttribute(node, "Type"); Box box = Box.createBox(Box.getTypeInt(s), node); if (format.singleInstance(name)&&getElement(name) != null) { replace(name, box); } else boxes.add(box); } else { mergeNativeTree(node); } } } }
private void createHeaderBoxFromStandardNode(Node node, int numComps) { HeaderBox header = (HeaderBox)getElement("JPEG2000HeaderBox"); byte unknownColor = (byte)(getElement("JPEG2000ColorSpecificationBox") == null ? 1: 0); if (header != null) { if (numComps ==0); numComps = header.getNumComponents(); header = new HeaderBox(header.getHeight(), header.getWidth(), numComps, header.getBitDepth(), header.getCompressionType(), unknownColor, header.getIntellectualProperty()); } else { header = new HeaderBox(0, 0, numComps, 0, 0, unknownColor, 0); } replace("JPEG2000HeaderBox", header); }