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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations