< prev index next >

src/java.desktop/share/classes/sun/java2d/pisces/Stroker.java

Print this page




  82     private final float[] miter = new float[2];
  83     private final float miterLimitSq;
  84 
  85     private int prev;
  86 
  87     // The starting point of the path, and the slope there.
  88     private float sx0, sy0, sdx, sdy;
  89     // the current point and the slope there.
  90     private float cx0, cy0, cdx, cdy; // c stands for current
  91     // vectors that when added to (sx0,sy0) and (cx0,cy0) respectively yield the
  92     // first and last points on the left parallel path. Since this path is
  93     // parallel, it's slope at any point is parallel to the slope of the
  94     // original path (thought they may have different directions), so these
  95     // could be computed from sdx,sdy and cdx,cdy (and vice versa), but that
  96     // would be error prone and hard to read, so we keep these anyway.
  97     private float smx, smy, cmx, cmy;
  98 
  99     private final PolyStack reverse = new PolyStack();
 100 
 101     /**
 102      * Constructs a <code>Stroker</code>.
 103      *
 104      * @param pc2d an output <code>PathConsumer2D</code>.
 105      * @param lineWidth the desired line width in pixels
 106      * @param capStyle the desired end cap style, one of
 107      * <code>CAP_BUTT</code>, <code>CAP_ROUND</code> or
 108      * <code>CAP_SQUARE</code>.
 109      * @param joinStyle the desired line join style, one of
 110      * <code>JOIN_MITER</code>, <code>JOIN_ROUND</code> or
 111      * <code>JOIN_BEVEL</code>.
 112      * @param miterLimit the desired miter limit
 113      */
 114     public Stroker(PathConsumer2D pc2d,
 115                    float lineWidth,
 116                    int capStyle,
 117                    int joinStyle,
 118                    float miterLimit)
 119     {
 120         this.out = pc2d;
 121 
 122         this.lineWidth2 = lineWidth / 2;
 123         this.capStyle = capStyle;
 124         this.joinStyle = joinStyle;
 125 
 126         float limit = miterLimit * lineWidth2;
 127         this.miterLimitSq = limit*limit;
 128 
 129         this.prev = CLOSE;
 130     }
 131 




  82     private final float[] miter = new float[2];
  83     private final float miterLimitSq;
  84 
  85     private int prev;
  86 
  87     // The starting point of the path, and the slope there.
  88     private float sx0, sy0, sdx, sdy;
  89     // the current point and the slope there.
  90     private float cx0, cy0, cdx, cdy; // c stands for current
  91     // vectors that when added to (sx0,sy0) and (cx0,cy0) respectively yield the
  92     // first and last points on the left parallel path. Since this path is
  93     // parallel, it's slope at any point is parallel to the slope of the
  94     // original path (thought they may have different directions), so these
  95     // could be computed from sdx,sdy and cdx,cdy (and vice versa), but that
  96     // would be error prone and hard to read, so we keep these anyway.
  97     private float smx, smy, cmx, cmy;
  98 
  99     private final PolyStack reverse = new PolyStack();
 100 
 101     /**
 102      * Constructs a {@code Stroker}.
 103      *
 104      * @param pc2d an output {@code PathConsumer2D}.
 105      * @param lineWidth the desired line width in pixels
 106      * @param capStyle the desired end cap style, one of
 107      * {@code CAP_BUTT}, {@code CAP_ROUND} or
 108      * {@code CAP_SQUARE}.
 109      * @param joinStyle the desired line join style, one of
 110      * {@code JOIN_MITER}, {@code JOIN_ROUND} or
 111      * {@code JOIN_BEVEL}.
 112      * @param miterLimit the desired miter limit
 113      */
 114     public Stroker(PathConsumer2D pc2d,
 115                    float lineWidth,
 116                    int capStyle,
 117                    int joinStyle,
 118                    float miterLimit)
 119     {
 120         this.out = pc2d;
 121 
 122         this.lineWidth2 = lineWidth / 2;
 123         this.capStyle = capStyle;
 124         this.joinStyle = joinStyle;
 125 
 126         float limit = miterLimit * lineWidth2;
 127         this.miterLimitSq = limit*limit;
 128 
 129         this.prev = CLOSE;
 130     }
 131 


< prev index next >