return text_node;
}
public IIOMetadataNode getStandardTransparencyNode() {
IIOMetadataNode transparency_node =
new IIOMetadataNode("Transparency");
IIOMetadataNode node = null; // scratch node
node = new IIOMetadataNode("Alpha");
boolean hasAlpha =
(IHDR_colorType == PNGImageReader.PNG_COLOR_RGB_ALPHA) ||
(IHDR_colorType == PNGImageReader.PNG_COLOR_GRAY_ALPHA) ||
(IHDR_colorType == PNGImageReader.PNG_COLOR_PALETTE &&
tRNS_present &&
(tRNS_colorType == IHDR_colorType) &&
(tRNS_alpha != null));
node.setAttribute("value", hasAlpha ? "nonpremultipled" : "none");
transparency_node.appendChild(node);
if (tRNS_present) {
node = new IIOMetadataNode("TransparentColor");
if (tRNS_colorType == PNGImageReader.PNG_COLOR_RGB) {
node.setAttribute("value",
Integer.toString(tRNS_red) + " " +
Integer.toString(tRNS_green) + " " +
Integer.toString(tRNS_blue));
} else if (tRNS_colorType == PNGImageReader.PNG_COLOR_GRAY) {
node.setAttribute("value", Integer.toString(tRNS_gray));
}
transparency_node.appendChild(node);
}
return transparency_node;