propane 3.4.0-java → 3.7.0.pre-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -2
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +2 -2
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -2
  5. data/.travis.yml +2 -2
  6. data/CHANGELOG.md +12 -0
  7. data/Gemfile +2 -0
  8. data/README.md +17 -8
  9. data/Rakefile +10 -11
  10. data/bin/propane +3 -1
  11. data/lib/propane.rb +6 -4
  12. data/lib/propane/app.rb +20 -10
  13. data/lib/propane/creators/sketch_class.rb +7 -1
  14. data/lib/propane/creators/sketch_factory.rb +4 -2
  15. data/lib/propane/creators/sketch_writer.rb +1 -0
  16. data/lib/propane/helper_methods.rb +23 -24
  17. data/lib/propane/helpers/numeric.rb +2 -0
  18. data/lib/propane/helpers/version_error.rb +1 -0
  19. data/lib/propane/library.rb +5 -1
  20. data/lib/propane/library_loader.rb +2 -0
  21. data/lib/propane/native_folder.rb +10 -9
  22. data/lib/propane/native_loader.rb +3 -0
  23. data/lib/propane/runner.rb +14 -6
  24. data/lib/propane/version.rb +2 -1
  25. data/library/boids/boids.rb +21 -11
  26. data/library/color_group/color_group.rb +28 -0
  27. data/library/control_panel/control_panel.rb +8 -5
  28. data/library/dxf/dxf.rb +6 -0
  29. data/library/file_chooser/chooser.rb +10 -9
  30. data/library/file_chooser/file_chooser.rb +10 -9
  31. data/library/library_proxy/library_proxy.rb +2 -0
  32. data/library/net/net.rb +7 -0
  33. data/library/simplex_noise/simplex_noise.rb +2 -0
  34. data/library/slider/slider.rb +23 -22
  35. data/library/vector_utils/vector_utils.rb +4 -0
  36. data/library/video_event/video_event.rb +4 -1
  37. data/pom.rb +37 -36
  38. data/pom.xml +7 -7
  39. data/propane.gemspec +16 -12
  40. data/src/main/java/monkstone/ColorUtil.java +13 -1
  41. data/src/main/java/monkstone/MathToolModule.java +253 -203
  42. data/src/main/java/monkstone/PropaneLibrary.java +2 -2
  43. data/src/main/java/monkstone/fastmath/Deglut.java +1 -1
  44. data/src/main/java/monkstone/filechooser/Chooser.java +2 -1
  45. data/src/main/java/monkstone/noise/SimplexNoise.java +2 -2
  46. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  47. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  48. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  49. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  50. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  51. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  52. data/src/main/java/monkstone/slider/WheelHandler.java +7 -6
  53. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  54. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
  55. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +3 -3
  56. data/src/main/java/monkstone/videoevent/CaptureEvent.java +27 -0
  57. data/src/main/java/monkstone/videoevent/{VideoInterface.java → MovieEvent.java} +11 -27
  58. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  59. data/src/main/java/processing/awt/PGraphicsJava2D.java +781 -285
  60. data/src/main/java/processing/awt/PImageAWT.java +377 -0
  61. data/src/main/java/processing/awt/PShapeJava2D.java +56 -52
  62. data/src/main/java/processing/awt/PSurfaceAWT.java +309 -209
  63. data/src/main/java/processing/awt/ShimAWT.java +581 -0
  64. data/src/main/java/processing/core/PApplet.java +4510 -4503
  65. data/src/main/java/processing/core/PConstants.java +477 -447
  66. data/src/main/java/processing/core/PFont.java +914 -880
  67. data/src/main/java/processing/core/PGraphics.java +193 -177
  68. data/src/main/java/processing/core/PImage.java +611 -309
  69. data/src/main/java/processing/core/PMatrix.java +172 -159
  70. data/src/main/java/processing/core/PMatrix2D.java +478 -415
  71. data/src/main/java/processing/core/PMatrix3D.java +762 -735
  72. data/src/main/java/processing/core/PShape.java +2888 -2652
  73. data/src/main/java/processing/core/PShapeOBJ.java +97 -92
  74. data/src/main/java/processing/core/PShapeSVG.java +1705 -1490
  75. data/src/main/java/processing/core/PStyle.java +40 -37
  76. data/src/main/java/processing/core/PSurface.java +139 -97
  77. data/src/main/java/processing/core/PSurfaceNone.java +296 -218
  78. data/src/main/java/processing/core/PVector.java +997 -965
  79. data/src/main/java/processing/core/ThinkDifferent.java +15 -13
  80. data/src/main/java/processing/data/DoubleDict.java +756 -710
  81. data/src/main/java/processing/data/DoubleList.java +749 -696
  82. data/src/main/java/processing/data/FloatDict.java +748 -702
  83. data/src/main/java/processing/data/FloatList.java +751 -697
  84. data/src/main/java/processing/data/IntDict.java +720 -673
  85. data/src/main/java/processing/data/IntList.java +699 -633
  86. data/src/main/java/processing/data/JSONArray.java +931 -873
  87. data/src/main/java/processing/data/JSONObject.java +1262 -1165
  88. data/src/main/java/processing/data/JSONTokener.java +351 -341
  89. data/src/main/java/processing/data/LongDict.java +710 -663
  90. data/src/main/java/processing/data/LongList.java +701 -635
  91. data/src/main/java/processing/data/Sort.java +37 -41
  92. data/src/main/java/processing/data/StringDict.java +525 -486
  93. data/src/main/java/processing/data/StringList.java +626 -580
  94. data/src/main/java/processing/data/Table.java +3690 -3510
  95. data/src/main/java/processing/data/TableRow.java +182 -183
  96. data/src/main/java/processing/data/XML.java +957 -883
  97. data/src/main/java/processing/dxf/RawDXF.java +404 -0
  98. data/src/main/java/processing/event/Event.java +87 -67
  99. data/src/main/java/processing/event/KeyEvent.java +48 -41
  100. data/src/main/java/processing/event/MouseEvent.java +88 -113
  101. data/src/main/java/processing/event/TouchEvent.java +10 -6
  102. data/src/main/java/processing/javafx/PGraphicsFX2D.java +20 -345
  103. data/src/main/java/processing/javafx/PSurfaceFX.java +149 -121
  104. data/src/main/java/processing/net/Client.java +744 -0
  105. data/src/main/java/processing/net/Server.java +388 -0
  106. data/src/main/java/processing/opengl/FontTexture.java +289 -270
  107. data/src/main/java/processing/opengl/FrameBuffer.java +386 -364
  108. data/src/main/java/processing/opengl/LinePath.java +547 -500
  109. data/src/main/java/processing/opengl/LineStroker.java +588 -581
  110. data/src/main/java/processing/opengl/PGL.java +3047 -2914
  111. data/src/main/java/processing/opengl/PGraphics2D.java +408 -315
  112. data/src/main/java/processing/opengl/PGraphics3D.java +107 -72
  113. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12378 -12075
  114. data/src/main/java/processing/opengl/PJOGL.java +1753 -1670
  115. data/src/main/java/processing/opengl/PShader.java +1266 -1257
  116. data/src/main/java/processing/opengl/PShapeOpenGL.java +4678 -4580
  117. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1114 -1027
  118. data/src/main/java/processing/opengl/Texture.java +1492 -1401
  119. data/src/main/java/processing/opengl/VertexBuffer.java +57 -55
  120. data/test/create_test.rb +21 -20
  121. data/test/deglut_spec_test.rb +4 -2
  122. data/test/helper_methods_test.rb +49 -20
  123. data/test/math_tool_test.rb +39 -32
  124. data/test/native_folder.rb +47 -0
  125. data/test/respond_to_test.rb +3 -2
  126. data/test/sketches/key_event.rb +2 -2
  127. data/test/sketches/library/my_library/my_library.rb +3 -0
  128. data/test/test_helper.rb +2 -0
  129. data/test/vecmath_spec_test.rb +35 -22
  130. data/vendors/Rakefile +33 -62
  131. metadata +56 -48
  132. data/src/main/java/processing/core/util/image/ImageLoadFacade.java +0 -161
  133. data/src/main/java/processing/core/util/image/ImageSaveFacade.java +0 -169
  134. data/src/main/java/processing/core/util/image/constants/TifConstants.java +0 -45
  135. data/src/main/java/processing/core/util/image/load/AwtImageLoadStrategy.java +0 -80
  136. data/src/main/java/processing/core/util/image/load/Base64StringImageLoadStrategy.java +0 -73
  137. data/src/main/java/processing/core/util/image/load/FallbackImageLoadStrategy.java +0 -70
  138. data/src/main/java/processing/core/util/image/load/ImageIoImageLoadStrategy.java +0 -132
  139. data/src/main/java/processing/core/util/image/load/ImageLoadStrategy.java +0 -48
  140. data/src/main/java/processing/core/util/image/load/ImageLoadUtil.java +0 -45
  141. data/src/main/java/processing/core/util/image/load/TgaImageLoadStrategy.java +0 -255
  142. data/src/main/java/processing/core/util/image/load/TiffImageLoadStrategy.java +0 -98
  143. data/src/main/java/processing/core/util/image/save/ImageSaveStrategy.java +0 -49
  144. data/src/main/java/processing/core/util/image/save/ImageSaveUtil.java +0 -48
  145. data/src/main/java/processing/core/util/image/save/ImageWriterImageSaveStrategy.java +0 -179
  146. data/src/main/java/processing/core/util/image/save/SaveImageException.java +0 -41
  147. data/src/main/java/processing/core/util/image/save/TgaImageSaveStrategy.java +0 -198
  148. data/src/main/java/processing/core/util/image/save/TiffImageSaveStrategy.java +0 -91
  149. data/src/main/java/processing/core/util/image/save/TiffNakedFilenameImageSaveStrategy.java +0 -57
  150. data/src/main/java/processing/core/util/io/InputFactory.java +0 -285
  151. data/src/main/java/processing/core/util/io/PathUtil.java +0 -109
  152. data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
  153. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
  154. data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
  155. data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
@@ -1,3 +1,5 @@
1
+ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
+
1
3
  /*
2
4
  * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
3
5
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -22,559 +24,604 @@
22
24
  * CA 95054 USA or visit www.sun.com if you need additional information or
23
25
  * have any questions.
24
26
  */
27
+
25
28
  package processing.opengl;
26
29
 
27
30
  import processing.core.PMatrix2D;
28
31
 
29
32
  /**
30
- * The {@code LinePath} class allows to represent polygonal paths, potentially
31
- * composed by several disjoint polygonal segments. It can be iterated by the
32
- * {@link PathIterator} class including all of its segment types and winding
33
- * rules
33
+ * The {@code LinePath} class allows to represent polygonal paths,
34
+ * potentially composed by several disjoint polygonal segments.
35
+ * It can be iterated by the {@link PathIterator} class including all
36
+ * of its segment types and winding rules
34
37
  *
35
38
  */
36
39
  public class LinePath {
37
-
38
- /**
39
- * The winding rule constant for specifying an even-odd rule for determining
40
- * the interior of a path. The even-odd rule specifies that a point lies
41
- * inside the path if a ray drawn in any direction from that point to
42
- * infinity is crossed by path segments an odd number of times.
43
- */
44
- public static final int WIND_EVEN_ODD = 0;
45
-
46
- /**
47
- * The winding rule constant for specifying a non-zero rule for determining
48
- * the interior of a path. The non-zero rule specifies that a point lies
49
- * inside the path if a ray drawn in any direction from that point to
50
- * infinity is crossed by path segments a different number of times in the
51
- * counter-clockwise direction than the clockwise direction.
52
- */
53
- public static final int WIND_NON_ZERO = 1;
54
-
55
- /**
56
- * Starts segment at a given position.
57
- */
58
- public static final byte SEG_MOVETO = 0;
59
-
60
- /**
61
- * Extends segment by adding a line to a given position.
62
- */
63
- public static final byte SEG_LINETO = 1;
64
-
65
- /**
66
- * Closes segment at current position.
67
- */
68
- public static final byte SEG_CLOSE = 2;
69
-
70
- /**
71
- * Joins path segments by extending their outside edges until they meet.
72
- */
73
- public final static int JOIN_MITER = 0;
74
-
75
- /**
76
- * Joins path segments by rounding off the corner at a radius of half the
77
- * line width.
78
- */
79
- public final static int JOIN_ROUND = 1;
80
-
81
- /**
82
- * Joins path segments by connecting the outer corners of their wide
83
- * outlines with a straight segment.
84
- */
85
- public final static int JOIN_BEVEL = 2;
86
-
87
- /**
88
- * Ends unclosed subpaths and dash segments with no added decoration.
89
- */
90
- public final static int CAP_BUTT = 0;
91
-
92
- /**
93
- * Ends unclosed subpaths and dash segments with a round decoration that has
94
- * a radius equal to half of the width of the pen.
95
- */
96
- public final static int CAP_ROUND = 1;
97
-
98
- /**
99
- * Ends unclosed subpaths and dash segments with a square projection that
100
- * extends beyond the end of the segment to a distance equal to half of the
101
- * line width.
102
- */
103
- public final static int CAP_SQUARE = 2;
104
-
105
- private static PMatrix2D identity = new PMatrix2D();
106
-
107
- private static float defaultMiterlimit = 10.0f;
108
-
109
- static final int INIT_SIZE = 20;
110
-
111
- static final int EXPAND_MAX = 500;
112
-
113
- protected byte[] pointTypes;
114
-
115
- protected float[] floatCoords;
116
-
117
- protected int[] pointColors;
118
-
119
- protected int numTypes;
120
-
121
- protected int numCoords;
122
-
123
- protected int windingRule;
124
-
125
- /**
126
- * Constructs a new empty single precision {@code LinePath} object with a
127
- * default winding rule of {@link #WIND_NON_ZERO}.
128
- */
129
- public LinePath() {
130
- this(WIND_NON_ZERO, INIT_SIZE);
40
+ /**
41
+ * The winding rule constant for specifying an even-odd rule
42
+ * for determining the interior of a path.
43
+ * The even-odd rule specifies that a point lies inside the
44
+ * path if a ray drawn in any direction from that point to
45
+ * infinity is crossed by path segments an odd number of times.
46
+ */
47
+ public static final int WIND_EVEN_ODD = 0;
48
+
49
+ /**
50
+ * The winding rule constant for specifying a non-zero rule
51
+ * for determining the interior of a path.
52
+ * The non-zero rule specifies that a point lies inside the
53
+ * path if a ray drawn in any direction from that point to
54
+ * infinity is crossed by path segments a different number
55
+ * of times in the counter-clockwise direction than the
56
+ * clockwise direction.
57
+ */
58
+ public static final int WIND_NON_ZERO = 1;
59
+
60
+ /**
61
+ * Starts segment at a given position.
62
+ */
63
+ public static final byte SEG_MOVETO = 0;
64
+
65
+ /**
66
+ * Extends segment by adding a line to a given position.
67
+ */
68
+ public static final byte SEG_LINETO = 1;
69
+
70
+ /**
71
+ * Closes segment at current position.
72
+ */
73
+ public static final byte SEG_CLOSE = 2;
74
+
75
+ /**
76
+ * Joins path segments by extending their outside edges until they meet.
77
+ */
78
+ public final static int JOIN_MITER = 0;
79
+
80
+ /**
81
+ * Joins path segments by rounding off the corner at a radius of half the line
82
+ * width.
83
+ */
84
+ public final static int JOIN_ROUND = 1;
85
+
86
+ /**
87
+ * Joins path segments by connecting the outer corners of their wide outlines
88
+ * with a straight segment.
89
+ */
90
+ public final static int JOIN_BEVEL = 2;
91
+
92
+ /**
93
+ * Ends unclosed subpaths and dash segments with no added decoration.
94
+ */
95
+ public final static int CAP_BUTT = 0;
96
+
97
+ /**
98
+ * Ends unclosed subpaths and dash segments with a round decoration that has a
99
+ * radius equal to half of the width of the pen.
100
+ */
101
+ public final static int CAP_ROUND = 1;
102
+
103
+ /**
104
+ * Ends unclosed subpaths and dash segments with a square projection that
105
+ * extends beyond the end of the segment to a distance equal to half of the
106
+ * line width.
107
+ */
108
+ public final static int CAP_SQUARE = 2;
109
+
110
+ private static PMatrix2D identity = new PMatrix2D();
111
+
112
+ private static float defaultMiterlimit = 10.0f;
113
+
114
+ static final int INIT_SIZE = 20;
115
+
116
+ static final int EXPAND_MAX = 500;
117
+
118
+ protected byte[] pointTypes;
119
+
120
+ protected float[] floatCoords;
121
+
122
+ protected int[] pointColors;
123
+
124
+ protected int numTypes;
125
+
126
+ protected int numCoords;
127
+
128
+ protected int windingRule;
129
+
130
+
131
+ /**
132
+ * Constructs a new empty single precision {@code LinePath} object with a
133
+ * default winding rule of {@link #WIND_NON_ZERO}.
134
+ */
135
+ public LinePath() {
136
+ this(WIND_NON_ZERO, INIT_SIZE);
137
+ }
138
+
139
+
140
+ /**
141
+ * Constructs a new empty single precision {@code LinePath} object with the
142
+ * specified winding rule to control operations that require the interior of
143
+ * the path to be defined.
144
+ *
145
+ * @param rule
146
+ * the winding rule
147
+ * @see #WIND_EVEN_ODD
148
+ * @see #WIND_NON_ZERO
149
+ */
150
+ public LinePath(int rule) {
151
+ this(rule, INIT_SIZE);
152
+ }
153
+
154
+
155
+ /**
156
+ * Constructs a new {@code LinePath} object from the given specified initial
157
+ * values. This method is only intended for internal use and should not be
158
+ * made public if the other constructors for this class are ever exposed.
159
+ *
160
+ * @param rule
161
+ * the winding rule
162
+ * @param initialCapacity
163
+ * the size to make the initial array to store the path segment types
164
+ */
165
+ public LinePath(int rule, int initialCapacity) {
166
+ setWindingRule(rule);
167
+ this.pointTypes = new byte[initialCapacity];
168
+ floatCoords = new float[initialCapacity * 2];
169
+ pointColors = new int[initialCapacity];
170
+ }
171
+
172
+
173
+ void needRoom(boolean needMove, int newPoints) {
174
+ if (needMove && numTypes == 0) {
175
+ throw new RuntimeException("missing initial moveto "
176
+ + "in path definition");
131
177
  }
132
-
133
- /**
134
- * Constructs a new empty single precision {@code LinePath} object with the
135
- * specified winding rule to control operations that require the interior of
136
- * the path to be defined.
137
- *
138
- * @param rule the winding rule
139
- * @see #WIND_EVEN_ODD
140
- * @see #WIND_NON_ZERO
141
- */
142
- public LinePath(int rule) {
143
- this(rule, INIT_SIZE);
178
+ int size = pointTypes.length;
179
+ if (numTypes >= size) {
180
+ int grow = size;
181
+ if (grow > EXPAND_MAX) {
182
+ grow = EXPAND_MAX;
183
+ }
184
+ pointTypes = copyOf(pointTypes, size + grow);
144
185
  }
145
-
146
- /**
147
- * Constructs a new {@code LinePath} object from the given specified initial
148
- * values. This method is only intended for internal use and should not be
149
- * made public if the other constructors for this class are ever exposed.
150
- *
151
- * @param rule the winding rule
152
- * @param initialCapacity the size to make the initial array to store the
153
- * path segment types
154
- */
155
- public LinePath(int rule, int initialCapacity) {
156
- setWindingRule(rule);
157
- this.pointTypes = new byte[initialCapacity];
158
- floatCoords = new float[initialCapacity * 2];
159
- pointColors = new int[initialCapacity];
186
+ size = floatCoords.length;
187
+ if (numCoords + newPoints * 2 > size) {
188
+ int grow = size;
189
+ if (grow > EXPAND_MAX * 2) {
190
+ grow = EXPAND_MAX * 2;
191
+ }
192
+ if (grow < newPoints * 2) {
193
+ grow = newPoints * 2;
194
+ }
195
+ floatCoords = copyOf(floatCoords, size + grow);
160
196
  }
161
-
162
- void needRoom(boolean needMove, int newPoints) {
163
- if (needMove && numTypes == 0) {
164
- throw new RuntimeException("missing initial moveto "
165
- + "in path definition");
166
- }
167
- int size = pointTypes.length;
168
- if (numTypes >= size) {
169
- int grow = size;
170
- if (grow > EXPAND_MAX) {
171
- grow = EXPAND_MAX;
172
- }
173
- pointTypes = copyOf(pointTypes, size + grow);
174
- }
175
- size = floatCoords.length;
176
- if (numCoords + newPoints * 2 > size) {
177
- int grow = size;
178
- if (grow > EXPAND_MAX * 2) {
179
- grow = EXPAND_MAX * 2;
180
- }
181
- if (grow < newPoints * 2) {
182
- grow = newPoints * 2;
183
- }
184
- floatCoords = copyOf(floatCoords, size + grow);
185
- }
186
- size = pointColors.length;
187
- if (numCoords / 2 + newPoints > size) {
188
- int grow = size;
189
- if (grow > EXPAND_MAX) {
190
- grow = EXPAND_MAX;
191
- }
192
- if (grow < newPoints) {
193
- grow = newPoints;
194
- }
195
- pointColors = copyOf(pointColors, size + grow);
196
- }
197
+ size = pointColors.length;
198
+ if (numCoords/2 + newPoints > size) {
199
+ int grow = size;
200
+ if (grow > EXPAND_MAX) {
201
+ grow = EXPAND_MAX;
202
+ }
203
+ if (grow < newPoints) {
204
+ grow = newPoints;
205
+ }
206
+ pointColors = copyOf(pointColors, size + grow);
197
207
  }
198
-
199
- /**
200
- * Adds a point to the path by moving to the specified coordinates specified
201
- * in float precision.
202
- * <p>
203
- * This method provides a single precision variant of the double precision
204
- * {@code moveTo()} method on the base {@code LinePath} class.
205
- *
206
- * @param x the specified X coordinate
207
- * @param y the specified Y coordinate
208
- * @see LinePath#moveTo
209
- */
210
- public final void moveTo(float x, float y, int c) {
211
- if (numTypes > 0 && pointTypes[numTypes - 1] == SEG_MOVETO) {
212
- floatCoords[numCoords - 2] = x;
213
- floatCoords[numCoords - 1] = y;
214
- pointColors[numCoords / 2 - 1] = c;
215
- } else {
216
- needRoom(false, 1);
217
- pointTypes[numTypes++] = SEG_MOVETO;
218
- floatCoords[numCoords++] = x;
219
- floatCoords[numCoords++] = y;
220
- pointColors[numCoords / 2 - 1] = c;
221
- }
208
+ }
209
+
210
+
211
+ /**
212
+ * Adds a point to the path by moving to the specified coordinates specified
213
+ * in float precision.
214
+ * <p>
215
+ * This method provides a single precision variant of the double precision
216
+ * {@code moveTo()} method on the base {@code LinePath} class.
217
+ *
218
+ * @param x
219
+ * the specified X coordinate
220
+ * @param y
221
+ * the specified Y coordinate
222
+ * @param c
223
+ * @see LinePath#moveTo
224
+ */
225
+ public final void moveTo(float x, float y, int c) {
226
+ if (numTypes > 0 && pointTypes[numTypes - 1] == SEG_MOVETO) {
227
+ floatCoords[numCoords - 2] = x;
228
+ floatCoords[numCoords - 1] = y;
229
+ pointColors[numCoords/2-1] = c;
230
+ } else {
231
+ needRoom(false, 1);
232
+ pointTypes[numTypes++] = SEG_MOVETO;
233
+ floatCoords[numCoords++] = x;
234
+ floatCoords[numCoords++] = y;
235
+ pointColors[numCoords/2-1] = c;
236
+ }
237
+ }
238
+
239
+
240
+ /**
241
+ * Adds a point to the path by drawing a straight line from the current
242
+ * coordinates to the new specified coordinates specified in float precision.
243
+ * <p>
244
+ * This method provides a single precision variant of the double precision
245
+ * {@code lineTo()} method on the base {@code LinePath} class.
246
+ *
247
+ * @param x
248
+ * the specified X coordinate
249
+ * @param y
250
+ * the specified Y coordinate
251
+ * @param c
252
+ * @see LinePath#lineTo
253
+ */
254
+ public final void lineTo(float x, float y, int c) {
255
+ needRoom(true, 1);
256
+ pointTypes[numTypes++] = SEG_LINETO;
257
+ floatCoords[numCoords++] = x;
258
+ floatCoords[numCoords++] = y;
259
+ pointColors[numCoords/2-1] = c;
260
+ }
261
+
262
+
263
+ /**
264
+ * The iterator for this class is not multi-threaded safe, which means that
265
+ * the {@code LinePath} class does not guarantee that modifications to the
266
+ * geometry of this {@code LinePath} object do not affect any iterations of that
267
+ * geometry that are already in process.
268
+ * @return
269
+ */
270
+ public PathIterator getPathIterator() {
271
+ return new PathIterator(this);
272
+ }
273
+
274
+
275
+ /**
276
+ * Closes the current subpath by drawing a straight line back to the
277
+ * coordinates of the last {@code moveTo}. If the path is already closed then
278
+ * this method has no effect.
279
+ */
280
+ public final void closePath() {
281
+ if (numTypes == 0 || pointTypes[numTypes - 1] != SEG_CLOSE) {
282
+ needRoom(false, 0);
283
+ pointTypes[numTypes++] = SEG_CLOSE;
284
+ }
285
+ }
286
+
287
+
288
+ /**
289
+ * Returns the fill style winding rule.
290
+ *
291
+ * @return an integer representing the current winding rule.
292
+ * @see #WIND_EVEN_ODD
293
+ * @see #WIND_NON_ZERO
294
+ * @see #setWindingRule
295
+ */
296
+ public final int getWindingRule() {
297
+ return windingRule;
298
+ }
299
+
300
+
301
+ /**
302
+ * Sets the winding rule for this path to the specified value.
303
+ *
304
+ * @param rule
305
+ * an integer representing the specified winding rule
306
+ * @exception IllegalArgumentException
307
+ * if {@code rule} is not either {@link #WIND_EVEN_ODD} or
308
+ * {@link #WIND_NON_ZERO}
309
+ * @see #getWindingRule
310
+ */
311
+ public final void setWindingRule(int rule) {
312
+ if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO) {
313
+ throw new IllegalArgumentException("winding rule must be "
314
+ + "WIND_EVEN_ODD or " + "WIND_NON_ZERO");
222
315
  }
316
+ windingRule = rule;
317
+ }
223
318
 
224
- /**
225
- * Adds a point to the path by drawing a straight line from the current
226
- * coordinates to the new specified coordinates specified in float
227
- * precision.
228
- * <p>
229
- * This method provides a single precision variant of the double precision
230
- * {@code lineTo()} method on the base {@code LinePath} class.
231
- *
232
- * @param x the specified X coordinate
233
- * @param y the specified Y coordinate
234
- * @see LinePath#lineTo
235
- */
236
- public final void lineTo(float x, float y, int c) {
237
- needRoom(true, 1);
238
- pointTypes[numTypes++] = SEG_LINETO;
239
- floatCoords[numCoords++] = x;
240
- floatCoords[numCoords++] = y;
241
- pointColors[numCoords / 2 - 1] = c;
319
+
320
+ /**
321
+ * Resets the path to empty. The append position is set back to the beginning
322
+ * of the path and all coordinates and point types are forgotten.
323
+ */
324
+ public final void reset() {
325
+ numTypes = numCoords = 0;
326
+ }
327
+
328
+
329
+ static public class PathIterator {
330
+ float[] floatCoords;
331
+
332
+ int typeIdx;
333
+
334
+ int pointIdx;
335
+
336
+ int colorIdx;
337
+
338
+ LinePath path;
339
+
340
+ static final int[] curvecoords = { 2, 2, 0 };
341
+
342
+ PathIterator(LinePath p2df) {
343
+ this.path = p2df;
344
+ this.floatCoords = p2df.floatCoords;
345
+ pointIdx = 0;
346
+ colorIdx = 0;
242
347
  }
243
348
 
244
- /**
245
- * The iterator for this class is not multi-threaded safe, which means that
246
- * the {@code LinePath} class does not guarantee that modifications to the
247
- * geometry of this {@code LinePath} object do not affect any iterations of
248
- * that geometry that are already in process.
249
- */
250
- public PathIterator getPathIterator() {
251
- return new PathIterator(this);
349
+ public int currentSegment(float[] coords) {
350
+ int type = path.pointTypes[typeIdx];
351
+ int numCoords = curvecoords[type];
352
+ if (numCoords > 0) {
353
+ System.arraycopy(floatCoords, pointIdx, coords, 0, numCoords);
354
+ int color = path.pointColors[colorIdx];
355
+ coords[numCoords + 0] = (color >> 24) & 0xFF;
356
+ coords[numCoords + 1] = (color >> 16) & 0xFF;
357
+ coords[numCoords + 2] = (color >> 8) & 0xFF;
358
+ coords[numCoords + 3] = (color) & 0xFF;
359
+ }
360
+ return type;
252
361
  }
253
362
 
254
- /**
255
- * Closes the current subpath by drawing a straight line back to the
256
- * coordinates of the last {@code moveTo}. If the path is already closed
257
- * then this method has no effect.
258
- */
259
- public final void closePath() {
260
- if (numTypes == 0 || pointTypes[numTypes - 1] != SEG_CLOSE) {
261
- needRoom(false, 0);
262
- pointTypes[numTypes++] = SEG_CLOSE;
363
+ public int currentSegment(double[] coords) {
364
+ int type = path.pointTypes[typeIdx];
365
+ int numCoords = curvecoords[type];
366
+ if (numCoords > 0) {
367
+ for (int i = 0; i < numCoords; i++) {
368
+ coords[i] = floatCoords[pointIdx + i];
263
369
  }
370
+ int color = path.pointColors[colorIdx];
371
+ coords[numCoords + 0] = (color >> 24) & 0xFF;
372
+ coords[numCoords + 1] = (color >> 16) & 0xFF;
373
+ coords[numCoords + 2] = (color >> 8) & 0xFF;
374
+ coords[numCoords + 3] = (color) & 0xFF;
375
+ }
376
+ return type;
264
377
  }
265
378
 
266
- /**
267
- * Returns the fill style winding rule.
268
- *
269
- * @return an integer representing the current winding rule.
270
- * @see #WIND_EVEN_ODD
271
- * @see #WIND_NON_ZERO
272
- * @see #setWindingRule
273
- */
274
- public final int getWindingRule() {
275
- return windingRule;
379
+ public int getWindingRule() {
380
+ return path.getWindingRule();
276
381
  }
277
382
 
278
- /**
279
- * Sets the winding rule for this path to the specified value.
280
- *
281
- * @param rule an integer representing the specified winding rule
282
- * @exception IllegalArgumentException if {@code rule} is not either
283
- * {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}
284
- * @see #getWindingRule
285
- */
286
- public final void setWindingRule(int rule) {
287
- if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO) {
288
- throw new IllegalArgumentException("winding rule must be "
289
- + "WIND_EVEN_ODD or " + "WIND_NON_ZERO");
290
- }
291
- windingRule = rule;
383
+ public boolean isDone() {
384
+ return (typeIdx >= path.numTypes);
292
385
  }
293
386
 
294
- /**
295
- * Resets the path to empty. The append position is set back to the
296
- * beginning of the path and all coordinates and point types are forgotten.
297
- */
298
- public final void reset() {
299
- numTypes = numCoords = 0;
387
+ public void next() {
388
+ int type = path.pointTypes[typeIdx++];
389
+ if (0 < curvecoords[type]) {
390
+ pointIdx += curvecoords[type];
391
+ colorIdx++;
392
+ }
393
+ }
394
+ }
395
+
396
+
397
+ /////////////////////////////////////////////////////////////////////////////
398
+ //
399
+ // Stroked path methods
400
+
401
+
402
+ static public LinePath createStrokedPath(LinePath src, float weight,
403
+ int caps, int join) {
404
+ return createStrokedPath(src, weight, caps, join, defaultMiterlimit, null);
405
+ }
406
+
407
+
408
+ static public LinePath createStrokedPath(LinePath src, float weight,
409
+ int caps, int join, float miterlimit) {
410
+ return createStrokedPath(src, weight, caps, join, miterlimit, null);
411
+ }
412
+
413
+
414
+ /**
415
+ * Constructs a solid <code>LinePath</code> with the specified attributes.
416
+ *
417
+ * @param src
418
+ * the original path to be stroked
419
+ * @param weight
420
+ * the weight of the stroked path
421
+ * @param caps
422
+ * the decoration of the ends of the segments in the path
423
+ * @param join
424
+ * the decoration applied where path segments meet
425
+ * @param miterlimit
426
+ * @param transform
427
+ * @return
428
+ *
429
+ */
430
+ static public LinePath createStrokedPath(LinePath src, float weight,
431
+ int caps, int join,
432
+ float miterlimit, PMatrix2D transform) {
433
+ final LinePath dest = new LinePath();
434
+
435
+ strokeTo(src, weight, caps, join, miterlimit, transform, new LineStroker() {
436
+ @Override
437
+ public void moveTo(int x0, int y0, int c0) {
438
+ dest.moveTo(S15_16ToFloat(x0), S15_16ToFloat(y0), c0);
439
+ }
440
+
441
+ @Override
442
+ public void lineJoin() {
443
+ }
444
+
445
+ @Override
446
+ public void lineTo(int x1, int y1, int c1) {
447
+ dest.lineTo(S15_16ToFloat(x1), S15_16ToFloat(y1), c1);
448
+ }
449
+
450
+ @Override
451
+ public void close() {
452
+ dest.closePath();
453
+ }
454
+
455
+ @Override
456
+ public void end() {
457
+ }
458
+ });
459
+
460
+ return dest;
461
+ }
462
+
463
+
464
+ private static void strokeTo(LinePath src, float width, int caps, int join,
465
+ float miterlimit, PMatrix2D transform,
466
+ LineStroker lsink) {
467
+ lsink = new LineStroker(lsink, FloatToS15_16(width), caps, join,
468
+ FloatToS15_16(miterlimit),
469
+ transform == null ? identity : transform);
470
+
471
+ PathIterator pi = src.getPathIterator();
472
+ pathTo(pi, lsink);
473
+ }
474
+
475
+
476
+ private static void pathTo(PathIterator pi, LineStroker lsink) {
477
+ float[] coords = new float[6];
478
+ while (!pi.isDone()) {
479
+ int color;
480
+ switch (pi.currentSegment(coords)) {
481
+ case SEG_MOVETO:
482
+ color = ((int)coords[2]<<24) |
483
+ ((int)coords[3]<<16) |
484
+ ((int)coords[4]<< 8) |
485
+ (int)coords[5];
486
+ lsink.moveTo(FloatToS15_16(coords[0]), FloatToS15_16(coords[1]), color);
487
+ break;
488
+ case SEG_LINETO:
489
+ color = ((int)coords[2]<<24) |
490
+ ((int)coords[3]<<16) |
491
+ ((int)coords[4]<< 8) |
492
+ (int)coords[5];
493
+ lsink.lineJoin();
494
+ lsink.lineTo(FloatToS15_16(coords[0]), FloatToS15_16(coords[1]), color);
495
+ break;
496
+ case SEG_CLOSE:
497
+ lsink.lineJoin();
498
+ lsink.close();
499
+ break;
500
+ default:
501
+ throw new InternalError("unknown flattened segment type");
502
+ }
503
+ pi.next();
300
504
  }
505
+ lsink.end();
506
+ }
301
507
 
302
- static public class PathIterator {
303
508
 
304
- float floatCoords[];
509
+ /////////////////////////////////////////////////////////////////////////////
510
+ //
511
+ // Utility methods
305
512
 
306
- int typeIdx;
307
513
 
308
- int pointIdx;
514
+ public static float[] copyOf(float[] source, int length) {
515
+ float[] target = new float[length];
516
+ for (int i = 0; i < target.length; i++) {
517
+ if (i > source.length - 1)
518
+ target[i] = 0f;
519
+ else
520
+ target[i] = source[i];
521
+ }
522
+ return target;
523
+ }
309
524
 
310
- int colorIdx;
311
525
 
312
- LinePath path;
526
+ public static byte[] copyOf(byte[] source, int length) {
527
+ byte[] target = new byte[length];
528
+ for (int i = 0; i < target.length; i++) {
529
+ if (i > source.length - 1)
530
+ target[i] = 0;
531
+ else
532
+ target[i] = source[i];
533
+ }
534
+ return target;
535
+ }
313
536
 
314
- static final int curvecoords[] = {2, 2, 0};
315
537
 
316
- PathIterator(LinePath p2df) {
317
- this.path = p2df;
318
- this.floatCoords = p2df.floatCoords;
319
- pointIdx = 0;
320
- colorIdx = 0;
321
- }
538
+ public static int[] copyOf(int[] source, int length) {
539
+ int[] target = new int[length];
540
+ for (int i = 0; i < target.length; i++) {
541
+ if (i > source.length - 1)
542
+ target[i] = 0;
543
+ else
544
+ target[i] = source[i];
545
+ }
546
+ return target;
547
+ }
322
548
 
323
- public int currentSegment(float[] coords) {
324
- int type = path.pointTypes[typeIdx];
325
- int numCoords = curvecoords[type];
326
- if (numCoords > 0) {
327
- System.arraycopy(floatCoords, pointIdx, coords, 0, numCoords);
328
- int color = path.pointColors[colorIdx];
329
- coords[numCoords + 0] = (color >> 24) & 0xFF;
330
- coords[numCoords + 1] = (color >> 16) & 0xFF;
331
- coords[numCoords + 2] = (color >> 8) & 0xFF;
332
- coords[numCoords + 3] = (color >> 0) & 0xFF;
333
- }
334
- return type;
335
- }
336
549
 
337
- public int currentSegment(double[] coords) {
338
- int type = path.pointTypes[typeIdx];
339
- int numCoords = curvecoords[type];
340
- if (numCoords > 0) {
341
- for (int i = 0; i < numCoords; i++) {
342
- coords[i] = floatCoords[pointIdx + i];
343
- }
344
- int color = path.pointColors[colorIdx];
345
- coords[numCoords + 0] = (color >> 24) & 0xFF;
346
- coords[numCoords + 1] = (color >> 16) & 0xFF;
347
- coords[numCoords + 2] = (color >> 8) & 0xFF;
348
- coords[numCoords + 3] = (color >> 0) & 0xFF;
349
- }
350
- return type;
351
- }
550
+ // From Ken Turkowski, _Fixed-Point Square Root_, In Graphics Gems V
551
+ public static int isqrt(int x) {
552
+ int fracbits = 16;
352
553
 
353
- public int getWindingRule() {
354
- return path.getWindingRule();
355
- }
554
+ int root = 0;
555
+ int remHi = 0;
556
+ int remLo = x;
557
+ int count = 15 + fracbits / 2;
356
558
 
357
- public boolean isDone() {
358
- return (typeIdx >= path.numTypes);
359
- }
559
+ do {
560
+ remHi = (remHi << 2) | (remLo >>> 30); // N.B. - unsigned shift R
561
+ remLo <<= 2;
562
+ root <<= 1;
563
+ int testdiv = (root << 1) + 1;
564
+ if (remHi >= testdiv) {
565
+ remHi -= testdiv;
566
+ root++;
567
+ }
568
+ } while (count-- != 0);
360
569
 
361
- public void next() {
362
- int type = path.pointTypes[typeIdx++];
363
- if (0 < curvecoords[type]) {
364
- pointIdx += curvecoords[type];
365
- colorIdx++;
366
- }
367
- }
368
- }
570
+ return root;
571
+ }
369
572
 
370
- /////////////////////////////////////////////////////////////////////////////
371
- //
372
- // Stroked path methods
373
- static public LinePath createStrokedPath(LinePath src, float weight,
374
- int caps, int join) {
375
- return createStrokedPath(src, weight, caps, join, defaultMiterlimit, null);
376
- }
377
573
 
378
- static public LinePath createStrokedPath(LinePath src, float weight,
379
- int caps, int join, float miterlimit) {
380
- return createStrokedPath(src, weight, caps, join, miterlimit, null);
381
- }
574
+ public static long lsqrt(long x) {
575
+ int fracbits = 16;
382
576
 
383
- /**
384
- * Constructs a solid <code>LinePath</code> with the specified attributes.
385
- *
386
- * @param src the original path to be stroked
387
- * @param weight the weight of the stroked path
388
- * @param caps the decoration of the ends of the segments in the path
389
- * @param join the decoration applied where path segments meet
390
- * @param miterlimit
391
- * @param transform
392
- *
393
- */
394
- static public LinePath createStrokedPath(LinePath src, float weight,
395
- int caps, int join,
396
- float miterlimit, PMatrix2D transform) {
397
- final LinePath dest = new LinePath();
398
-
399
- strokeTo(src, weight, caps, join, miterlimit, transform, new LineStroker() {
400
- @Override
401
- public void moveTo(int x0, int y0, int c0) {
402
- dest.moveTo(S15_16ToFloat(x0), S15_16ToFloat(y0), c0);
403
- }
404
-
405
- @Override
406
- public void lineJoin() {
407
- }
408
-
409
- @Override
410
- public void lineTo(int x1, int y1, int c1) {
411
- dest.lineTo(S15_16ToFloat(x1), S15_16ToFloat(y1), c1);
412
- }
413
-
414
- @Override
415
- public void close() {
416
- dest.closePath();
417
- }
418
-
419
- @Override
420
- public void end() {
421
- }
422
- });
423
-
424
- return dest;
425
- }
577
+ long root = 0;
578
+ long remHi = 0;
579
+ long remLo = x;
580
+ int count = 31 + fracbits / 2;
426
581
 
427
- private static void strokeTo(LinePath src, float width, int caps, int join,
428
- float miterlimit, PMatrix2D transform,
429
- LineStroker lsink) {
430
- lsink = new LineStroker(lsink, FloatToS15_16(width), caps, join,
431
- FloatToS15_16(miterlimit),
432
- transform == null ? identity : transform);
582
+ do {
583
+ remHi = (remHi << 2) | (remLo >>> 62); // N.B. - unsigned shift R
584
+ remLo <<= 2;
585
+ root <<= 1;
586
+ long testDiv = (root << 1) + 1;
587
+ if (remHi >= testDiv) {
588
+ remHi -= testDiv;
589
+ root++;
590
+ }
591
+ } while (count-- != 0);
433
592
 
434
- PathIterator pi = src.getPathIterator();
435
- pathTo(pi, lsink);
436
- }
593
+ return root;
594
+ }
437
595
 
438
- private static void pathTo(PathIterator pi, LineStroker lsink) {
439
- float coords[] = new float[6];
440
- while (!pi.isDone()) {
441
- int color;
442
- switch (pi.currentSegment(coords)) {
443
- case SEG_MOVETO:
444
- color = ((int) coords[2] << 24)
445
- | ((int) coords[3] << 16)
446
- | ((int) coords[4] << 8)
447
- | (int) coords[5];
448
- lsink.moveTo(FloatToS15_16(coords[0]), FloatToS15_16(coords[1]), color);
449
- break;
450
- case SEG_LINETO:
451
- color = ((int) coords[2] << 24)
452
- | ((int) coords[3] << 16)
453
- | ((int) coords[4] << 8)
454
- | (int) coords[5];
455
- lsink.lineJoin();
456
- lsink.lineTo(FloatToS15_16(coords[0]), FloatToS15_16(coords[1]), color);
457
- break;
458
- case SEG_CLOSE:
459
- lsink.lineJoin();
460
- lsink.close();
461
- break;
462
- default:
463
- throw new InternalError("unknown flattened segment type");
464
- }
465
- pi.next();
466
- }
467
- lsink.end();
468
- }
469
596
 
470
- /////////////////////////////////////////////////////////////////////////////
471
- //
472
- // Utility methods
473
- public static float[] copyOf(float[] source, int length) {
474
- float[] target = new float[length];
475
- for (int i = 0; i < target.length; i++) {
476
- if (i > source.length - 1) {
477
- target[i] = 0f;
478
- } else {
479
- target[i] = source[i];
480
- }
481
- }
482
- return target;
483
- }
597
+ public static double hypot(double x, double y) {
598
+ return Math.sqrt(x * x + y * y);
599
+ }
484
600
 
485
- public static byte[] copyOf(byte[] source, int length) {
486
- byte[] target = new byte[length];
487
- for (int i = 0; i < target.length; i++) {
488
- if (i > source.length - 1) {
489
- target[i] = 0;
490
- } else {
491
- target[i] = source[i];
492
- }
493
- }
494
- return target;
495
- }
496
601
 
497
- public static int[] copyOf(int[] source, int length) {
498
- int[] target = new int[length];
499
- for (int i = 0; i < target.length; i++) {
500
- if (i > source.length - 1) {
501
- target[i] = 0;
502
- } else {
503
- target[i] = source[i];
504
- }
505
- }
506
- return target;
507
- }
602
+ public static int hypot(int x, int y) {
603
+ return (int) ((lsqrt((long) x * x + (long) y * y) + 128) >> 8);
604
+ }
508
605
 
509
- // From Ken Turkowski, _Fixed-Point Square Root_, In Graphics Gems V
510
- public static int isqrt(int x) {
511
- int fracbits = 16;
512
-
513
- int root = 0;
514
- int remHi = 0;
515
- int remLo = x;
516
- int count = 15 + fracbits / 2;
517
-
518
- do {
519
- remHi = (remHi << 2) | (remLo >>> 30); // N.B. - unsigned shift R
520
- remLo <<= 2;
521
- root <<= 1;
522
- int testdiv = (root << 1) + 1;
523
- if (remHi >= testdiv) {
524
- remHi -= testdiv;
525
- root++;
526
- }
527
- } while (count-- != 0);
528
-
529
- return root;
530
- }
531
606
 
532
- public static long lsqrt(long x) {
533
- int fracbits = 16;
534
-
535
- long root = 0;
536
- long remHi = 0;
537
- long remLo = x;
538
- int count = 31 + fracbits / 2;
539
-
540
- do {
541
- remHi = (remHi << 2) | (remLo >>> 62); // N.B. - unsigned shift R
542
- remLo <<= 2;
543
- root <<= 1;
544
- long testDiv = (root << 1) + 1;
545
- if (remHi >= testDiv) {
546
- remHi -= testDiv;
547
- root++;
548
- }
549
- } while (count-- != 0);
550
-
551
- return root;
552
- }
607
+ public static long hypot(long x, long y) {
608
+ return (lsqrt(x * x + y * y) + 128) >> 8;
609
+ }
553
610
 
554
- public static double hypot(double x, double y) {
555
- return Math.sqrt(x * x + y * y);
556
- }
557
-
558
- public static int hypot(int x, int y) {
559
- return (int) ((lsqrt((long) x * x + (long) y * y) + 128) >> 8);
560
- }
561
611
 
562
- public static long hypot(long x, long y) {
563
- return (lsqrt(x * x + y * y) + 128) >> 8;
612
+ static int FloatToS15_16(float flt) {
613
+ flt = flt * 65536f + 0.5f;
614
+ if (flt <= -(65536f * 65536f)) {
615
+ return Integer.MIN_VALUE;
616
+ } else if (flt >= (65536f * 65536f)) {
617
+ return Integer.MAX_VALUE;
618
+ } else {
619
+ return (int) Math.floor(flt);
564
620
  }
621
+ }
565
622
 
566
- static int FloatToS15_16(float flt) {
567
- flt = flt * 65536f + 0.5f;
568
- if (flt <= -(65536f * 65536f)) {
569
- return Integer.MIN_VALUE;
570
- } else if (flt >= (65536f * 65536f)) {
571
- return Integer.MAX_VALUE;
572
- } else {
573
- return (int) Math.floor(flt);
574
- }
575
- }
576
623
 
577
- static float S15_16ToFloat(int fix) {
578
- return (fix / 65536f);
579
- }
624
+ static float S15_16ToFloat(int fix) {
625
+ return (fix / 65536f);
626
+ }
580
627
  }