Search in sources :

Example 41 with IIOMetadataNode

use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.

the class PNGMetadata method getStandardCompressionNode.

public IIOMetadataNode getStandardCompressionNode() {
    IIOMetadataNode compression_node = new IIOMetadataNode("Compression");
    // scratch node
    IIOMetadataNode node = null;
    node = new IIOMetadataNode("CompressionTypeName");
    node.setAttribute("value", "deflate");
    compression_node.appendChild(node);
    node = new IIOMetadataNode("Lossless");
    node.setAttribute("value", "TRUE");
    compression_node.appendChild(node);
    node = new IIOMetadataNode("NumProgressiveScans");
    node.setAttribute("value", (IHDR_interlaceMethod == 0) ? "1" : "7");
    compression_node.appendChild(node);
    return compression_node;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 42 with IIOMetadataNode

use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.

the class BMPMetadata method getStandardDataNode.

protected IIOMetadataNode getStandardDataNode() {
    IIOMetadataNode node = new IIOMetadataNode("Data");
    String bits = "";
    if (bitsPerPixel == 24)
        bits = "8 8 8 ";
    else if (bitsPerPixel == 16 || bitsPerPixel == 32) {
        bits = "" + countBits(redMask) + " " + countBits(greenMask) + countBits(blueMask) + "" + countBits(alphaMask);
    }
    IIOMetadataNode subNode = new IIOMetadataNode("BitsPerSample");
    subNode.setAttribute("value", bits);
    node.appendChild(subNode);
    return node;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 43 with IIOMetadataNode

use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.

the class BMPMetadata method getNativeTree.

private Node getNativeTree() {
    IIOMetadataNode root = new IIOMetadataNode(nativeMetadataFormatName);
    addChildNode(root, "BMPVersion", bmpVersion);
    addChildNode(root, "Width", new Integer(width));
    addChildNode(root, "Height", new Integer(height));
    addChildNode(root, "BitsPerPixel", new Short(bitsPerPixel));
    addChildNode(root, "Compression", new Integer(compression));
    addChildNode(root, "ImageSize", new Integer(imageSize));
    IIOMetadataNode node = addChildNode(root, "PixelsPerMeter", null);
    addChildNode(node, "X", new Integer(xPixelsPerMeter));
    addChildNode(node, "Y", new Integer(yPixelsPerMeter));
    addChildNode(root, "ColorsUsed", new Integer(colorsUsed));
    addChildNode(root, "ColorsImportant", new Integer(colorsImportant));
    int version = 0;
    for (int i = 0; i < bmpVersion.length(); i++) if (Character.isDigit(bmpVersion.charAt(i)))
        version = bmpVersion.charAt(i) - '0';
    if (version >= 4) {
        node = addChildNode(root, "Mask", null);
        addChildNode(node, "Red", new Integer(redMask));
        addChildNode(node, "Green", new Integer(greenMask));
        addChildNode(node, "Blue", new Integer(blueMask));
        addChildNode(node, "Alpha", new Integer(alphaMask));
        addChildNode(root, "ColorSpaceType", new Integer(colorSpace));
        node = addChildNode(root, "CIEXYZEndPoints", null);
        addXYZPoints(node, "Red", redX, redY, redZ);
        addXYZPoints(node, "Green", greenX, greenY, greenZ);
        addXYZPoints(node, "Blue", blueX, blueY, blueZ);
        node = addChildNode(root, "Intent", new Integer(intent));
    }
    // Palette
    if ((palette != null) && (paletteSize > 0)) {
        node = addChildNode(root, "Palette", null);
        int numComps = palette.length / paletteSize;
        for (int i = 0, j = 0; i < paletteSize; i++) {
            IIOMetadataNode entry = addChildNode(node, "PaletteEntry", null);
            red = palette[j++] & 0xff;
            green = palette[j++] & 0xff;
            blue = palette[j++] & 0xff;
            addChildNode(entry, "Red", new Byte((byte) red));
            addChildNode(entry, "Green", new Byte((byte) green));
            addChildNode(entry, "Blue", new Byte((byte) blue));
            if (numComps == 4)
                addChildNode(entry, "Alpha", new Byte((byte) (palette[j++] & 0xff)));
        }
    }
    return root;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 44 with IIOMetadataNode

use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.

the class GIFStreamMetadata method getNativeTree.

private Node getNativeTree() {
    // scratch node
    IIOMetadataNode node;
    IIOMetadataNode root = new IIOMetadataNode(nativeMetadataFormatName);
    node = new IIOMetadataNode("Version");
    node.setAttribute("value", version);
    root.appendChild(node);
    // Image descriptor
    node = new IIOMetadataNode("LogicalScreenDescriptor");
    /* NB: At the moment we use empty strings to support undefined
         * integer values in tree representation.
         * We need to add better support for undefined/default values later.
         */
    node.setAttribute("logicalScreenWidth", logicalScreenWidth == UNDEFINED_INTEGER_VALUE ? "" : Integer.toString(logicalScreenWidth));
    node.setAttribute("logicalScreenHeight", logicalScreenHeight == UNDEFINED_INTEGER_VALUE ? "" : Integer.toString(logicalScreenHeight));
    // Stored value plus one
    node.setAttribute("colorResolution", colorResolution == UNDEFINED_INTEGER_VALUE ? "" : Integer.toString(colorResolution));
    node.setAttribute("pixelAspectRatio", Integer.toString(pixelAspectRatio));
    root.appendChild(node);
    if (globalColorTable != null) {
        node = new IIOMetadataNode("GlobalColorTable");
        int numEntries = globalColorTable.length / 3;
        node.setAttribute("sizeOfGlobalColorTable", Integer.toString(numEntries));
        node.setAttribute("backgroundColorIndex", Integer.toString(backgroundColorIndex));
        node.setAttribute("sortFlag", sortFlag ? "TRUE" : "FALSE");
        for (int i = 0; i < numEntries; i++) {
            IIOMetadataNode entry = new IIOMetadataNode("ColorTableEntry");
            entry.setAttribute("index", Integer.toString(i));
            int r = globalColorTable[3 * i] & 0xff;
            int g = globalColorTable[3 * i + 1] & 0xff;
            int b = globalColorTable[3 * i + 2] & 0xff;
            entry.setAttribute("red", Integer.toString(r));
            entry.setAttribute("green", Integer.toString(g));
            entry.setAttribute("blue", Integer.toString(b));
            node.appendChild(entry);
        }
        root.appendChild(node);
    }
    return root;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 45 with IIOMetadataNode

use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.

the class GIFStreamMetadata method getStandardCompressionNode.

public IIOMetadataNode getStandardCompressionNode() {
    IIOMetadataNode compression_node = new IIOMetadataNode("Compression");
    // scratch node
    IIOMetadataNode node = null;
    node = new IIOMetadataNode("CompressionTypeName");
    node.setAttribute("value", "lzw");
    compression_node.appendChild(node);
    node = new IIOMetadataNode("Lossless");
    node.setAttribute("value", "TRUE");
    compression_node.appendChild(node);
    return compression_node;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Aggregations

IIOMetadataNode (javax.imageio.metadata.IIOMetadataNode)65 Iterator (java.util.Iterator)5 IIOImage (javax.imageio.IIOImage)4 IIOMetadata (javax.imageio.metadata.IIOMetadata)4 Node (org.w3c.dom.Node)4 BufferedImage (java.awt.image.BufferedImage)3 ListIterator (java.util.ListIterator)3 ImageTypeSpecifier (javax.imageio.ImageTypeSpecifier)3 ImageWriter (javax.imageio.ImageWriter)3 ImageOutputStream (javax.imageio.stream.ImageOutputStream)3 Attr (org.w3c.dom.Attr)3 Graphics (java.awt.Graphics)2 Point (java.awt.Point)2 IndexColorModel (java.awt.image.IndexColorModel)2 ImageReader (javax.imageio.ImageReader)2 Element (org.w3c.dom.Element)2 ProductFlavorContainer (com.android.builder.model.ProductFlavorContainer)1 AndroidModel (com.android.tools.idea.model.AndroidModel)1 ChatPanel (com.glitchcog.fontificator.gui.chat.ChatPanel)1 Module (com.intellij.openapi.module.Module)1