Search in sources :

Example 36 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 37 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 38 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 39 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 40 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)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