? media.patch ? main/.classpath ? main/.project ? main/bin ? main/org/jboss/media/format/image/iio/TIFFMediaFormat.java ? main/org/jboss/media/format/image/iio/TIFFMediaHeader.java Index: main/org/jboss/media/format/image/iio/IIOMediaHeader.java =================================================================== RCS file: /cvsroot/jboss/jboss-media/src/main/org/jboss/media/format/image/iio/IIOMediaHeader.java,v retrieving revision 1.1 diff -u -r1.1 IIOMediaHeader.java --- main/org/jboss/media/format/image/iio/IIOMediaHeader.java 14 Feb 2003 10:02:00 -0000 1.1 +++ main/org/jboss/media/format/image/iio/IIOMediaHeader.java 19 Mar 2004 14:24:21 -0000 @@ -38,6 +38,14 @@ } /** + * Outside-SPEC + * dhartford 3/17/2004 + */ + public String getXMLMediaHeader(){ + return DOMUtils.displayXML(metadataRootNode,0,new StringBuffer()); + } + + /** * @see javax.emb.MediaHeader#getFieldNames() */ public abstract String[] getFieldNames(); Index: main/org/jboss/media/format/image/iio/JPEGMediaHeader.java =================================================================== RCS file: /cvsroot/jboss/jboss-media/src/main/org/jboss/media/format/image/iio/JPEGMediaHeader.java,v retrieving revision 1.1 diff -u -r1.1 JPEGMediaHeader.java --- main/org/jboss/media/format/image/iio/JPEGMediaHeader.java 14 Feb 2003 10:02:00 -0000 1.1 +++ main/org/jboss/media/format/image/iio/JPEGMediaHeader.java 19 Mar 2004 14:24:21 -0000 @@ -8,7 +8,6 @@ package org.jboss.media.format.image.iio; import javax.imageio.metadata.IIOMetadata; - /** * JPEG MediaHeader based on the Java Image I/O API. * @@ -24,8 +23,14 @@ "javax_imageio_jpeg_image_1.0"; private static final String[] FIELD_NAMES = { + //JFIF only right now + "resUnits", + "xdensity", + "ydensity", + "thumbWidth", + "thumbHeight" }; - + /** * Constructor. * @@ -36,6 +41,8 @@ { super(imageMetadata, JPEG_METADATA_FORMAT_NAME); } + + /** * @see javax.emb.MediaHeader#getFieldNames() @@ -50,8 +57,62 @@ */ public Object getField(String fieldname) { - Object field = null; + Object field = null; - return field; + + //JFIF only right now + if (fieldname.equals("resUnits")) + { + field = getResUnits(); + } + else if (fieldname.equals("xdensity")) + { + field = getXdensity(); + } + else if (fieldname.equals("ydensity")) + { + field = getYdensity(); + } + else if (fieldname.equals("thumbWidth")) + { + field = getThumbWidth(); + } + else if (fieldname.equals("thumbHeight")) + { + field = getThumbHeight(); + } + + return field; + } + + + + + private Integer getResUnits() + { + String width = getAttribute("app0JFIF", "resUnits"); + return Integer.valueOf(width); + } + private Integer getXdensity() + { + String width = getAttribute("app0JFIF", "Xdensity"); + return Integer.valueOf(width); + } + private Integer getYdensity() + { + String width = getAttribute("app0JFIF", "Ydensity"); + return Integer.valueOf(width); + } + private Integer getThumbWidth() + { + String width = getAttribute("app0JFIF", "thumbWidth"); + return Integer.valueOf(width); + } + private Integer getThumbHeight() + { + String width = getAttribute("app0JFIF", "thumbHeight"); + return Integer.valueOf(width); } + + } Index: main/org/jboss/media/format/image/iio/PNGMediaHeader.java =================================================================== RCS file: /cvsroot/jboss/jboss-media/src/main/org/jboss/media/format/image/iio/PNGMediaHeader.java,v retrieving revision 1.1 diff -u -r1.1 PNGMediaHeader.java --- main/org/jboss/media/format/image/iio/PNGMediaHeader.java 14 Feb 2003 10:02:00 -0000 1.1 +++ main/org/jboss/media/format/image/iio/PNGMediaHeader.java 19 Mar 2004 14:24:21 -0000 @@ -23,6 +23,7 @@ private static final String PNG_METADATA_FORMAT_NAME = "javax_imageio_png_1.0"; + private static final String[] FIELD_NAMES = { "width", @@ -46,6 +47,7 @@ { super(imageMetadata, PNG_METADATA_FORMAT_NAME); } + /** * @see javax.emb.MediaHeader#getFieldNames() Index: main/org/jboss/media/util/DOMUtils.java =================================================================== RCS file: /cvsroot/jboss/jboss-media/src/main/org/jboss/media/util/DOMUtils.java,v retrieving revision 1.1 diff -u -r1.1 DOMUtils.java --- main/org/jboss/media/util/DOMUtils.java 8 Feb 2003 03:16:41 -0000 1.1 +++ main/org/jboss/media/util/DOMUtils.java 19 Mar 2004 14:24:22 -0000 @@ -55,6 +55,46 @@ displayNode(root, 0); } + +/* + * Method to support XMLMediaHeaders + * @author dhartford + * @date 3/17/2004 +*/ + public static String displayXML(Node node, int level, StringBuffer sb) + { + sb.append("\n<" + node.getNodeName()); + NamedNodeMap map = node.getAttributes(); + if (map != null) + { + // print attribute values + int length = map.getLength(); + for (int i = 0; i < length; i++) + { + Node attr = map.item(i); + sb.append( + " " + attr.getNodeName() + "=\"" + attr.getNodeValue() + "\""); + } + } + Node child = node.getFirstChild(); + if (child != null) + { + sb.append(">"); // close current tag + while (child != null) + { + // emit child tags recursively + displayXML(child, level + 1, sb); + child = child.getNextSibling(); + } + sb.append("\n"); + } + else + { + sb.append("/>"); + } + return sb.toString(); + } + public static void displayNode(Node node, int level) { indent(level);