feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.imageio.plugins.bmp;
public class BMPCompressionTypes {
private static final String[] compressionTypeNames =
{"BI_RGB", "BI_RLE8", "BI_RLE4", "BI_BITFIELDS", "BI_JPEG", "BI_PNG"};
static int getType(String typeString) {
for (int i = 0; i < compressionTypeNames.length; i++)
if (compressionTypeNames[i].equals(typeString))
return i;
return 0;
}
static String getName(int type) {
return compressionTypeNames[type];
}
public static String[] getCompressionTypes() {
return compressionTypeNames.clone();
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.imageio.plugins.bmp;
public interface BMPConstants {
// bmp versions
static final String VERSION_2 = "BMP v. 2.x";
static final String VERSION_3 = "BMP v. 3.x";
static final String VERSION_3_NT = "BMP v. 3.x NT";
static final String VERSION_4 = "BMP v. 4.x";
static final String VERSION_5 = "BMP v. 5.x";
// Color space types
static final int LCS_CALIBRATED_RGB = 0;
static final int LCS_sRGB = 1;
static final int LCS_WINDOWS_COLOR_SPACE = 2;
static final int PROFILE_LINKED = 3;
static final int PROFILE_EMBEDDED = 4;
// Compression Types
static final int BI_RGB = 0;
static final int BI_RLE8 = 1;
static final int BI_RLE4 = 2;
static final int BI_BITFIELDS = 3;
static final int BI_JPEG = 4;
static final int BI_PNG = 5;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.imageio.plugins.bmp;
import java.util.Locale;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.spi.IIORegistry;
import javax.imageio.spi.ServiceRegistry;
import java.io.IOException;
import javax.imageio.ImageReader;
import javax.imageio.IIOException;
public class BMPImageReaderSpi extends ImageReaderSpi {
private static String [] writerSpiNames =
{"com.sun.imageio.plugins.bmp.BMPImageWriterSpi"};
private static String[] formatNames = {"bmp", "BMP"};
private static String[] entensions = {"bmp"};
private static String[] mimeType = {"image/bmp"};
private boolean registered = false;
public BMPImageReaderSpi() {
super("Oracle Corporation",
"1.0",
formatNames,
entensions,
mimeType,
"com.sun.imageio.plugins.bmp.BMPImageReader",
new Class[] { ImageInputStream.class },
writerSpiNames,
false,
null, null, null, null,
true,
BMPMetadata.nativeMetadataFormatName,
"com.sun.imageio.plugins.bmp.BMPMetadataFormat",
null, null);
}
public void onRegistration(ServiceRegistry registry,
Class<?> category) {
if (registered) {
return;
}
registered = true;
}
public String getDescription(Locale locale) {
return "Standard BMP Image Reader";
}
public boolean canDecodeInput(Object source) throws IOException {
if (!(source instanceof ImageInputStream)) {
return false;
}
ImageInputStream stream = (ImageInputStream)source;
byte[] b = new byte[2];
stream.mark();
stream.readFully(b);
stream.reset();
return (b[0] == 0x42) && (b[1] == 0x4d);
}
public ImageReader createReaderInstance(Object extension)
throws IIOException {
return new BMPImageReader(this);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,106 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.imageio.plugins.bmp;
import java.awt.image.DataBuffer;
import java.awt.image.SampleModel;
import java.awt.image.SinglePixelPackedSampleModel;
import javax.imageio.spi.ImageWriterSpi;
import javax.imageio.spi.ServiceRegistry;
import javax.imageio.spi.IIORegistry;
import javax.imageio.stream.ImageOutputStream;
import javax.imageio.ImageWriter;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.IIOException;
import java.util.Locale;
import javax.imageio.plugins.bmp.BMPImageWriteParam;
public class BMPImageWriterSpi extends ImageWriterSpi {
private static String [] readerSpiNames =
{"com.sun.imageio.plugins.bmp.BMPImageReaderSpi"};
private static String[] formatNames = {"bmp", "BMP"};
private static String[] entensions = {"bmp"};
private static String[] mimeType = {"image/bmp"};
private boolean registered = false;
public BMPImageWriterSpi() {
super("Oracle Corporation",
"1.0",
formatNames,
entensions,
mimeType,
"com.sun.imageio.plugins.bmp.BMPImageWriter",
new Class[] { ImageOutputStream.class },
readerSpiNames,
false,
null, null, null, null,
true,
BMPMetadata.nativeMetadataFormatName,
"com.sun.imageio.plugins.bmp.BMPMetadataFormat",
null, null);
}
public String getDescription(Locale locale) {
return "Standard BMP Image Writer";
}
public void onRegistration(ServiceRegistry registry,
Class<?> category) {
if (registered) {
return;
}
registered = true;
}
public boolean canEncodeImage(ImageTypeSpecifier type) {
int dataType= type.getSampleModel().getDataType();
if (dataType < DataBuffer.TYPE_BYTE || dataType > DataBuffer.TYPE_INT)
return false;
SampleModel sm = type.getSampleModel();
int numBands = sm.getNumBands();
if (!(numBands == 1 || numBands == 3))
return false;
if (numBands == 1 && dataType != DataBuffer.TYPE_BYTE)
return false;
if (dataType > DataBuffer.TYPE_BYTE &&
!(sm instanceof SinglePixelPackedSampleModel))
return false;
return true;
}
public ImageWriter createWriterInstance(Object extension)
throws IIOException {
return new BMPImageWriter(this);
}
}

View File

@@ -0,0 +1,307 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.imageio.plugins.bmp;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataNode;
import javax.imageio.metadata.IIOMetadataFormat;
import javax.imageio.metadata.IIOMetadataFormatImpl;
import org.w3c.dom.Node;
import com.sun.imageio.plugins.common.I18N;
import com.sun.imageio.plugins.common.ImageUtil;
public class BMPMetadata extends IIOMetadata implements BMPConstants {
public static final String nativeMetadataFormatName =
"javax_imageio_bmp_1.0";
// Fields for Image Descriptor
public String bmpVersion;
public int width ;
public int height;
public short bitsPerPixel;
public int compression;
public int imageSize;
// Fields for PixelsPerMeter
public int xPixelsPerMeter;
public int yPixelsPerMeter;
public int colorsUsed;
public int colorsImportant;
// Fields for BI_BITFIELDS compression(Mask)
public int redMask;
public int greenMask;
public int blueMask;
public int alphaMask;
public int colorSpace;
// Fields for CIE XYZ for the LCS_CALIBRATED_RGB color space
public double redX;
public double redY;
public double redZ;
public double greenX;
public double greenY;
public double greenZ;
public double blueX;
public double blueY;
public double blueZ;
// Fields for Gamma values for the LCS_CALIBRATED_RGB color space
public int gammaRed;
public int gammaGreen;
public int gammaBlue;
public int intent;
// Fields for the Palette and Entries
public byte[] palette = null;
public int paletteSize;
public int red;
public int green;
public int blue;
// Fields from CommentExtension
// List of byte[]
public List comments = null; // new ArrayList();
public BMPMetadata() {
super(true,
nativeMetadataFormatName,
"com.sun.imageio.plugins.bmp.BMPMetadataFormat",
null, null);
}
public boolean isReadOnly() {
return true;
}
public Node getAsTree(String formatName) {
if (formatName.equals(nativeMetadataFormatName)) {
return getNativeTree();
} else if (formatName.equals
(IIOMetadataFormatImpl.standardMetadataFormatName)) {
return getStandardTree();
} else {
throw new IllegalArgumentException(I18N.getString("BMPMetadata0"));
}
}
private String toISO8859(byte[] data) {
try {
return new String(data, "ISO-8859-1");
} catch (UnsupportedEncodingException e) {
return "";
}
}
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;
}
// 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;
}
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;
}
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;
}
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;
}
public void setFromTree(String formatName, Node root) {
throw new IllegalStateException(I18N.getString("BMPMetadata1"));
}
public void mergeTree(String formatName, Node root) {
throw new IllegalStateException(I18N.getString("BMPMetadata1"));
}
public void reset() {
throw new IllegalStateException(I18N.getString("BMPMetadata1"));
}
private String countBits(int num) {
int count = 0;
while(num > 0) {
if ((num & 1) == 1)
count++;
num >>>= 1;
}
return count == 0 ? "" : "" + count;
}
private void addXYZPoints(IIOMetadataNode root, String name, double x, double y, double z) {
IIOMetadataNode node = addChildNode(root, name, null);
addChildNode(node, "X", new Double(x));
addChildNode(node, "Y", new Double(y));
addChildNode(node, "Z", new Double(z));
}
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;
}
}

