⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gifimagemetadata.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                appExtNode.setAttribute("authenticationCode",                                        toISO8859(authenticationCode));                byte[] appData = (byte[])applicationData.get(i);                appExtNode.setUserObject((byte[])appData.clone());                node.appendChild(appExtNode);            }            root.appendChild(node);        }        // Comment extensions        int numComments = comments == null ? 0 : comments.size();        if (numComments > 0) {            node = new IIOMetadataNode("CommentExtensions");            for (int i = 0; i < numComments; i++) {                IIOMetadataNode commentNode =                    new IIOMetadataNode("CommentExtension");                byte[] comment = (byte[])comments.get(i);                commentNode.setAttribute("value", toISO8859(comment));                node.appendChild(commentNode);            }            root.appendChild(node);        }        return root;    }    public IIOMetadataNode getStandardChromaNode() {        IIOMetadataNode chroma_node = new IIOMetadataNode("Chroma");        IIOMetadataNode node = null; // scratch node        node = new IIOMetadataNode("ColorSpaceType");        node.setAttribute("name", "RGB");        chroma_node.appendChild(node);        node = new IIOMetadataNode("NumChannels");        node.setAttribute("value", transparentColorFlag ? "4" : "3");        chroma_node.appendChild(node);        // Gamma not in format        node = new IIOMetadataNode("BlackIsZero");        node.setAttribute("value", "TRUE");        chroma_node.appendChild(node);        if (localColorTable != null) {            node = new IIOMetadataNode("Palette");            int numEntries = localColorTable.length/3;            for (int i = 0; i < numEntries; i++) {                IIOMetadataNode entry =                    new IIOMetadataNode("PaletteEntry");                entry.setAttribute("index", Integer.toString(i));                entry.setAttribute("red",                           Integer.toString(localColorTable[3*i] & 0xff));                entry.setAttribute("green",                           Integer.toString(localColorTable[3*i + 1] & 0xff));                entry.setAttribute("blue",                           Integer.toString(localColorTable[3*i + 2] & 0xff));                node.appendChild(entry);            }            chroma_node.appendChild(node);        }        // BackgroundIndex not in image        // BackgroundColor not in format        return chroma_node;    }    public IIOMetadataNode getStandardCompressionNode() {        IIOMetadataNode compression_node = new IIOMetadataNode("Compression");        IIOMetadataNode node = null; // scratch node        node = new IIOMetadataNode("CompressionTypeName");        node.setAttribute("value", "lzw");        compression_node.appendChild(node);        node = new IIOMetadataNode("Lossless");        node.setAttribute("value", "TRUE");        compression_node.appendChild(node);        node = new IIOMetadataNode("NumProgressiveScans");        node.setAttribute("value", interlaceFlag ? "4" : "1");        compression_node.appendChild(node);        // BitRate not in format        return compression_node;    }    public IIOMetadataNode getStandardDataNode() {        IIOMetadataNode data_node = new IIOMetadataNode("Data");        IIOMetadataNode node = null; // scratch node        // PlanarConfiguration not in format        node = new IIOMetadataNode("SampleFormat");        node.setAttribute("value", "Index");        data_node.appendChild(node);        // BitsPerSample not in image        // SignificantBitsPerSample not in format        // SampleMSB not in format                return data_node;    }    public IIOMetadataNode getStandardDimensionNode() {        IIOMetadataNode dimension_node = new IIOMetadataNode("Dimension");        IIOMetadataNode node = null; // scratch node        // PixelAspectRatio not in image        node = new IIOMetadataNode("ImageOrientation");        node.setAttribute("value", "Normal");        dimension_node.appendChild(node);        // HorizontalPixelSize not in format        // VerticalPixelSize not in format        // HorizontalPhysicalPixelSpacing not in format        // VerticalPhysicalPixelSpacing not in format        // HorizontalPosition not in format        // VerticalPosition not in format        node = new IIOMetadataNode("HorizontalPixelOffset");        node.setAttribute("value", Integer.toString(imageLeftPosition));        dimension_node.appendChild(node);        node = new IIOMetadataNode("VerticalPixelOffset");        node.setAttribute("value", Integer.toString(imageTopPosition));        dimension_node.appendChild(node);        // HorizontalScreenSize not in image        // VerticalScreenSize not in image        return dimension_node;    }    // Document not in image    public IIOMetadataNode getStandardTextNode() {        if (comments == null) {            return null;        }        Iterator commentIter = comments.iterator();        if (!commentIter.hasNext()) {            return null;        }        IIOMetadataNode text_node = new IIOMetadataNode("Text");        IIOMetadataNode node = null; // scratch node                while (commentIter.hasNext()) {            byte[] comment = (byte[])commentIter.next();            String s = null;            try {                s = new String(comment, "ISO-8859-1");            } catch (UnsupportedEncodingException e) {                throw new RuntimeException("Encoding ISO-8859-1 unknown!");            }            node = new IIOMetadataNode("TextEntry");            node.setAttribute("value", s);            node.setAttribute("encoding", "ISO-8859-1");            node.setAttribute("compression", "none");            text_node.appendChild(node);        }        return text_node;    }    public IIOMetadataNode getStandardTransparencyNode() {        if (!transparentColorFlag) {            return null;        }                IIOMetadataNode transparency_node =            new IIOMetadataNode("Transparency");        IIOMetadataNode node = null; // scratch node        // Alpha not in format        node = new IIOMetadataNode("TransparentIndex");        node.setAttribute("value",                          Integer.toString(transparentColorIndex));        transparency_node.appendChild(node);        // TransparentColor not in format        // TileTransparencies not in format        // TileOpacities not in format        return transparency_node;    }    public void setFromTree(String formatName, Node root)         throws IIOInvalidTreeException    {        throw new IllegalStateException("Metadata is read-only!");    }    protected void mergeNativeTree(Node root) throws IIOInvalidTreeException    {        throw new IllegalStateException("Metadata is read-only!");    }    protected void mergeStandardTree(Node root) throws IIOInvalidTreeException    {        throw new IllegalStateException("Metadata is read-only!");    }    public void reset() {        throw new IllegalStateException("Metadata is read-only!");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -