Search in sources :

Example 96 with IIOMetadataNode

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

the class DRIMarkerSegment method getNativeNode.

IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("dri");
    node.setAttribute("interval", Integer.toString(restartInterval));
    return node;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 97 with IIOMetadataNode

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

the class JPEGMetadata method getStandardDimensionNode.

protected IIOMetadataNode getStandardDimensionNode() {
    // If we have a JFIF marker segment, we know a little
    // otherwise all we know is the orientation, which is always normal
    IIOMetadataNode dim = new IIOMetadataNode("Dimension");
    IIOMetadataNode orient = new IIOMetadataNode("ImageOrientation");
    orient.setAttribute("value", "normal");
    dim.appendChild(orient);
    JFIFMarkerSegment jfif = (JFIFMarkerSegment) findMarkerSegment(JFIFMarkerSegment.class, true);
    if (jfif != null) {
        // Aspect Ratio is width of pixel / height of pixel
        float aspectRatio;
        if (jfif.resUnits == 0) {
            // In this case they just encode aspect ratio directly
            aspectRatio = ((float) jfif.Xdensity) / jfif.Ydensity;
        } else {
            // They are true densities (e.g. dpi) and must be inverted
            aspectRatio = ((float) jfif.Ydensity) / jfif.Xdensity;
        }
        IIOMetadataNode aspect = new IIOMetadataNode("PixelAspectRatio");
        aspect.setAttribute("value", Float.toString(aspectRatio));
        dim.insertBefore(aspect, orient);
        // Pixel size
        if (jfif.resUnits != 0) {
            // 1 == dpi, 2 == dpc
            float scale = (jfif.resUnits == 1) ? 25.4F : 10.0F;
            IIOMetadataNode horiz = new IIOMetadataNode("HorizontalPixelSize");
            horiz.setAttribute("value", Float.toString(scale / jfif.Xdensity));
            dim.appendChild(horiz);
            IIOMetadataNode vert = new IIOMetadataNode("VerticalPixelSize");
            vert.setAttribute("value", Float.toString(scale / jfif.Ydensity));
            dim.appendChild(vert);
        }
    }
    return dim;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 98 with IIOMetadataNode

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

the class JPEGMetadata method getStandardTransparencyNode.

protected IIOMetadataNode getStandardTransparencyNode() {
    IIOMetadataNode trans = null;
    if (hasAlpha == true) {
        trans = new IIOMetadataNode("Transparency");
        IIOMetadataNode alpha = new IIOMetadataNode("Alpha");
        // Always assume
        alpha.setAttribute("value", "nonpremultiplied");
        trans.appendChild(alpha);
    }
    return trans;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 99 with IIOMetadataNode

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

the class COMMarkerSegment method getNativeNode.

/**
     * Returns an <code>IIOMetadataNode</code> containing the data array
     * as a user object and a string encoded using ISO-8895-1, as an
     * attribute.
     */
IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("com");
    node.setAttribute("comment", getComment());
    if (data != null) {
        node.setUserObject(data.clone());
    }
    return node;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 100 with IIOMetadataNode

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

the class DHTMarkerSegment method getNativeNode.

IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("dht");
    for (int i = 0; i < tables.size(); i++) {
        Htable table = (Htable) tables.get(i);
        node.appendChild(table.getNativeNode());
    }
    return node;
}
Also used : IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Aggregations

IIOMetadataNode (javax.imageio.metadata.IIOMetadataNode)132 Node (org.w3c.dom.Node)20 IIOMetadata (javax.imageio.metadata.IIOMetadata)12 NodeList (org.w3c.dom.NodeList)12 TIFFField (it.geosolutions.imageio.plugins.tiff.TIFFField)10 Iterator (java.util.Iterator)9 BufferedImage (java.awt.image.BufferedImage)8 ArrayList (java.util.ArrayList)8 ASOCBoxMetadataNode (it.geosolutions.imageio.plugins.jp2k.box.ASOCBoxMetadataNode)5 UUIDBoxMetadataNode (it.geosolutions.imageio.plugins.jp2k.box.UUIDBoxMetadataNode)5 XMLBoxMetadataNode (it.geosolutions.imageio.plugins.jp2k.box.XMLBoxMetadataNode)5 IOException (java.io.IOException)5 ImageOutputStream (javax.imageio.stream.ImageOutputStream)5 File (java.io.File)4 IIOImage (javax.imageio.IIOImage)4 ImageTypeSpecifier (javax.imageio.ImageTypeSpecifier)4 ImageWriter (javax.imageio.ImageWriter)4 TIFFTag (it.geosolutions.imageio.plugins.tiff.TIFFTag)3 Color (java.awt.Color)3 Point (java.awt.Point)3