View File

@@ -0,0 +1,208 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.imageio.plugins.bmp;
import java.util.Arrays;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.metadata.IIOMetadataFormat;
import javax.imageio.metadata.IIOMetadataFormatImpl;
public class BMPMetadataFormat extends IIOMetadataFormatImpl {
private static IIOMetadataFormat instance = null;
private BMPMetadataFormat() {
super(BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_SOME);
// root -> ImageDescriptor
addElement("ImageDescriptor",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("ImageDescriptor", "bmpVersion",
DATATYPE_STRING, true, null);
addAttribute("ImageDescriptor", "width",
DATATYPE_INTEGER, true, null,
"0", "65535", true, true);
addAttribute("ImageDescriptor", "height",
DATATYPE_INTEGER, true, null,
"1", "65535", true, true);
addAttribute("ImageDescriptor", "bitsPerPixel",
DATATYPE_INTEGER, true, null,
"1", "65535", true, true);
addAttribute("ImageDescriptor", "compression",
DATATYPE_INTEGER, false, null);
addAttribute("ImageDescriptor", "imageSize",
DATATYPE_INTEGER, true, null,
"1", "65535", true, true);
addElement("PixelsPerMeter",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("PixelsPerMeter", "X",
DATATYPE_INTEGER, false, null,
"1", "65535", true, true);
addAttribute("PixelsPerMeter", "Y",
DATATYPE_INTEGER, false, null,
"1", "65535", true, true);
addElement("ColorsUsed",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("ColorsUsed", "value",
DATATYPE_INTEGER, true, null,
"0", "65535", true, true);
addElement("ColorsImportant",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("ColorsImportant", "value",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addElement("BI_BITFIELDS_Mask",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("BI_BITFIELDS_Mask", "red",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addAttribute("BI_BITFIELDS_Mask", "green",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addAttribute("BI_BITFIELDS_Mask", "blue",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addElement("ColorSpace",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("ColorSpace", "value",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addElement("LCS_CALIBRATED_RGB",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
/// Should the max value be 1.7976931348623157e+308 ?
addAttribute("LCS_CALIBRATED_RGB", "redX",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "redY",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "redZ",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "greenX",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "greenY",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "greenZ",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "blueX",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "blueY",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB", "blueZ",
DATATYPE_DOUBLE, false, null,
"0", "65535", true, true);
addElement("LCS_CALIBRATED_RGB_GAMMA",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("LCS_CALIBRATED_RGB_GAMMA","red",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB_GAMMA","green",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addAttribute("LCS_CALIBRATED_RGB_GAMMA","blue",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
addElement("Intent",
BMPMetadata.nativeMetadataFormatName,
CHILD_POLICY_EMPTY);
addAttribute("Intent", "value",
DATATYPE_INTEGER, false, null,
"0", "65535", true, true);
// root -> Palette
addElement("Palette",
BMPMetadata.nativeMetadataFormatName,
2, 256);
addAttribute("Palette", "sizeOfPalette",
DATATYPE_INTEGER, true, null);
addBooleanAttribute("Palette", "sortFlag",
false, false);
// root -> Palette -> PaletteEntry
addElement("PaletteEntry", "Palette",
CHILD_POLICY_EMPTY);
addAttribute("PaletteEntry", "index",
DATATYPE_INTEGER, true, null,
"0", "255", true, true);
addAttribute("PaletteEntry", "red",
DATATYPE_INTEGER, true, null,
"0", "255", true, true);
addAttribute("PaletteEntry", "green",
DATATYPE_INTEGER, true, null,
"0", "255", true, true);
addAttribute("PaletteEntry", "blue",
DATATYPE_INTEGER, true, null,
"0", "255", true, true);
// root -> CommentExtensions
addElement("CommentExtensions",
BMPMetadata.nativeMetadataFormatName,
1, Integer.MAX_VALUE);
// root -> CommentExtensions -> CommentExtension
addElement("CommentExtension", "CommentExtensions",
CHILD_POLICY_EMPTY);
addAttribute("CommentExtension", "value",
DATATYPE_STRING, true, null);
}
public boolean canNodeAppear(String elementName,
ImageTypeSpecifier imageType) {
return true;
}
public static synchronized IIOMetadataFormat getInstance() {
if (instance == null) {
instance = new BMPMetadataFormat();
}
return instance;
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.imageio.plugins.bmp;
import java.util.ListResourceBundle;
import javax.imageio.metadata.IIOMetadataFormat;
import javax.imageio.metadata.IIOMetadataFormatImpl;
public class BMPMetadataFormatResources extends ListResourceBundle {
public BMPMetadataFormatResources() {}
protected Object[][] getContents() {
return new Object[][] {
// Node name, followed by description
{ "BMPVersion", "BMP version string" },
{ "Width", "The width of the image" },
{ "Height","The height of the image" },
{ "BitsPerPixel", "" },
{ "PixelsPerMeter", "Resolution in pixels per unit distance" },
{ "X", "Pixels Per Meter along X" },
{ "Y", "Pixels Per Meter along Y" },
{ "ColorsUsed",
"Number of color indexes in the color table actually used" },
{ "ColorsImportant",
"Number of color indexes considered important for display" },
{ "Mask",
"Color masks; present for BI_BITFIELDS compression only"},
{ "Intent", "Rendering intent" },
{ "Palette", "The color palette" },
{ "Red", "Red Mask/Color Palette" },
{ "Green", "Green Mask/Color Palette/Gamma" },
{ "Blue", "Blue Mask/Color Palette/Gamma" },
{ "Alpha", "Alpha Mask/Color Palette/Gamma" },
{ "ColorSpaceType", "Color Space Type" },
{ "X", "The X coordinate of a point in XYZ color space" },
{ "Y", "The Y coordinate of a point in XYZ color space" },
{ "Z", "The Z coordinate of a point in XYZ color space" },
};
}
}