Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4212743

Provide antialiased (i.e. soft edged) clipping

    XMLWordPrintable

Details

    • Enhancement
    • Status: Open
    • P5
    • Resolution: Unresolved
    • 1.2.0, 1.4.0
    • None
    • client-libs
    • 2d
    • Fix Understood
    • generic, x86
    • generic, windows_nt

    Description



      Name: gsC80088 Date: 02/18/99


      When an image or filled shape is clipped, it isn't antialiased along the clipping path. Here's a sample program illustrating the problem -- it draws a filled rectangle, clipped by an ellipse.

      import java.awt.*;
      import java.awt.geom.*;

      public class Clipper extends Canvas {

        public static void main(String args[]) {
          Canvas canvas = new Clipper();
          Frame frame = new Frame();
          frame.setSize(640, 480);
          frame.add("Center", canvas);
          frame.show();
        }

        public void paint(Graphics g) {
          Graphics2D g2d = (Graphics2D) g;
          g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
          g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
          g2d.setColor(Color.red);
          g2d.clip(new Ellipse2D.Float(100, 100, 300, 200));
          g2d.fillRect(100, 100, 300, 200);
        }
      }
      (Review ID: 54362)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gstone Greg Stone
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: