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

📄 gifwritableimagemetadata.java

📁 JAVA 所有包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * @(#)GIFWritableImageMetadata.java	1.3 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package com.sun.imageio.plugins.gif;import java.io.UnsupportedEncodingException;import java.nio.charset.Charset;import java.util.ArrayList;import java.util.Iterator;import java.util.List;import javax.imageio.ImageTypeSpecifier;import javax.imageio.metadata.IIOInvalidTreeException;import javax.imageio.metadata.IIOMetadata;import javax.imageio.metadata.IIOMetadataNode;import javax.imageio.metadata.IIOMetadataFormat;import javax.imageio.metadata.IIOMetadataFormatImpl;import org.w3c.dom.Node;class GIFWritableImageMetadata extends GIFImageMetadata {    // package scope    static final String    NATIVE_FORMAT_NAME = "javax_imageio_gif_image_1.0";    GIFWritableImageMetadata() {        super(true,              NATIVE_FORMAT_NAME,              "com.sun.imageio.plugins.gif.GIFImageMetadataFormat",              null, null);    }    public boolean isReadOnly() {        return false;    }    public void reset() {        // Fields from Image Descriptor        imageLeftPosition = 0;        imageTopPosition = 0;        imageWidth = 0;        imageHeight = 0;        interlaceFlag = false;        sortFlag = false;        localColorTable = null;        // Fields from Graphic Control Extension        disposalMethod = 0;        userInputFlag = false;        transparentColorFlag = false;        delayTime = 0;        transparentColorIndex = 0;        // Fields from Plain Text Extension        hasPlainTextExtension = false;        textGridLeft = 0;        textGridTop = 0;        textGridWidth = 0;        textGridHeight = 0;        characterCellWidth = 0;        characterCellHeight = 0;        textForegroundColor = 0;        textBackgroundColor = 0;        text = null;        // Fields from ApplicationExtension        applicationIDs = null;        authenticationCodes = null;        applicationData = null;        // Fields from CommentExtension        // List of byte[]        comments = null;    }    private byte[] fromISO8859(String data) {        try {            return data.getBytes("ISO-8859-1");        } catch (UnsupportedEncodingException e) {            return (new String("")).getBytes();        }    }    protected void mergeNativeTree(Node root) throws IIOInvalidTreeException {        Node node = root;        if (!node.getNodeName().equals(nativeMetadataFormatName)) {            fatal(node, "Root must be " + nativeMetadataFormatName);        }        node = node.getFirstChild();        while (node != null) {            String name = node.getNodeName();            if (name.equals("ImageDescriptor")) {                imageLeftPosition = getIntAttribute(node,                                                    "imageLeftPosition",                                                    -1, true,                                                    true, 0, 65535);                imageTopPosition = getIntAttribute(node,                                                   "imageTopPosition",                                                   -1, true,                                                   true, 0, 65535);                imageWidth = getIntAttribute(node,                                             "imageWidth",                                             -1, true,                                             true, 1, 65535);                imageHeight = getIntAttribute(node,                                              "imageHeight",                                              -1, true,                                              true, 1, 65535);                interlaceFlag = getBooleanAttribute(node, "interlaceFlag",                                                    false, true);            } else if (name.equals("LocalColorTable")) {                int sizeOfLocalColorTable =                    getIntAttribute(node, "sizeOfLocalColorTable",                                    true, 2, 256);                if (sizeOfLocalColorTable != 2 &&                    sizeOfLocalColorTable != 4 &&                    sizeOfLocalColorTable != 8 &&                    sizeOfLocalColorTable != 16 &&                    sizeOfLocalColorTable != 32 &&                    sizeOfLocalColorTable != 64 &&                    sizeOfLocalColorTable != 128 &&                    sizeOfLocalColorTable != 256) {                    fatal(node,                          "Bad value for LocalColorTable attribute sizeOfLocalColorTable!");                }                sortFlag = getBooleanAttribute(node, "sortFlag", false, true);                localColorTable = getColorTable(node, "ColorTableEntry",                                                true, sizeOfLocalColorTable);            } else if (name.equals("GraphicControlExtension")) {                String disposalMethodName =                    getStringAttribute(node, "disposalMethod", null,                                       true, disposalMethodNames);                disposalMethod = 0;                while(!disposalMethodName.equals(disposalMethodNames[disposalMethod])) {                    disposalMethod++;                }                userInputFlag = getBooleanAttribute(node, "userInputFlag",                                                    false, true);                transparentColorFlag =                    getBooleanAttribute(node, "transparentColorFlag",                                        false, true);                delayTime = getIntAttribute(node,                                            "delayTime",                                            -1, true,                                            true, 0, 65535);                transparentColorIndex =                    getIntAttribute(node, "transparentColorIndex",                                    -1, true,                                    true, 0, 65535);            } else if (name.equals("PlainTextExtension")) {                hasPlainTextExtension = true;                textGridLeft = getIntAttribute(node,                                               "textGridLeft",                                               -1, true,                                               true, 0, 65535);                textGridTop = getIntAttribute(node,                                              "textGridTop",                                              -1, true,                                              true, 0, 65535);                textGridWidth = getIntAttribute(node,                                                "textGridWidth",                                                -1, true,                                                true, 1, 65535);                textGridHeight = getIntAttribute(node,                                                 "textGridHeight",                                                 -1, true,                                                 true, 1, 65535);                characterCellWidth = getIntAttribute(node,                                                     "characterCellWidth",                                                     -1, true,                                                     true, 1, 65535);                characterCellHeight = getIntAttribute(node,

⌨️ 快捷键说明

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