/** Creates a <code>ColorSpecificationBox</code> from the provided data * elements. */ public ColorSpecificationBox(byte m, byte p, byte a, int ecs, ICC_Profile profile) { super(computeLength(m, profile), 0x636F6C72, null); this.method = m; this.precedence = p; this.approximation = a; this.ecs = ecs; this.profile = profile; }
/** Creates an <code>IIOMetadataNode</code> from this color specification * box. The format of this node is defined in the XML dtd and xsd * for the JP2 image file. */ public IIOMetadataNode getNativeNode() { return getNativeNodeForSimpleBox(); }
if (header != null) { if (header.getUnknownColorspace() == 0) { if (color != null && color.getMethod() == 1) { subNode = new IIOMetadataNode("ColorSpaceType"); int ecs = color.getEnumeratedColorSpace(); if (ecs == FileFormatBoxes.CSB_ENUM_SRGB) subNode.setAttribute("name", "RGB");
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)); } }
protected void compose() { if (data != null) return; int len = 7; byte[] profileData = null; if (profile != null) { profileData = profile.getData(); len += profileData.length; } data = new byte[len]; data[0] = (byte)method; data[1] = (byte)precedence; data[2] = (byte)approximation; copyInt(data, 3, ecs); if (profile != null) System.arraycopy(profileData, 0, data, 7, len - 7); } }
/** Read the color specifications. */ public void readColourSpecificationBox(int length)throws IOException { // read METHOD field byte method = (byte)in.readByte(); // read PREC field byte prec = (byte)in.readByte(); // read APPROX field byte approx = (byte)in.readByte(); if (method == 2) { byte[] data = new byte[length - 3]; in.readFully(data, 0, data.length); profile = ICC_Profile.getInstance(data); } else // read EnumCS field colorSpaceType = in.readInt(); if (metadata != null) { metadata.addNode(new ColorSpecificationBox(method, prec, approx, colorSpaceType, profile)); } }
addNode(new ColorSpecificationBox((byte)1, (byte)0, (byte)0, ColorSpecificationBox.ECS_sRGB, null)); } else if (type == ColorSpace.TYPE_GRAY) addNode(new ColorSpecificationBox((byte)1, (byte)0, (byte)0, ColorSpecificationBox.ECS_GRAY, null)); else if (cs instanceof ICC_ColorSpace) addNode(new ColorSpecificationBox((byte)2, (byte)0, (byte)0, 0,