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