Save This Page
Home » openjdk-7 » java » awt » geom » [javadoc | source]
    1   /*
    2    * Copyright 1996-2006 Sun Microsystems, Inc.  All Rights Reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   
   26   package java.awt.geom;
   27   
   28   import java.awt.Shape;
   29   
   30   /**
   31    * The {@code GeneralPath} class represents a geometric path
   32    * constructed from straight lines, and quadratic and cubic
   33    * (Bézier) curves.  It can contain multiple subpaths.
   34    * <p>
   35    * {@code GeneralPath} is a legacy final class which exactly
   36    * implements the behavior of its superclass {@link Path2D.Float}.
   37    * Together with {@link Path2D.Double}, the {@link Path2D} classes
   38    * provide full implementations of a general geometric path that
   39    * support all of the functionality of the {@link Shape} and
   40    * {@link PathIterator} interfaces with the ability to explicitly
   41    * select different levels of internal coordinate precision.
   42    * <p>
   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       }
  122   
  123       /*
  124        * JDK 1.6 serialVersionUID
  125        */
  126       private static final long serialVersionUID = -8327096662768731142L;
  127   }

Save This Page
Home » openjdk-7 » java » awt » geom » [javadoc | source]