use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.
the class SOFMarkerSegment method getNativeNode.
IIOMetadataNode getNativeNode() {
IIOMetadataNode node = new IIOMetadataNode("sof");
node.setAttribute("process", Integer.toString(tag - JPEG.SOF0));
node.setAttribute("samplePrecision", Integer.toString(samplePrecision));
node.setAttribute("numLines", Integer.toString(numLines));
node.setAttribute("samplesPerLine", Integer.toString(samplesPerLine));
node.setAttribute("numFrameComponents", Integer.toString(componentSpecs.length));
for (int i = 0; i < componentSpecs.length; i++) {
node.appendChild(componentSpecs[i].getNativeNode());
}
return node;
}
use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.
the class BMPMetadata method addChildNode.
private IIOMetadataNode addChildNode(IIOMetadataNode root, String name, Object object) {
IIOMetadataNode child = new IIOMetadataNode(name);
if (object != null) {
child.setUserObject(object);
child.setNodeValue(ImageUtil.convertObjectToString(object));
}
root.appendChild(child);
return child;
}
use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.
the class BMPMetadata method getStandardCompressionNode.
protected IIOMetadataNode getStandardCompressionNode() {
IIOMetadataNode node = new IIOMetadataNode("Compression");
// CompressionTypeName
IIOMetadataNode subNode = new IIOMetadataNode("CompressionTypeName");
subNode.setAttribute("value", BMPCompressionTypes.getName(compression));
node.appendChild(subNode);
return node;
}
use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.
the class BMPMetadata method getStandardDimensionNode.
protected IIOMetadataNode getStandardDimensionNode() {
if (yPixelsPerMeter > 0.0F && xPixelsPerMeter > 0.0F) {
IIOMetadataNode node = new IIOMetadataNode("Dimension");
float ratio = yPixelsPerMeter / xPixelsPerMeter;
IIOMetadataNode subNode = new IIOMetadataNode("PixelAspectRatio");
subNode.setAttribute("value", "" + ratio);
node.appendChild(subNode);
subNode = new IIOMetadataNode("HorizontalPhysicalPixelSpacing");
subNode.setAttribute("value", "" + (1 / xPixelsPerMeter * 1000));
node.appendChild(subNode);
subNode = new IIOMetadataNode("VerticalPhysicalPixelSpacing");
subNode.setAttribute("value", "" + (1 / yPixelsPerMeter * 1000));
node.appendChild(subNode);
return node;
}
return null;
}
use of javax.imageio.metadata.IIOMetadataNode in project jdk8u_jdk by JetBrains.
the class BMPMetadata method getStandardChromaNode.
// Standard tree node methods
protected IIOMetadataNode getStandardChromaNode() {
if ((palette != null) && (paletteSize > 0)) {
IIOMetadataNode node = new IIOMetadataNode("Chroma");
IIOMetadataNode subNode = new IIOMetadataNode("Palette");
int numComps = palette.length / paletteSize;
subNode.setAttribute("value", "" + numComps);
for (int i = 0, j = 0; i < paletteSize; i++) {
IIOMetadataNode subNode1 = new IIOMetadataNode("PaletteEntry");
subNode1.setAttribute("index", "" + i);
subNode1.setAttribute("red", "" + palette[j++]);
subNode1.setAttribute("green", "" + palette[j++]);
subNode1.setAttribute("blue", "" + palette[j++]);
if (numComps == 4 && palette[j] != 0)
subNode1.setAttribute("alpha", "" + palette[j++]);
subNode.appendChild(subNode1);
}
node.appendChild(subNode);
return node;
}
return null;
}
Aggregations