< prev index next >

src/java.desktop/share/classes/java/awt/geom/GeneralPath.java

Print this page




  43  * Use {@code Path2D.Float} (or this legacy {@code GeneralPath}
  44  * subclass) when dealing with data that can be represented
  45  * and used with floating point precision.  Use {@code Path2D.Double}
  46  * for data that requires the accuracy or range of double precision.
  47  *
  48  * @author Jim Graham
  49  * @since 1.2
  50  */
  51 public final class GeneralPath extends Path2D.Float {
  52     /**
  53      * Constructs a new empty single precision {@code GeneralPath} object
  54      * with a default winding rule of {@link #WIND_NON_ZERO}.
  55      *
  56      * @since 1.2
  57      */
  58     public GeneralPath() {
  59         super(WIND_NON_ZERO, INIT_SIZE);
  60     }
  61 
  62     /**
  63      * Constructs a new <code>GeneralPath</code> object with the specified
  64      * winding rule to control operations that require the interior of the
  65      * path to be defined.
  66      *
  67      * @param rule the winding rule
  68      * @see #WIND_EVEN_ODD
  69      * @see #WIND_NON_ZERO
  70      * @since 1.2
  71      */
  72     public GeneralPath(int rule) {
  73         super(rule, INIT_SIZE);
  74     }
  75 
  76     /**
  77      * Constructs a new <code>GeneralPath</code> object with the specified
  78      * winding rule and the specified initial capacity to store path
  79      * coordinates.
  80      * This number is an initial guess as to how many path segments
  81      * will be added to the path, but the storage is expanded as
  82      * needed to store whatever path segments are added.
  83      *
  84      * @param rule the winding rule
  85      * @param initialCapacity the estimate for the number of path segments
  86      *                        in the path
  87      * @see #WIND_EVEN_ODD
  88      * @see #WIND_NON_ZERO
  89      * @since 1.2
  90      */
  91     public GeneralPath(int rule, int initialCapacity) {
  92         super(rule, initialCapacity);
  93     }
  94 
  95     /**
  96      * Constructs a new <code>GeneralPath</code> object from an arbitrary
  97      * {@link Shape} object.
  98      * All of the initial geometry and the winding rule for this path are
  99      * taken from the specified <code>Shape</code> object.
 100      *
 101      * @param s the specified <code>Shape</code> object
 102      * @since 1.2
 103      */
 104     public GeneralPath(Shape s) {
 105         super(s, null);
 106     }
 107 
 108     GeneralPath(int windingRule,
 109                 byte[] pointTypes,
 110                 int numTypes,
 111                 float[] pointCoords,
 112                 int numCoords)
 113     {
 114         // used to construct from native
 115 
 116         this.windingRule = windingRule;
 117         this.pointTypes = pointTypes;
 118         this.numTypes = numTypes;
 119         this.floatCoords = pointCoords;
 120         this.numCoords = numCoords;
 121     }


  43  * Use {@code Path2D.Float} (or this legacy {@code GeneralPath}
  44  * subclass) when dealing with data that can be represented
  45  * and used with floating point precision.  Use {@code Path2D.Double}
  46  * for data that requires the accuracy or range of double precision.
  47  *
  48  * @author Jim Graham
  49  * @since 1.2
  50  */
  51 public final class GeneralPath extends Path2D.Float {
  52     /**
  53      * Constructs a new empty single precision {@code GeneralPath} object
  54      * with a default winding rule of {@link #WIND_NON_ZERO}.
  55      *
  56      * @since 1.2
  57      */
  58     public GeneralPath() {
  59         super(WIND_NON_ZERO, INIT_SIZE);
  60     }
  61 
  62     /**
  63      * Constructs a new {@code GeneralPath} object with the specified
  64      * winding rule to control operations that require the interior of the
  65      * path to be defined.
  66      *
  67      * @param rule the winding rule
  68      * @see #WIND_EVEN_ODD
  69      * @see #WIND_NON_ZERO
  70      * @since 1.2
  71      */
  72     public GeneralPath(int rule) {
  73         super(rule, INIT_SIZE);
  74     }
  75 
  76     /**
  77      * Constructs a new {@code GeneralPath} object with the specified
  78      * winding rule and the specified initial capacity to store path
  79      * coordinates.
  80      * This number is an initial guess as to how many path segments
  81      * will be added to the path, but the storage is expanded as
  82      * needed to store whatever path segments are added.
  83      *
  84      * @param rule the winding rule
  85      * @param initialCapacity the estimate for the number of path segments
  86      *                        in the path
  87      * @see #WIND_EVEN_ODD
  88      * @see #WIND_NON_ZERO
  89      * @since 1.2
  90      */
  91     public GeneralPath(int rule, int initialCapacity) {
  92         super(rule, initialCapacity);
  93     }
  94 
  95     /**
  96      * Constructs a new {@code GeneralPath} object from an arbitrary
  97      * {@link Shape} object.
  98      * All of the initial geometry and the winding rule for this path are
  99      * taken from the specified {@code Shape} object.
 100      *
 101      * @param s the specified {@code Shape} object
 102      * @since 1.2
 103      */
 104     public GeneralPath(Shape s) {
 105         super(s, null);
 106     }
 107 
 108     GeneralPath(int windingRule,
 109                 byte[] pointTypes,
 110                 int numTypes,
 111                 float[] pointCoords,
 112                 int numCoords)
 113     {
 114         // used to construct from native
 115 
 116         this.windingRule = windingRule;
 117         this.pointTypes = pointTypes;
 118         this.numTypes = numTypes;
 119         this.floatCoords = pointCoords;
 120         this.numCoords = numCoords;
 121     }
< prev index next >