OSDN Git Service

libjava/
[pf3gnuchains/gcc-fork.git] / libjava / classpath / java / awt / AlphaComposite.java
index 435cfd0..addd1e7 100644 (file)
@@ -1,5 +1,5 @@
 /* AlphaComposite.java -- provides a context for performing alpha compositing
-   Copyright (C) 2002, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +38,8 @@ exception statement from your version. */
 
 package java.awt;
 
+import gnu.java.awt.java2d.AlphaCompositeContext;
+
 import java.awt.image.ColorModel;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -60,7 +62,7 @@ public final class AlphaComposite implements Composite
 
     /** Prune stale entries. */
     protected boolean removeEldestEntry(Map.Entry eldest)
-    {  // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
+    {
       return size() > MAX_CACHE_SIZE;
     }
   };
@@ -137,14 +139,25 @@ public final class AlphaComposite implements Composite
       }
     return a;
   }
+
+  /**
+   * Creates a {@link CompositeContext} that can be used to perform
+   * compositing operations according to this AlphaComposite settings.
+   *
+   * @param srcColorModel the color model of the source raster
+   * @param dstColorModel the color model of the destination raster
+   * @param hints the rendering hints to use
+   *
+   * @return a {@link CompositeContext} that can be used to perform
+   *         compositing operations according to this AlphaComposite settings
+   */
   public CompositeContext createContext(ColorModel srcColorModel,
                                         ColorModel dstColorModel,
                                         RenderingHints hints)
   {
-    // XXX Implement. Sun uses undocumented implementation class
-    // sun.java2d.SunCompositeContext.
-    throw new Error("not implemented");
+    return new AlphaCompositeContext(this, srcColorModel, dstColorModel);
   }
+
   public float getAlpha()
   {
     return alpha;