Hi,

I was happy that I could quickly fix the Image.getScaledInstance()
method to support the AreaAveragingScaleFilter only to find out that
class doesn't actually do something :{ So the important part of this
patch is to actually document that fact with a FIXME.

2005-11-06  Mark Wielaard  <[EMAIL PROTECTED]>

        * java/awt/image/AreaAveragingScaleFilter.java: Add FIXME
        * java/awt/Image.java (getScaledInstance): In case of
        SCALE_AREA_AVERAGING use AreaAveragingScaleFilter.

Committed,

Mark
Index: java/awt/Image.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Image.java,v
retrieving revision 1.12
diff -u -r1.12 Image.java
--- java/awt/Image.java	3 Oct 2005 17:21:06 -0000	1.12
+++ java/awt/Image.java	6 Nov 2005 22:13:51 -0000
@@ -38,7 +38,9 @@
 
 package java.awt;
 
+import java.awt.image.AreaAveragingScaleFilter;
 import java.awt.image.FilteredImageSource;
+import java.awt.image.ImageFilter;
 import java.awt.image.ImageObserver;
 import java.awt.image.ImageProducer;
 import java.awt.image.ReplicateScaleFilter;
@@ -178,20 +180,25 @@
    */
   public Image getScaledInstance(int width, int height, int flags)
   {
+    ImageFilter filter;
     switch (flags)
     {
       case SCALE_DEFAULT:
       case SCALE_FAST:
       case SCALE_REPLICATE:
-        ImageProducer producer =
-          new FilteredImageSource(this.getSource(),
-                                  new ReplicateScaleFilter(width, height));
-        return Toolkit.getDefaultToolkit().createImage(producer);
-      case SCALE_SMOOTH:
+	filter = new ReplicateScaleFilter(width, height);
+	break;
       case SCALE_AREA_AVERAGING:
+	filter = new AreaAveragingScaleFilter(width, height);
+	break;
+      case SCALE_SMOOTH:
+        throw new Error("SCALE_SMOOTH: not implemented");
       default:
-        throw new Error("not implemented");
+        throw new Error("Unknown flag or not implemented: " + flags);
     }
+
+    ImageProducer producer = new FilteredImageSource(getSource(), filter);
+    return Toolkit.getDefaultToolkit().createImage(producer);
   }
 
   /**
Index: java/awt/image/AreaAveragingScaleFilter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/image/AreaAveragingScaleFilter.java,v
retrieving revision 1.7
diff -u -r1.7 AreaAveragingScaleFilter.java
--- java/awt/image/AreaAveragingScaleFilter.java	21 Aug 2005 03:11:23 -0000	1.7
+++ java/awt/image/AreaAveragingScaleFilter.java	6 Nov 2005 22:13:52 -0000
@@ -45,7 +45,7 @@
  * points should give the desired results although Sun does not 
  * specify what the exact algorithm should be.
  * <br>
- * Currently this filter does nothing and needs to be implemented.
+ * FIXME: Currently this filter does nothing and needs to be implemented.
  *
  * @author C. Brian Jones ([EMAIL PROTECTED]) 
  */

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to