src/java.desktop/share/classes/sun/java2d/loops/ProcessPath.java

Print this page




  28 import java.awt.geom.Path2D;
  29 import java.awt.geom.PathIterator;
  30 import java.awt.geom.QuadCurve2D;
  31 import sun.awt.SunHints;
  32 import java.util.*;
  33 
  34 /* This is the java implementation of the native code from
  35  * src/share/native/sun/java2d/loops/ProcessPath.[c,h]
  36  * This code is written to be as much similar to the native
  37  * as it possible. So, it sometimes does not follow java naming conventions.
  38  *
  39  * It's important to keep this code synchronized with native one.  See more
  40  * comments, description and high level scheme of the rendering process in the
  41  * ProcessPath.c
  42  */
  43 
  44 public class ProcessPath {
  45 
  46     /* Public interfaces and methods for drawing and filling general paths */
  47 
  48     public static abstract class DrawHandler {
  49         public int xMin;
  50         public int yMin;
  51         public int xMax;
  52         public int yMax;
  53         public float xMinf;
  54         public float yMinf;
  55         public float xMaxf;
  56         public float yMaxf;
  57 
  58         public int strokeControl;
  59 
  60         public DrawHandler(int xMin, int yMin, int xMax, int yMax,
  61                            int strokeControl)
  62         {
  63             setBounds(xMin, yMin, xMax, yMax, strokeControl);
  64         }
  65 
  66         public void setBounds(int xMin, int yMin, int xMax, int yMax)
  67         {
  68             this.xMin = xMin;


 104         }
 105 
 106         public DrawHandler(int xMin, int yMin, int xMax, int yMax) {
 107             this(xMin, yMin, xMax, yMax, SunHints.INTVAL_STROKE_DEFAULT);
 108         }
 109 
 110         public abstract void drawLine(int x0, int y0, int x1, int y1);
 111 
 112         public abstract void drawPixel(int x0, int y0);
 113 
 114         public abstract void drawScanline(int x0, int x1, int y0);
 115     }
 116 
 117     public interface EndSubPathHandler {
 118         public void processEndSubPath();
 119     }
 120 
 121     public static final int PH_MODE_DRAW_CLIP = 0;
 122     public static final int PH_MODE_FILL_CLIP = 1;
 123 
 124     public static abstract class ProcessHandler implements EndSubPathHandler {
 125         DrawHandler dhnd;
 126         int clipMode;
 127 
 128         public ProcessHandler(DrawHandler dhnd,
 129                               int clipMode) {
 130             this.dhnd = dhnd;
 131             this.clipMode = clipMode;
 132         }
 133 
 134         public abstract void processFixedLine(int x1, int y1,
 135                                               int x2, int y2, int [] pixelInfo,
 136                                               boolean checkBounds,
 137                                               boolean endSubPath);
 138     }
 139 
 140     public static EndSubPathHandler noopEndSubPathHandler =
 141         new EndSubPathHandler() {
 142             public void processEndSubPath() { }
 143         };
 144 




  28 import java.awt.geom.Path2D;
  29 import java.awt.geom.PathIterator;
  30 import java.awt.geom.QuadCurve2D;
  31 import sun.awt.SunHints;
  32 import java.util.*;
  33 
  34 /* This is the java implementation of the native code from
  35  * src/share/native/sun/java2d/loops/ProcessPath.[c,h]
  36  * This code is written to be as much similar to the native
  37  * as it possible. So, it sometimes does not follow java naming conventions.
  38  *
  39  * It's important to keep this code synchronized with native one.  See more
  40  * comments, description and high level scheme of the rendering process in the
  41  * ProcessPath.c
  42  */
  43 
  44 public class ProcessPath {
  45 
  46     /* Public interfaces and methods for drawing and filling general paths */
  47 
  48     public abstract static class DrawHandler {
  49         public int xMin;
  50         public int yMin;
  51         public int xMax;
  52         public int yMax;
  53         public float xMinf;
  54         public float yMinf;
  55         public float xMaxf;
  56         public float yMaxf;
  57 
  58         public int strokeControl;
  59 
  60         public DrawHandler(int xMin, int yMin, int xMax, int yMax,
  61                            int strokeControl)
  62         {
  63             setBounds(xMin, yMin, xMax, yMax, strokeControl);
  64         }
  65 
  66         public void setBounds(int xMin, int yMin, int xMax, int yMax)
  67         {
  68             this.xMin = xMin;


 104         }
 105 
 106         public DrawHandler(int xMin, int yMin, int xMax, int yMax) {
 107             this(xMin, yMin, xMax, yMax, SunHints.INTVAL_STROKE_DEFAULT);
 108         }
 109 
 110         public abstract void drawLine(int x0, int y0, int x1, int y1);
 111 
 112         public abstract void drawPixel(int x0, int y0);
 113 
 114         public abstract void drawScanline(int x0, int x1, int y0);
 115     }
 116 
 117     public interface EndSubPathHandler {
 118         public void processEndSubPath();
 119     }
 120 
 121     public static final int PH_MODE_DRAW_CLIP = 0;
 122     public static final int PH_MODE_FILL_CLIP = 1;
 123 
 124     public abstract static class ProcessHandler implements EndSubPathHandler {
 125         DrawHandler dhnd;
 126         int clipMode;
 127 
 128         public ProcessHandler(DrawHandler dhnd,
 129                               int clipMode) {
 130             this.dhnd = dhnd;
 131             this.clipMode = clipMode;
 132         }
 133 
 134         public abstract void processFixedLine(int x1, int y1,
 135                                               int x2, int y2, int [] pixelInfo,
 136                                               boolean checkBounds,
 137                                               boolean endSubPath);
 138     }
 139 
 140     public static EndSubPathHandler noopEndSubPathHandler =
 141         new EndSubPathHandler() {
 142             public void processEndSubPath() { }
 143         };
 144