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

📄 pngmetadata.java

📁 Mobile 应用程序使用 Java Micro Edition (Java ME) 平台
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                    if (index > maxindex) {                        maxindex = index;                    }                    red[index] =                        (byte)getIntAttribute(PLTE_entry, "red");                    green[index] =                        (byte)getIntAttribute(PLTE_entry, "green");                    blue[index] =                        (byte)getIntAttribute(PLTE_entry, "blue");                                        PLTE_entry = PLTE_entry.getNextSibling();                }                                int numEntries = maxindex + 1;                PLTE_red = new byte[numEntries];                PLTE_green = new byte[numEntries];                PLTE_blue = new byte[numEntries];                System.arraycopy(red, 0, PLTE_red, 0, numEntries);                System.arraycopy(green, 0, PLTE_green, 0, numEntries);                System.arraycopy(blue, 0, PLTE_blue, 0, numEntries);                PLTE_present = true;            } else if (name.equals("bKGD")) {                bKGD_present = false; // Guard against partial overwrite                Node bKGD_node = node.getFirstChild();                if (bKGD_node == null) {                    fatal(node, "bKGD node has no children!");                }                String bKGD_name = bKGD_node.getNodeName();                if (bKGD_name.equals("bKGD_Palette")) {                    bKGD_index = getIntAttribute(bKGD_node, "index");                    bKGD_colorType = PNGImageReader.PNG_COLOR_PALETTE;                } else if (bKGD_name.equals("bKGD_Grayscale")) {                    bKGD_gray = getIntAttribute(bKGD_node, "gray");                    bKGD_colorType = PNGImageReader.PNG_COLOR_GRAY;                } else if (bKGD_name.equals("bKGD_RGB")) {                    bKGD_red = getIntAttribute(bKGD_node, "red");                    bKGD_green = getIntAttribute(bKGD_node, "green");                    bKGD_blue = getIntAttribute(bKGD_node, "blue");                    bKGD_colorType = PNGImageReader.PNG_COLOR_RGB;                } else {                    fatal(node, "Bad child of a bKGD node!");                }                if (bKGD_node.getNextSibling() != null) {                    fatal(node, "bKGD node has more than one child!");                }                bKGD_present = true;            } else if (name.equals("cHRM")) {                cHRM_whitePointX = getIntAttribute(node, "whitePointX");                cHRM_whitePointY = getIntAttribute(node, "whitePointY");                cHRM_redX = getIntAttribute(node, "redX");                cHRM_redY = getIntAttribute(node, "redY");                cHRM_greenX = getIntAttribute(node, "greenX");                cHRM_greenY = getIntAttribute(node, "greenY");                cHRM_blueX = getIntAttribute(node, "blueX");                cHRM_blueY = getIntAttribute(node, "blueY");                                cHRM_present = true;            } else if (name.equals("gAMA")) {                gAMA_gamma = getIntAttribute(node, "value");                gAMA_present = true;            } else if (name.equals("hIST")) {                char[] hist = new char[256];                int maxindex = -1;                                Node hIST_entry = node.getFirstChild();                if (hIST_entry == null) {                    fatal(node, "hIST node has no children!");                }                while (hIST_entry != null) {                    if (!hIST_entry.getNodeName().equals("hISTEntry")) {                        fatal(node,                              "Only a hISTEntry may be a child of a hIST!");                    }                                        int index = getIntAttribute(hIST_entry, "index");                    if (index < 0 || index > 255) {                        fatal(node,                              "Bad value for histEntry attribute index!");                    }                    if (index > maxindex) {                        maxindex = index;                    }                    hist[index] =                        (char)getIntAttribute(hIST_entry, "value");                                        hIST_entry = hIST_entry.getNextSibling();                }                                int numEntries = maxindex + 1;                hIST_histogram = new char[numEntries];                System.arraycopy(hist, 0, hIST_histogram, 0, numEntries);                                hIST_present = true;            } else if (name.equals("iCCP")) {                iCCP_profileName = getAttribute(node, "profileName");                iCCP_compressionMethod =                    getEnumeratedAttribute(node, "compressionMethod",                                           iCCP_compressionMethodNames);                Object compressedProfile =                    ((IIOMetadataNode)node).getUserObject();                if (compressedProfile == null) {                    fatal(node, "No ICCP profile present in user object!");                }                if (!(compressedProfile instanceof byte[])) {                    fatal(node, "User object not a byte array!");                }                                iCCP_compressedProfile =                    (byte[])((byte[])compressedProfile).clone();                                iCCP_present = true;            } else if (name.equals("iTXt")) {                Node iTXt_node = node.getFirstChild();                while (iTXt_node != null) {                    if (!iTXt_node.getNodeName().equals("iTXtEntry")) {                        fatal(node,                              "Only an iTXtEntry may be a child of an iTXt!");                    }                                        String keyword = getAttribute(iTXt_node, "keyword");                    iTXt_keyword.add(keyword);                                        boolean compressionFlag =                        getBooleanAttribute(iTXt_node, "compressionFlag");                    iTXt_compressionFlag.add(new Boolean(compressionFlag));                                        String compressionMethod =                        getAttribute(iTXt_node, "compressionMethod");                    iTXt_compressionMethod.add(compressionMethod);                                        String languageTag =                        getAttribute(iTXt_node, "languageTag");                    iTXt_languageTag.add(languageTag);                                         String translatedKeyword =                        getAttribute(iTXt_node, "translatedKeyword");                    iTXt_translatedKeyword.add(translatedKeyword);                                        String text = getAttribute(iTXt_node, "text");                    iTXt_text.add(text);                                        iTXt_node = iTXt_node.getNextSibling();                }            } else if (name.equals("pHYs")) {                pHYs_pixelsPerUnitXAxis =                    getIntAttribute(node, "pixelsPerUnitXAxis");                pHYs_pixelsPerUnitYAxis =                    getIntAttribute(node, "pixelsPerUnitYAxis");                pHYs_unitSpecifier =                    getEnumeratedAttribute(node, "unitSpecifier",                                           unitSpecifierNames);                                pHYs_present = true;            } else if (name.equals("sBIT")) {                sBIT_present = false; // Guard against partial overwrite                Node sBIT_node = node.getFirstChild();                if (sBIT_node == null) {                    fatal(node, "sBIT node has no children!");                }                String sBIT_name = sBIT_node.getNodeName();                if (sBIT_name.equals("sBIT_Grayscale")) {                    sBIT_grayBits = getIntAttribute(sBIT_node, "gray");                    sBIT_colorType = PNGImageReader.PNG_COLOR_GRAY;                } else if (sBIT_name.equals("sBIT_GrayAlpha")) {                    sBIT_grayBits = getIntAttribute(sBIT_node, "gray");                    sBIT_alphaBits = getIntAttribute(sBIT_node, "alpha");                    sBIT_colorType = PNGImageReader.PNG_COLOR_GRAY_ALPHA;                } else if (sBIT_name.equals("sBIT_RGB")) {                    sBIT_redBits = getIntAttribute(sBIT_node, "red");                    sBIT_greenBits = getIntAttribute(sBIT_node, "green");                    sBIT_blueBits = getIntAttribute(sBIT_node, "blue");                    sBIT_colorType = PNGImageReader.PNG_COLOR_RGB;                } else if (sBIT_name.equals("sBIT_RGBAlpha")) {                    sBIT_redBits = getIntAttribute(sBIT_node, "red");                    sBIT_greenBits = getIntAttribute(sBIT_node, "green");                    sBIT_blueBits = getIntAttribute(sBIT_node, "blue");                    sBIT_alphaBits = getIntAttribute(sBIT_node, "alpha");                    sBIT_colorType = PNGImageReader.PNG_COLOR_RGB_ALPHA;                } else if (sBIT_name.equals("sBIT_Palette")) {                    sBIT_redBits = getIntAttribute(sBIT_node, "red");                    sBIT_greenBits = getIntAttribute(sBIT_node, "green");                    sBIT_blueBits = getIntAttribute(sBIT_node, "blue");                    sBIT_colorType = PNGImageReader.PNG_COLOR_PALETTE;                } else {                    fatal(node, "Bad child of an sBIT node!");                }                if (sBIT_node.getNextSibling() != null) {                    fatal(node, "sBIT node has more than one child!");                }                sBIT_present = true;            } else if (name.equals("sPLT")) {                sPLT_paletteName = getAttribute(node, "name");                sPLT_sampleDepth = getIntAttribute(node, "sampleDepth");                                int[] red = new int[256];                int[] green  = new int[256];                int[] blue = new int[256];                int[] alpha = new int[256];                int[] frequency = new int[256];                int maxindex = -1;                                Node sPLT_entry = node.getFirstChild();                if (sPLT_entry == null) {                    fatal(node, "sPLT node has no children!");                }                while (sPLT_entry != null) {                    if (!sPLT_entry.getNodeName().equals("sPLTEntry")) {                        fatal(node,                              "Only an sPLTEntry may be a child of an sPLT!");                    }                                        int index = getIntAttribute(sPLT_entry, "index");                    if (index < 0 || index > 255) {                        fatal(node,                              "Bad value for PLTEEntry attribute index!");                    }                    if (index > maxindex) {                        maxindex = index;                    }                    red[index] = getIntAttribute(sPLT_entry, "red");                    green[index] = getIntAttribute(sPLT_entry, "green");                    blue[index] = getIntAttribute(sPLT_entry, "blue");                    alpha[index] = getIntAttribute(sPLT_entry, "alpha");                    frequency[index] =                        getIntAttribute(sPLT_entry, "frequency");                                        sPLT_entry = sPLT_entry.getNextSibling();                }                                int numEntries = maxindex + 1;                sPLT_red = new int[numEntries];                sPLT_green = new int[numEntries];                sPLT_blue = new int[numEntries];                sPLT_alpha = new int[numEntries];                sPLT_frequency = new int[numEntries];                System.arraycopy(red, 0, sPLT_red, 0, numEntries);                System.arraycopy(green, 0, sPLT_green, 0, numEntries);                System.arraycopy(blue, 0, sPLT_blue, 0, numEntries);                System.arraycopy(alpha, 0, sPLT_alpha, 0, numEntries);                System.arraycopy(frequency, 0,                                 sPLT_frequency, 0, numEntries);                                sPLT_present = true;            } else if (name.equals("sRGB")) {                sRGB_renderingIntent =                    getEnumeratedAttribute(node, "renderingIntent",                                           renderingIntentNames);                                sRGB_present = true;            } else if (name.equals("tEXt")) {                Node tEXt_node = node.getFirstChild();                while (tEXt_node != null) {                    if (!tEXt_node.getNodeName().equals("tEXtEntry")) {                        fatal(node,                              "Only an tEXtEntry may be a child of an tEXt!");                    }                                        String keyword = getAttribute(tEXt_node, "keyword");                    tEXt_keyword.add(keyword);                                        String text = getAttribute(tEXt_node, "value");                    tEXt_text.add(text);                                        tEXt_node = tEXt_node.getNextSibling();                }            } else if (name.equals("tIME")) {                tIME_year = getIntAttribute(node, "year");                tIME_month = getIntAttribute(node, "month");                tIME_day = getIntAttribute(node, "day");                tIME_hour = getIntAttribute(node, "hour");                tIME_minute = getIntAttribute(node, "minute");                tIME_second = getIntAttribute(node, "second");                                tIME_present = true;            } else if (name.equals("tRNS")) {                tRNS_present = false; // Guard against partial overwrite                Node tRNS_node = node.getFirstChild();                if (tRNS_node == null) {                    fatal(node, "tRNS node has no children!");                }                String tRNS_name = tRNS_node.getNodeName();                if (tRNS_name.equals("tRNS_Palette")) {                    byte[] alpha = new byte[256];                    int maxindex = -1;                                        Node tRNS_paletteEntry = tRNS_node.getFirstChild();                    if (tRNS_paletteEntry == null) {                        fatal(node, "tRNS_Palette node has no children!");                    }                    while (tRNS_paletteEntry != null) {                        if (!tRNS_paletteEntry.getNodeName().equals(                                                        "tRNS_PaletteEntry")) {                            fatal(node,                 "Only a tRNS_PaletteEntry may be a child of a tRNS_Palette!");                        }                        int index =                            getIntAttribute(tRNS_paletteEntry, "index");                        if (index < 0 || index > 255) {                            fatal(node,                           "Bad value for tRNS_PaletteEntry attribute index!");                        }                        if (index > maxindex) {                            maxindex = index;                        }                        alpha[index] =                            (byte)getIntAttribute(tRNS_paletteEntry,                                                  "alpha");                                                tRNS_paletteEntry =                            tRNS_paletteEntry.getNextSibling();                    }                                        int numEntries = maxindex + 1;                    tRNS_alpha = new byte[numEntries];                    tRNS_colorType = PNGImageReader.PNG_COLOR_PALETTE;                    System.arraycopy(alpha, 0, tRNS_alpha, 0, numEntries);                } else if (tRNS_name.equals("tRNS_Grayscale")) {                    

⌨️ 快捷键说明

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