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

📄 gifwritableimagemetadata.java

📁 Mobile 应用程序使用 Java Micro Edition (Java ME) 平台
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                                                      "characterCellHeight",                                                      -1, true,                                                      true, 1, 65535);                textForegroundColor = getIntAttribute(node,                                                      "textForegroundColor",                                                      -1, true,                                                      true, 0, 255);                textBackgroundColor = getIntAttribute(node,                                                      "textBackgroundColor",                                                      -1, true,                                                      true, 0, 255);                // XXX The "text" attribute of the PlainTextExtension element                // is not defined in the GIF image metadata format but it is                // present in the GIFImageMetadata class. Consequently it is                // used here but not required and with a default of "". See                // bug 5082763.                String textString =                    getStringAttribute(node, "text", "", false, null);                text = fromISO8859(textString);            } else if (name.equals("ApplicationExtensions")) {                IIOMetadataNode applicationExtension =                    (IIOMetadataNode)node.getFirstChild();                if (!applicationExtension.getNodeName().equals("ApplicationExtension")) {                    fatal(node,                          "Only a ApplicationExtension may be a child of a ApplicationExtensions!");                }                String applicationIDString =                    getStringAttribute(applicationExtension, "applicationID",                                       null, true, null);                String authenticationCodeString =                    getStringAttribute(applicationExtension, "authenticationCode",                                       null, true, null);                Object applicationExtensionData =                    applicationExtension.getUserObject();                if (applicationExtensionData == null ||                    !(applicationExtensionData instanceof byte[])) {                    fatal(applicationExtension,                          "Bad user object in ApplicationExtension!");                }                if (applicationIDs == null) {                    applicationIDs = new ArrayList();                    authenticationCodes = new ArrayList();                    applicationData = new ArrayList();                }                applicationIDs.add(fromISO8859(applicationIDString));                authenticationCodes.add(fromISO8859(authenticationCodeString));                applicationData.add(applicationExtensionData);            } else if (name.equals("CommentExtensions")) {                Node commentExtension = node.getFirstChild();                if (commentExtension != null) {                    while(commentExtension != null) {                        if (!commentExtension.getNodeName().equals("CommentExtension")) {                            fatal(node,                                  "Only a CommentExtension may be a child of a CommentExtensions!");                        }                        if (comments == null) {                            comments = new ArrayList();                        }                        String comment =                            getStringAttribute(commentExtension, "value", null,                                               true, null);                        comments.add(fromISO8859(comment));                        commentExtension = commentExtension.getNextSibling();                    }                }            } else {                fatal(node, "Unknown child of root node!");            }            node = node.getNextSibling();        }    }    protected void mergeStandardTree(Node root)      throws IIOInvalidTreeException {        Node node = root;        if (!node.getNodeName()            .equals(IIOMetadataFormatImpl.standardMetadataFormatName)) {            fatal(node, "Root must be " +                  IIOMetadataFormatImpl.standardMetadataFormatName);        }        node = node.getFirstChild();        while (node != null) {            String name = node.getNodeName();            if (name.equals("Chroma")) {                Node childNode = node.getFirstChild();                while(childNode != null) {                    String childName = childNode.getNodeName();                    if (childName.equals("Palette")) {                        localColorTable = getColorTable(childNode,                                                        "PaletteEntry",                                                        false, -1);                        break;                    }                    childNode = childNode.getNextSibling();                }            } else if (name.equals("Compression")) {                Node childNode = node.getFirstChild();                while(childNode != null) {                    String childName = childNode.getNodeName();                    if (childName.equals("NumProgressiveScans")) {                        int numProgressiveScans =                            getIntAttribute(childNode, "value", 4, false,                                            true, 1, Integer.MAX_VALUE);                        if (numProgressiveScans > 1) {                            interlaceFlag = true;                        }                        break;                    }                    childNode = childNode.getNextSibling();                }            } else if (name.equals("Dimension")) {                Node childNode = node.getFirstChild();                while(childNode != null) {                    String childName = childNode.getNodeName();                    if (childName.equals("HorizontalPixelOffset")) {                        imageLeftPosition = getIntAttribute(childNode,                                                            "value",                                                            -1, true,                                                            true, 0, 65535);                    } else if (childName.equals("VerticalPixelOffset")) {                        imageTopPosition = getIntAttribute(childNode,                                                           "value",                                                           -1, true,                                                           true, 0, 65535);                    }                    childNode = childNode.getNextSibling();                }            } else if (name.equals("Text")) {                Node childNode = node.getFirstChild();                while(childNode != null) {                    String childName = childNode.getNodeName();                    if (childName.equals("TextEntry") &&                        getAttribute(childNode, "compression",                                     "none", false).equals("none") &&                        Charset.isSupported(getAttribute(childNode,                                                         "encoding",                                                         "ISO-8859-1",                                                         false))) {                        String value = getAttribute(childNode, "value");                        byte[] comment = fromISO8859(value);                        if (comments == null) {                            comments = new ArrayList();                        }                        comments.add(comment);                    }                    childNode = childNode.getNextSibling();                }            } else if (name.equals("Transparency")) {                Node childNode = node.getFirstChild();                while(childNode != null) {                    String childName = childNode.getNodeName();                    if (childName.equals("TransparentIndex")) {                        transparentColorIndex = getIntAttribute(childNode,                                                                "value",                                                                -1, true,                                                                true, 0, 255);                        transparentColorFlag = true;                        break;                    }                    childNode = childNode.getNextSibling();                }            }            node = node.getNextSibling();        }    }    public void setFromTree(String formatName, Node root)        throws IIOInvalidTreeException    {        reset();        mergeTree(formatName, root);    }}

⌨️ 快捷键说明

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