src/share/classes/sun/java2d/pipe/PixelToShapeConverter.java

Print this page




  86 
  87     public void drawArc(SunGraphics2D sg,
  88                         int x, int y, int w, int h,
  89                         int start, int extent) {
  90         outpipe.draw(sg, new Arc2D.Float(x, y, w, h,
  91                                          start, extent, Arc2D.OPEN));
  92     }
  93 
  94     public void fillArc(SunGraphics2D sg,
  95                         int x, int y, int w, int h,
  96                         int start, int extent) {
  97         outpipe.fill(sg, new Arc2D.Float(x, y, w, h,
  98                                          start, extent, Arc2D.PIE));
  99     }
 100 
 101     private Shape makePoly(int xPoints[], int yPoints[],
 102                            int nPoints, boolean close) {
 103         GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
 104         if (nPoints > 0) {
 105             gp.moveTo(xPoints[0], yPoints[0]);
 106         }
 107         for (int i = 1; i < nPoints; i++) {
 108             gp.lineTo(xPoints[i], yPoints[i]);
 109         }
 110         if (close) {
 111             gp.closePath();

 112         }
 113         return gp;
 114     }
 115 
 116     public void drawPolyline(SunGraphics2D sg,
 117                              int xPoints[], int yPoints[],
 118                              int nPoints) {
 119         outpipe.draw(sg, makePoly(xPoints, yPoints, nPoints, false));
 120     }
 121 
 122     public void drawPolygon(SunGraphics2D sg,
 123                             int xPoints[], int yPoints[],
 124                             int nPoints) {
 125         outpipe.draw(sg, makePoly(xPoints, yPoints, nPoints, true));
 126     }
 127 
 128     public void fillPolygon(SunGraphics2D sg,
 129                             int xPoints[], int yPoints[],
 130                             int nPoints) {
 131         outpipe.fill(sg, makePoly(xPoints, yPoints, nPoints, true));


  86 
  87     public void drawArc(SunGraphics2D sg,
  88                         int x, int y, int w, int h,
  89                         int start, int extent) {
  90         outpipe.draw(sg, new Arc2D.Float(x, y, w, h,
  91                                          start, extent, Arc2D.OPEN));
  92     }
  93 
  94     public void fillArc(SunGraphics2D sg,
  95                         int x, int y, int w, int h,
  96                         int start, int extent) {
  97         outpipe.fill(sg, new Arc2D.Float(x, y, w, h,
  98                                          start, extent, Arc2D.PIE));
  99     }
 100 
 101     private Shape makePoly(int xPoints[], int yPoints[],
 102                            int nPoints, boolean close) {
 103         GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
 104         if (nPoints > 0) {
 105             gp.moveTo(xPoints[0], yPoints[0]);

 106             for (int i = 1; i < nPoints; i++) {
 107                 gp.lineTo(xPoints[i], yPoints[i]);
 108             }
 109             if (close) {
 110                 gp.closePath();
 111             }
 112         }
 113         return gp;
 114     }
 115 
 116     public void drawPolyline(SunGraphics2D sg,
 117                              int xPoints[], int yPoints[],
 118                              int nPoints) {
 119         outpipe.draw(sg, makePoly(xPoints, yPoints, nPoints, false));
 120     }
 121 
 122     public void drawPolygon(SunGraphics2D sg,
 123                             int xPoints[], int yPoints[],
 124                             int nPoints) {
 125         outpipe.draw(sg, makePoly(xPoints, yPoints, nPoints, true));
 126     }
 127 
 128     public void fillPolygon(SunGraphics2D sg,
 129                             int xPoints[], int yPoints[],
 130                             int nPoints) {
 131         outpipe.fill(sg, makePoly(xPoints, yPoints, nPoints, true));