[Patch][gui] ImageIO fixes

Michael Koch konqueror@gmx.de
Fri Dec 31 17:03:00 GMT 2004


Hi list,


I commited the attached patch to implement some missing methods and to
fix some methods.


Michael


2004-12-31  Michael Koch  <konqueror@gmx.de>

	* javax/imageio/IIOParam.java
	(setSourceBands): New method.
	(setSourceSubsampling): Likewise.
	* javax/imageio/ImageReadParam.java
	(setDestination): Likewise.
	(setDestinationBands): Likewise.
	(setSourceProgressivePasses): Likewise.
	* javax/imageio/metadata/IIOInvalidTreeException.java
	(serialVersionUID): New static field.
	* javax/imageio/metadata/IIOMetadataNode.java
	(IIOMetadataNode): Don't explicitely implement org.w3c.dom.Node.
	(parent): Dont initailize with default value explicitely.
	(Object): Likewise.
	(removeAttribute): Doesn't throws org.w3c.dom.DOMException.
	(removeAttributeNode): Likewise.
	(removeAttributeNS): Likewise.
	(setAttribute): Likewise.
	(setAttributeNode): Likewise.
	(setAttributeNodeNS): Likewise.
	(setAttributeNS): Likewise.
	(appendChild): Likewise.
	(getNodeValue): Likewise.
	(insertBefore): Likewise.
	(removeChild): Likewise.
	(replaceChild): Likewise.
	(setPrefix): Likewise.

-------------- next part --------------
Index: javax/imageio/IIOParam.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/imageio/IIOParam.java,v
retrieving revision 1.1.12.1
diff -u -r1.1.12.1 IIOParam.java
--- javax/imageio/IIOParam.java	7 Dec 2004 16:54:48 -0000	1.1.12.1
+++ javax/imageio/IIOParam.java	31 Dec 2004 16:41:17 -0000
@@ -141,6 +141,11 @@
     this.destinationOffset = destinationOffset;
   }
 
+  public void setSourceBands(int[] sourceBands)
+  {
+    this.sourceBands = sourceBands;
+  }
+
   public void setSourceRegion(Rectangle sourceRegion)
   {
     if (sourceRegion != null
@@ -154,4 +159,13 @@
 
     this.sourceRegion = sourceRegion;
   }
+
+  public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling,
+				   int subsamplingXOffset, int subsamplingYOffset)
+  {
+    this.sourceXSubsampling = sourceXSubsampling;
+    this.sourceYSubsampling = sourceYSubsampling;
+    this.subsamplingXOffset = subsamplingXOffset;
+    this.subsamplingYOffset = subsamplingYOffset;
+  }
 }
Index: javax/imageio/ImageReadParam.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/imageio/ImageReadParam.java,v
retrieving revision 1.1.12.1
diff -u -r1.1.12.1 ImageReadParam.java
--- javax/imageio/ImageReadParam.java	7 Dec 2004 16:54:48 -0000	1.1.12.1
+++ javax/imageio/ImageReadParam.java	31 Dec 2004 16:41:17 -0000
@@ -94,6 +94,22 @@
   {
     return sourceRenderSize;
   }
+
+  public void setDestination(BufferedImage destination)
+  {
+    this.destination = destination;
+  }
+
+  public void setDestinationBands(int[] destinationBands)
+  {
+    this.destinationBands = destinationBands;
+  }
+
+  public void setSourceProgressivePasses(int minPass, int numPasses)
+  {
+    this.minProgressivePass = minPass;
+    this.numProgressivePasses = numPasses;
+  }
   
   public void setSourceRenderSize(Dimension size)
     throws UnsupportedOperationException
Index: javax/imageio/metadata/IIOInvalidTreeException.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/imageio/metadata/IIOInvalidTreeException.java,v
retrieving revision 1.1.12.2
diff -u -r1.1.12.2 IIOInvalidTreeException.java
--- javax/imageio/metadata/IIOInvalidTreeException.java	28 Dec 2004 19:36:20 -0000	1.1.12.2
+++ javax/imageio/metadata/IIOInvalidTreeException.java	31 Dec 2004 16:41:17 -0000
@@ -44,6 +44,8 @@
 
 public class IIOInvalidTreeException extends IIOException
 {
+  private static final long serialVersionUID = -1314083172544132777L;
+
   protected Node offendingNode;
 
   public IIOInvalidTreeException(String message, Node offendingNode)
Index: javax/imageio/metadata/IIOMetadataNode.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/imageio/metadata/IIOMetadataNode.java,v
retrieving revision 1.1.12.3
diff -u -r1.1.12.3 IIOMetadataNode.java
--- javax/imageio/metadata/IIOMetadataNode.java	28 Dec 2004 19:27:43 -0000	1.1.12.3
+++ javax/imageio/metadata/IIOMetadataNode.java	31 Dec 2004 16:41:17 -0000
@@ -51,13 +51,14 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-public class IIOMetadataNode implements Element, Node, NodeList
+public class IIOMetadataNode
+  implements Element, NodeList
 {
   private String name;
   private HashMap attrs = new HashMap();
   private List children = new ArrayList();
-  private IIOMetadataNode parent = null;
-  private Object obj = null;
+  private IIOMetadataNode parent;
+  private Object obj;
   
   public IIOMetadataNode()
   {
@@ -105,6 +106,7 @@
   {
     return getAttributeNode(localName);
   }
+
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#getAttributeNS(java.lang.String, java.lang.String)
    */
@@ -137,7 +139,8 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String)
    */
-  public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
+  public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
+  {
     IIONodeList list = new IIONodeList();
     getElementsRecurse(list, name);
     return list;
@@ -170,7 +173,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#removeAttribute(java.lang.String)
    */
-  public void removeAttribute(String name) throws DOMException
+  public void removeAttribute(String name)
   {
     attrs.remove(name);
   }
@@ -178,7 +181,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr)
    */
-  public Attr removeAttributeNode(Attr oldAttr) throws DOMException
+  public Attr removeAttributeNode(Attr oldAttr)
   {
     return (Attr)attrs.remove(oldAttr.getName());
   }
@@ -187,14 +190,14 @@
    * @see org.w3c.dom.Element#removeAttributeNS(java.lang.String, java.lang.String)
    */
   public void removeAttributeNS(String namespaceURI, String localName)
-      throws DOMException
   {
     removeAttribute(localName);
   }
+  
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String)
    */
-  public void setAttribute(String name, String value) throws DOMException
+  public void setAttribute(String name, String value)
   {
     Attr attr = (Attr) getAttributeNode(name);
     if (attr != null)
@@ -206,7 +209,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr)
    */
-  public Attr setAttributeNode(Attr newAttr) throws DOMException
+  public Attr setAttributeNode(Attr newAttr)
   {
     return (Attr)attrs.put(newAttr.getName(), newAttr);
   }
@@ -214,7 +217,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr)
    */
-  public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
+  public Attr setAttributeNodeNS(Attr newAttr)
   {
     return (Attr)attrs.put(newAttr.getName(), newAttr);
   }
@@ -222,8 +225,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Element#setAttributeNS(java.lang.String, java.lang.String, java.lang.String)
    */
-  public void setAttributeNS(String namespaceURI, String qualifiedName,
-      String value) throws DOMException
+  public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
   {
     setAttribute(qualifiedName, value);    
   }
@@ -250,7 +252,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
    */
-  public Node appendChild(Node newChild) throws DOMException
+  public Node appendChild(Node newChild)
   {
     if (newChild == null)
       throw new IllegalArgumentException("Child node is null");
@@ -367,7 +369,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Node#getNodeValue()
    */
-  public String getNodeValue() throws DOMException
+  public String getNodeValue()
   {
     return null;
   }
@@ -428,7 +430,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
    */
-  public Node insertBefore(Node newChild, Node refChild) throws DOMException
+  public Node insertBefore(Node newChild, Node refChild)
   {
     if (newChild == null)
       throw new IllegalArgumentException();
@@ -463,7 +465,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
    */
-  public Node removeChild(Node oldChild) throws DOMException
+  public Node removeChild(Node oldChild)
   {
     if (oldChild == null)
       throw new IllegalArgumentException();
@@ -476,7 +478,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
    */
-  public Node replaceChild(Node newChild, Node oldChild) throws DOMException
+  public Node replaceChild(Node newChild, Node oldChild)
   {
     if (newChild == null)
       throw new IllegalArgumentException();
@@ -495,7 +497,7 @@
   /* (non-Javadoc)
    * @see org.w3c.dom.Node#setPrefix(java.lang.String)
    */
-  public void setPrefix(String prefix) throws DOMException
+  public void setPrefix(String prefix)
   {
   }
 }


More information about the Java-patches mailing list