/android/LGame-Android-0.2.9/src/org/loon/framework/android/game/core/graphics/geom/GeneralPath.java

http://loon-simple.googlecode.com/ · Java · 122 lines · 24 code · 8 blank · 90 comment · 0 complexity · b14b844cbab5b69ca77939712c53e11f MD5 · raw file

  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. package org.loon.framework.android.game.core.graphics.geom;
  26. /**
  27. * The {@code GeneralPath} class represents a geometric path constructed from
  28. * straight lines, and quadratic and cubic (Bézier) curves. It can
  29. * contain multiple subpaths.
  30. * <p>
  31. * {@code GeneralPath} is a legacy final class which exactly implements the
  32. * behavior of its superclass {@link Path2D.Float}. Together with
  33. * {@link Path2D.Double}, the {@link Path2D} classes provide full
  34. * implementations of a general geometric path that support all of the
  35. * functionality of the {@link Shape} and {@link PathIterator} interfaces with
  36. * the ability to explicitly select different levels of internal coordinate
  37. * precision.
  38. * <p>
  39. * Use {@code Path2D.Float} (or this legacy {@code GeneralPath} subclass) when
  40. * dealing with data that can be represented and used with floating point
  41. * precision. Use {@code Path2D.Double} for data that requires the accuracy or
  42. * range of double precision.
  43. *
  44. * @author Jim Graham
  45. * @since 1.2
  46. */
  47. public final class GeneralPath extends Path2D.Float {
  48. /**
  49. * Constructs a new empty single precision {@code GeneralPath} object with a
  50. * default winding rule of {@link #WIND_NON_ZERO}.
  51. *
  52. * @since 1.2
  53. */
  54. public GeneralPath() {
  55. super(WIND_NON_ZERO, INIT_SIZE);
  56. }
  57. /**
  58. * Constructs a new <code>GeneralPath</code> object with the specified
  59. * winding rule to control operations that require the interior of the path
  60. * to be defined.
  61. *
  62. * @param rule
  63. * the winding rule
  64. * @see #WIND_EVEN_ODD
  65. * @see #WIND_NON_ZERO
  66. * @since 1.2
  67. */
  68. public GeneralPath(int rule) {
  69. super(rule, INIT_SIZE);
  70. }
  71. /**
  72. * Constructs a new <code>GeneralPath</code> object with the specified
  73. * winding rule and the specified initial capacity to store path
  74. * coordinates. This number is an initial guess as to how many path segments
  75. * will be added to the path, but the storage is expanded as needed to store
  76. * whatever path segments are added.
  77. *
  78. * @param rule
  79. * the winding rule
  80. * @param initialCapacity
  81. * the estimate for the number of path segments in the path
  82. * @see #WIND_EVEN_ODD
  83. * @see #WIND_NON_ZERO
  84. * @since 1.2
  85. */
  86. public GeneralPath(int rule, int initialCapacity) {
  87. super(rule, initialCapacity);
  88. }
  89. /**
  90. * Constructs a new <code>GeneralPath</code> object from an arbitrary
  91. * {@link Shape} object. All of the initial geometry and the winding rule
  92. * for this path are taken from the specified <code>Shape</code> object.
  93. *
  94. * @param s
  95. * the specified <code>Shape</code> object
  96. * @since 1.2
  97. */
  98. public GeneralPath(Shape s) {
  99. super(s, null);
  100. }
  101. GeneralPath(int windingRule, byte[] pointTypes, int numTypes,
  102. float[] pointCoords, int numCoords) {
  103. // used to construct from native
  104. this.windingRule = windingRule;
  105. this.pointTypes = pointTypes;
  106. this.numTypes = numTypes;
  107. this.floatCoords = pointCoords;
  108. this.numCoords = numCoords;
  109. }
  110. /*
  111. * JDK 1.6 serialVersionUID
  112. */
  113. private static final long serialVersionUID = -8327096662768731142L;
  114. }