propane 3.4.2-java → 3.8.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +2 -2
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -2
  5. data/.travis.yml +1 -1
  6. data/CHANGELOG.md +9 -1
  7. data/Gemfile +2 -0
  8. data/README.md +7 -10
  9. data/Rakefile +10 -11
  10. data/bin/propane +3 -1
  11. data/lib/propane.rb +4 -2
  12. data/lib/propane/app.rb +5 -1
  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 +22 -23
  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 +20 -14
  24. data/lib/propane/version.rb +2 -1
  25. data/library/boids/boids.rb +21 -11
  26. data/library/color_group/color_group.rb +2 -0
  27. data/library/control_panel/control_panel.rb +8 -5
  28. data/library/dxf/dxf.rb +2 -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 +2 -0
  33. data/library/slider/slider.rb +23 -22
  34. data/library/vector_utils/vector_utils.rb +4 -0
  35. data/library/video_event/video_event.rb +2 -0
  36. data/pom.rb +37 -36
  37. data/pom.xml +7 -7
  38. data/propane.gemspec +13 -9
  39. data/src/main/java/japplemenubar/JAppleMenuBar.java +3 -3
  40. data/src/main/java/monkstone/ColorUtil.java +1 -3
  41. data/src/main/java/monkstone/MathToolModule.java +1 -1
  42. data/src/main/java/monkstone/PropaneLibrary.java +2 -2
  43. data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
  44. data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
  45. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  46. data/src/main/java/monkstone/noise/Noise.java +116 -0
  47. data/src/main/java/monkstone/noise/NoiseGenerator.java +63 -0
  48. data/src/main/java/monkstone/noise/NoiseMode.java +15 -0
  49. data/src/main/java/monkstone/noise/SimplexNoise.java +137 -103
  50. data/src/main/java/monkstone/noise/ValueNoise.java +170 -0
  51. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  52. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  53. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  54. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  55. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  56. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  57. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  58. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  59. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
  60. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -2
  61. data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
  62. data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
  63. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  64. data/src/main/java/processing/awt/PGraphicsJava2D.java +781 -285
  65. data/src/main/java/processing/awt/PImageAWT.java +377 -0
  66. data/src/main/java/processing/awt/PShapeJava2D.java +56 -52
  67. data/src/main/java/processing/awt/PSurfaceAWT.java +308 -208
  68. data/src/main/java/processing/awt/ShimAWT.java +581 -0
  69. data/src/main/java/processing/core/PApplet.java +13142 -13883
  70. data/src/main/java/processing/core/PConstants.java +477 -447
  71. data/src/main/java/processing/core/PFont.java +914 -880
  72. data/src/main/java/processing/core/PGraphics.java +152 -136
  73. data/src/main/java/processing/core/PImage.java +275 -372
  74. data/src/main/java/processing/core/PMatrix.java +172 -159
  75. data/src/main/java/processing/core/PMatrix2D.java +478 -415
  76. data/src/main/java/processing/core/PMatrix3D.java +762 -735
  77. data/src/main/java/processing/core/PShape.java +2887 -2651
  78. data/src/main/java/processing/core/PShapeOBJ.java +97 -92
  79. data/src/main/java/processing/core/PShapeSVG.java +1705 -1490
  80. data/src/main/java/processing/core/PStyle.java +40 -37
  81. data/src/main/java/processing/core/PSurface.java +139 -97
  82. data/src/main/java/processing/core/PSurfaceNone.java +296 -218
  83. data/src/main/java/processing/core/PVector.java +995 -963
  84. data/src/main/java/processing/core/ThinkDifferent.java +12 -8
  85. data/src/main/java/processing/data/DoubleDict.java +756 -710
  86. data/src/main/java/processing/data/DoubleList.java +749 -696
  87. data/src/main/java/processing/data/FloatDict.java +748 -702
  88. data/src/main/java/processing/data/FloatList.java +751 -697
  89. data/src/main/java/processing/data/IntDict.java +720 -673
  90. data/src/main/java/processing/data/IntList.java +699 -633
  91. data/src/main/java/processing/data/JSONArray.java +931 -873
  92. data/src/main/java/processing/data/JSONObject.java +1262 -1165
  93. data/src/main/java/processing/data/JSONTokener.java +351 -341
  94. data/src/main/java/processing/data/LongDict.java +710 -663
  95. data/src/main/java/processing/data/LongList.java +701 -635
  96. data/src/main/java/processing/data/Sort.java +37 -41
  97. data/src/main/java/processing/data/StringDict.java +525 -486
  98. data/src/main/java/processing/data/StringList.java +626 -580
  99. data/src/main/java/processing/data/Table.java +3690 -3510
  100. data/src/main/java/processing/data/TableRow.java +182 -183
  101. data/src/main/java/processing/data/XML.java +957 -883
  102. data/src/main/java/processing/event/Event.java +87 -67
  103. data/src/main/java/processing/event/KeyEvent.java +48 -41
  104. data/src/main/java/processing/event/MouseEvent.java +88 -113
  105. data/src/main/java/processing/event/TouchEvent.java +10 -6
  106. data/src/main/java/processing/javafx/PGraphicsFX2D.java +20 -345
  107. data/src/main/java/processing/javafx/PSurfaceFX.java +149 -121
  108. data/src/main/java/processing/net/Client.java +20 -20
  109. data/src/main/java/processing/net/Server.java +9 -9
  110. data/src/main/java/processing/opengl/FontTexture.java +286 -266
  111. data/src/main/java/processing/opengl/FrameBuffer.java +389 -377
  112. data/src/main/java/processing/opengl/LinePath.java +132 -89
  113. data/src/main/java/processing/opengl/LineStroker.java +588 -581
  114. data/src/main/java/processing/opengl/PGL.java +660 -567
  115. data/src/main/java/processing/opengl/PGraphics2D.java +408 -315
  116. data/src/main/java/processing/opengl/PGraphics3D.java +107 -72
  117. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12378 -12075
  118. data/src/main/java/processing/opengl/PJOGL.java +1753 -1670
  119. data/src/main/java/processing/opengl/PShader.java +369 -461
  120. data/src/main/java/processing/opengl/PShapeOpenGL.java +4678 -4580
  121. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1114 -1027
  122. data/src/main/java/processing/opengl/Texture.java +1492 -1401
  123. data/src/main/java/processing/opengl/VertexBuffer.java +57 -55
  124. data/test/create_test.rb +21 -20
  125. data/test/deglut_spec_test.rb +4 -2
  126. data/test/helper_methods_test.rb +49 -20
  127. data/test/math_tool_test.rb +39 -32
  128. data/test/native_folder.rb +47 -0
  129. data/test/respond_to_test.rb +3 -2
  130. data/test/sketches/key_event.rb +2 -2
  131. data/test/sketches/library/my_library/my_library.rb +3 -0
  132. data/test/test_helper.rb +2 -0
  133. data/test/vecmath_spec_test.rb +35 -22
  134. data/vendors/Rakefile +35 -40
  135. metadata +47 -23
  136. data/library/simplex_noise/simplex_noise.rb +0 -3
  137. data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
  138. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
  139. data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
  140. 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
  Part of the Processing project - http://processing.org
3
5
 
@@ -18,30 +20,33 @@
18
20
  Public License along with this library; if not, write to the
19
21
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20
22
  Boston, MA 02111-1307 USA
21
- */
23
+ */
24
+
22
25
  package processing.core;
23
26
 
24
27
  import java.awt.Cursor;
25
28
  import java.awt.event.KeyEvent;
26
29
 
30
+
27
31
  /**
28
32
  * Numbers shared throughout processing.core.
29
33
  * <P>
30
- * An attempt is made to keep the constants as short/non-verbose as possible.
31
- * For instance, the constant is TIFF instead of FILE_TYPE_TIFF. We'll do this
32
- * as long as we can get away with it.
34
+ * An attempt is made to keep the constants as short/non-verbose
35
+ * as possible. For instance, the constant is TIFF instead of
36
+ * FILE_TYPE_TIFF. We'll do this as long as we can get away with it.
33
37
  *
34
38
  * @usage Web &amp; Application
35
39
  */
36
40
  public interface PConstants {
37
41
 
38
- static public final int X = 0;
39
- static public final int Y = 1;
40
- static public final int Z = 2;
42
+ static public final int X = 0;
43
+ static public final int Y = 1;
44
+ static public final int Z = 2;
45
+
41
46
 
42
- // renderers known to processing.core
47
+ // renderers known to processing.core
43
48
 
44
- /*
49
+ /*
45
50
  // List of renderers used inside PdePreprocessor
46
51
  static final StringList rendererList = new StringList(new String[] {
47
52
  "JAVA2D", "JAVA2D_2X",
@@ -50,452 +55,477 @@ public interface PConstants {
50
55
  "LWJGL.P2D", "LWJGL.P3D", // hmm
51
56
  "PDF" // no DXF because that's only for beginRaw()
52
57
  });
53
- */
54
- static final String JAVA2D = "processing.awt.PGraphicsJava2D";
58
+ */
59
+
60
+ static final String JAVA2D = "processing.awt.PGraphicsJava2D";
55
61
 
56
- static final String P2D = "processing.opengl.PGraphics2D";
57
- static final String P3D = "processing.opengl.PGraphics3D";
62
+ static final String P2D = "processing.opengl.PGraphics2D";
63
+ static final String P3D = "processing.opengl.PGraphics3D";
58
64
 
59
- // When will it be time to remove this?
60
- @Deprecated
61
- static final String OPENGL = P3D;
65
+ // When will it be time to remove this?
66
+ @Deprecated
67
+ static final String OPENGL = P3D;
62
68
 
63
- // Experimental, higher-performance Java 2D renderer (but no pixel ops)
69
+ // Experimental, higher-performance Java 2D renderer (but no pixel ops)
64
70
  // static final String E2D = PGraphicsDanger2D.class.getName();
65
- // Experimental JavaFX renderer; even better 2D performance
66
- static final String FX2D = "processing.javafx.PGraphicsFX2D";
67
-
68
- static final String PDF = "processing.pdf.PGraphicsPDF";
69
- static final String SVG = "processing.svg.PGraphicsSVG";
70
- static final String DXF = "processing.dxf.RawDXF";
71
-
72
- // platform IDs for PApplet.platform
73
- static final int OTHER = 0;
74
- static final int WINDOWS = 1;
75
- static final int MACOSX = 2;
76
- static final int LINUX = 3;
77
-
78
- static final String[] platformNames = {
79
- "other", "windows", "macosx", "linux"
80
- };
81
-
82
- static final float EPSILON = 0.0001f;
83
-
84
- // max/min values for numbers
85
- /**
86
- * Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, and to
87
- * avoid teaching static methods on the first day.
88
- */
89
- static final float MAX_FLOAT = Float.MAX_VALUE;
90
- /**
91
- * Note that Float.MIN_VALUE is the smallest <EM>positive</EM> value for a
92
- * floating point number, not actually the minimum (negative) value for a
93
- * float. This constant equals 0xFF7FFFFF, the smallest (farthest negative)
94
- * value a float can have before it hits NaN.
95
- */
96
- static final float MIN_FLOAT = -Float.MAX_VALUE;
97
- /**
98
- * Largest possible (positive) integer value
99
- */
100
- static final int MAX_INT = Integer.MAX_VALUE;
101
- /**
102
- * Smallest possible (negative) integer value
103
- */
104
- static final int MIN_INT = Integer.MIN_VALUE;
105
-
106
- // shapes
107
- static public final int VERTEX = 0;
108
- static public final int BEZIER_VERTEX = 1;
109
- static public final int QUADRATIC_VERTEX = 2;
110
- static public final int CURVE_VERTEX = 3;
111
- static public final int BREAK = 4;
112
-
113
- @Deprecated
114
- static public final int QUAD_BEZIER_VERTEX = 2; // should not have been exposed
115
-
116
- // useful goodness
117
- /**
118
- * ( begin auto-generated from PI.xml )
119
- *
120
- * PI is a mathematical constant with the value 3.14159265358979323846. It
121
- * is the ratio of the circumference of a circle to its diameter. It is
122
- * useful in combination with the trigonometric functions <b>sin()</b> and
123
- * <b>cos()</b>.
124
- *
125
- * ( end auto-generated )
126
- *
127
- * @webref constants
128
- * @see PConstants#TWO_PI
129
- * @see PConstants#TAU
130
- * @see PConstants#HALF_PI
131
- * @see PConstants#QUARTER_PI
132
- *
133
- */
134
- static final float PI = (float) Math.PI;
135
- /**
136
- * ( begin auto-generated from HALF_PI.xml )
137
- *
138
- * HALF_PI is a mathematical constant with the value 1.57079632679489661923.
139
- * It is half the ratio of the circumference of a circle to its diameter. It
140
- * is useful in combination with the trigonometric functions <b>sin()</b>
141
- * and <b>cos()</b>.
142
- *
143
- * ( end auto-generated )
144
- *
145
- * @webref constants
146
- * @see PConstants#PI
147
- * @see PConstants#TWO_PI
148
- * @see PConstants#TAU
149
- * @see PConstants#QUARTER_PI
150
- */
151
- static final float HALF_PI = (float) (Math.PI / 2.0);
152
- static final float THIRD_PI = (float) (Math.PI / 3.0);
153
- /**
154
- * ( begin auto-generated from QUARTER_PI.xml )
155
- *
156
- * QUARTER_PI is a mathematical constant with the value 0.7853982. It is one
157
- * quarter the ratio of the circumference of a circle to its diameter. It is
158
- * useful in combination with the trigonometric functions
159
- * <b>sin()</b> and <b>cos()</b>.
160
- *
161
- * ( end auto-generated )
162
- *
163
- * @webref constants
164
- * @see PConstants#PI
165
- * @see PConstants#TWO_PI
166
- * @see PConstants#TAU
167
- * @see PConstants#HALF_PI
168
- */
169
- static final float QUARTER_PI = (float) (Math.PI / 4.0);
170
- /**
171
- * ( begin auto-generated from TWO_PI.xml )
172
- *
173
- * TWO_PI is a mathematical constant with the value 6.28318530717958647693.
174
- * It is twice the ratio of the circumference of a circle to its diameter.
175
- * It is useful in combination with the trigonometric functions
176
- * <b>sin()</b> and <b>cos()</b>.
177
- *
178
- * ( end auto-generated )
179
- *
180
- * @webref constants
181
- * @see PConstants#PI
182
- * @see PConstants#TAU
183
- * @see PConstants#HALF_PI
184
- * @see PConstants#QUARTER_PI
185
- */
186
- static final float TWO_PI = (float) (2.0 * Math.PI);
187
- /**
188
- * ( begin auto-generated from TAU.xml )
189
- *
190
- * TAU is an alias for TWO_PI, a mathematical constant with the value
191
- * 6.28318530717958647693. It is twice the ratio of the circumference of a
192
- * circle to its diameter. It is useful in combination with the
193
- * trigonometric functions <b>sin()</b> and <b>cos()</b>.
194
- *
195
- * ( end auto-generated )
196
- *
197
- * @webref constants
198
- * @see PConstants#PI
199
- * @see PConstants#TWO_PI
200
- * @see PConstants#HALF_PI
201
- * @see PConstants#QUARTER_PI
202
- */
203
- static final float TAU = (float) (2.0 * Math.PI);
204
-
205
- static final float DEG_TO_RAD = PI / 180.0f;
206
- static final float RAD_TO_DEG = 180.0f / PI;
207
-
208
- // angle modes
209
- //static final int RADIANS = 0;
210
- //static final int DEGREES = 1;
211
- // used by split, all the standard whitespace chars
212
- // (also includes unicode nbsp, that little bostage)
213
- static final String WHITESPACE = " \t\n\r\f\u00A0";
214
-
215
- // for colors and/or images
216
- static final int RGB = 1; // image & color
217
- static final int ARGB = 2; // image
218
- static final int HSB = 3; // color
219
- static final int ALPHA = 4; // image
71
+
72
+ // Experimental JavaFX renderer; even better 2D performance
73
+ static final String FX2D = "processing.javafx.PGraphicsFX2D";
74
+
75
+ static final String PDF = "processing.pdf.PGraphicsPDF";
76
+ static final String SVG = "processing.svg.PGraphicsSVG";
77
+ static final String DXF = "processing.dxf.RawDXF";
78
+
79
+ // platform IDs for PApplet.platform
80
+
81
+ static final int OTHER = 0;
82
+ static final int WINDOWS = 1;
83
+ static final int MACOS = 2;
84
+ static final int LINUX = 3;
85
+
86
+ /** @deprecated Marketers gonna market, use {@link #MACOS} */
87
+ @Deprecated
88
+ static final int MACOSX = 2;
89
+
90
+ static final String[] platformNames = {
91
+ "other", "windows", "macosx", "linux"
92
+ };
93
+
94
+
95
+ static final float EPSILON = 0.0001f;
96
+
97
+
98
+ // max/min values for numbers
99
+
100
+ /**
101
+ * Same as Float.MAX_VALUE, but included for parity with MIN_VALUE,
102
+ * and to avoid teaching static methods on the first day.
103
+ */
104
+ static final float MAX_FLOAT = Float.MAX_VALUE;
105
+ /**
106
+ * Note that Float.MIN_VALUE is the smallest <EM>positive</EM> value
107
+ * for a floating point number, not actually the minimum (negative) value
108
+ * for a float. This constant equals 0xFF7FFFFF, the smallest (farthest
109
+ * negative) value a float can have before it hits NaN.
110
+ */
111
+ static final float MIN_FLOAT = -Float.MAX_VALUE;
112
+ /** Largest possible (positive) integer value */
113
+ static final int MAX_INT = Integer.MAX_VALUE;
114
+ /** Smallest possible (negative) integer value */
115
+ static final int MIN_INT = Integer.MIN_VALUE;
116
+
117
+ // shapes
118
+
119
+ static public final int VERTEX = 0;
120
+ static public final int BEZIER_VERTEX = 1;
121
+ static public final int QUADRATIC_VERTEX = 2;
122
+ static public final int CURVE_VERTEX = 3;
123
+ static public final int BREAK = 4;
124
+
125
+ @Deprecated
126
+ static public final int QUAD_BEZIER_VERTEX = 2; // should not have been exposed
127
+
128
+ // useful goodness
129
+
130
+ /**
131
+ * ( begin auto-generated from PI.xml )
132
+ *
133
+ * PI is a mathematical constant with the value 3.14159265358979323846. It
134
+ * is the ratio of the circumference of a circle to its diameter. It is
135
+ * useful in combination with the trigonometric functions <b>sin()</b> and
136
+ * <b>cos()</b>.
137
+ *
138
+ * ( end auto-generated )
139
+ * @webref constants
140
+ * @see PConstants#TWO_PI
141
+ * @see PConstants#TAU
142
+ * @see PConstants#HALF_PI
143
+ * @see PConstants#QUARTER_PI
144
+ *
145
+ */
146
+ static final float PI = (float) Math.PI;
147
+ /**
148
+ * ( begin auto-generated from HALF_PI.xml )
149
+ *
150
+ * HALF_PI is a mathematical constant with the value
151
+ * 1.57079632679489661923. It is half the ratio of the circumference of a
152
+ * circle to its diameter. It is useful in combination with the
153
+ * trigonometric functions <b>sin()</b> and <b>cos()</b>.
154
+ *
155
+ * ( end auto-generated )
156
+ * @webref constants
157
+ * @see PConstants#PI
158
+ * @see PConstants#TWO_PI
159
+ * @see PConstants#TAU
160
+ * @see PConstants#QUARTER_PI
161
+ */
162
+ static final float HALF_PI = (float) (Math.PI / 2.0);
163
+ static final float THIRD_PI = (float) (Math.PI / 3.0);
164
+ /**
165
+ * ( begin auto-generated from QUARTER_PI.xml )
166
+ *
167
+ * QUARTER_PI is a mathematical constant with the value 0.7853982. It is
168
+ * one quarter the ratio of the circumference of a circle to its diameter.
169
+ * It is useful in combination with the trigonometric functions
170
+ * <b>sin()</b> and <b>cos()</b>.
171
+ *
172
+ * ( end auto-generated )
173
+ * @webref constants
174
+ * @see PConstants#PI
175
+ * @see PConstants#TWO_PI
176
+ * @see PConstants#TAU
177
+ * @see PConstants#HALF_PI
178
+ */
179
+ static final float QUARTER_PI = (float) (Math.PI / 4.0);
180
+ /**
181
+ * ( begin auto-generated from TWO_PI.xml )
182
+ *
183
+ * TWO_PI is a mathematical constant with the value 6.28318530717958647693.
184
+ * It is twice the ratio of the circumference of a circle to its diameter.
185
+ * It is useful in combination with the trigonometric functions
186
+ * <b>sin()</b> and <b>cos()</b>.
187
+ *
188
+ * ( end auto-generated )
189
+ * @webref constants
190
+ * @see PConstants#PI
191
+ * @see PConstants#TAU
192
+ * @see PConstants#HALF_PI
193
+ * @see PConstants#QUARTER_PI
194
+ */
195
+ static final float TWO_PI = (float) (2.0 * Math.PI);
196
+ /**
197
+ * ( begin auto-generated from TAU.xml )
198
+ *
199
+ * TAU is an alias for TWO_PI, a mathematical constant with the value
200
+ * 6.28318530717958647693. It is twice the ratio of the circumference
201
+ * of a circle to its diameter. It is useful in combination with the
202
+ * trigonometric functions <b>sin()</b> and <b>cos()</b>.
203
+ *
204
+ * ( end auto-generated )
205
+ * @webref constants
206
+ * @see PConstants#PI
207
+ * @see PConstants#TWO_PI
208
+ * @see PConstants#HALF_PI
209
+ * @see PConstants#QUARTER_PI
210
+ */
211
+ static final float TAU = (float) (2.0 * Math.PI);
212
+
213
+ static final float DEG_TO_RAD = PI/180.0f;
214
+ static final float RAD_TO_DEG = 180.0f/PI;
215
+
216
+
217
+ // angle modes
218
+
219
+ //static final int RADIANS = 0;
220
+ //static final int DEGREES = 1;
221
+
222
+
223
+ // used by split, all the standard whitespace chars
224
+ // (also includes unicode nbsp, that little bostage)
225
+
226
+ static final String WHITESPACE = " \t\n\r\f\u00A0";
227
+
228
+
229
+ // for colors and/or images
230
+
231
+ static final int RGB = 1; // image & color
232
+ static final int ARGB = 2; // image
233
+ static final int HSB = 3; // color
234
+ static final int ALPHA = 4; // image
220
235
  // static final int CMYK = 5; // image & color (someday)
221
236
 
222
- // image file types
223
- static final int TIFF = 0;
224
- static final int TARGA = 1;
225
- static final int JPEG = 2;
226
- static final int GIF = 3;
227
-
228
- // filter/convert types
229
- static final int BLUR = 11;
230
- static final int GRAY = 12;
231
- static final int INVERT = 13;
232
- static final int OPAQUE = 14;
233
- static final int POSTERIZE = 15;
234
- static final int THRESHOLD = 16;
235
- static final int ERODE = 17;
236
- static final int DILATE = 18;
237
-
238
- // blend mode keyword definitions
239
- // @see processing.core.PImage#blendColor(int,int,int)
240
- public final static int REPLACE = 0;
241
- public final static int BLEND = 1;
242
- public final static int ADD = 1 << 1;
243
- public final static int SUBTRACT = 1 << 2;
244
- public final static int LIGHTEST = 1 << 3;
245
- public final static int DARKEST = 1 << 4;
246
- public final static int DIFFERENCE = 1 << 5;
247
- public final static int EXCLUSION = 1 << 6;
248
- public final static int MULTIPLY = 1 << 7;
249
- public final static int SCREEN = 1 << 8;
250
- public final static int OVERLAY = 1 << 9;
251
- public final static int HARD_LIGHT = 1 << 10;
252
- public final static int SOFT_LIGHT = 1 << 11;
253
- public final static int DODGE = 1 << 12;
254
- public final static int BURN = 1 << 13;
255
-
256
- // for messages
257
- static final int CHATTER = 0;
258
- static final int COMPLAINT = 1;
259
- static final int PROBLEM = 2;
260
-
261
- // types of transformation matrices
262
- static final int PROJECTION = 0;
263
- static final int MODELVIEW = 1;
264
-
265
- // types of projection matrices
266
- static final int CUSTOM = 0; // user-specified fanciness
267
- static final int ORTHOGRAPHIC = 2; // 2D isometric projection
268
- static final int PERSPECTIVE = 3; // perspective matrix
269
-
270
- // shapes
271
- // the low four bits set the variety,
272
- // higher bits set the specific shape type
273
- static final int GROUP = 0; // createShape()
274
-
275
- static final int POINT = 2; // primitive
276
- static final int POINTS = 3; // vertices
277
-
278
- static final int LINE = 4; // primitive
279
- static final int LINES = 5; // beginShape(), createShape()
280
- static final int LINE_STRIP = 50; // beginShape()
281
- static final int LINE_LOOP = 51;
282
-
283
- static final int TRIANGLE = 8; // primitive
284
- static final int TRIANGLES = 9; // vertices
285
- static final int TRIANGLE_STRIP = 10; // vertices
286
- static final int TRIANGLE_FAN = 11; // vertices
287
-
288
- static final int QUAD = 16; // primitive
289
- static final int QUADS = 17; // vertices
290
- static final int QUAD_STRIP = 18; // vertices
291
-
292
- static final int POLYGON = 20; // in the end, probably cannot
293
- static final int PATH = 21; // separate these two
294
-
295
- static final int RECT = 30; // primitive
296
- static final int ELLIPSE = 31; // primitive
297
- static final int ARC = 32; // primitive
298
-
299
- static final int SPHERE = 40; // primitive
300
- static final int BOX = 41; // primitive
237
+
238
+ // image file types
239
+
240
+ static final int TIFF = 0;
241
+ static final int TARGA = 1;
242
+ static final int JPEG = 2;
243
+ static final int GIF = 3;
244
+
245
+
246
+ // filter/convert types
247
+
248
+ static final int BLUR = 11;
249
+ static final int GRAY = 12;
250
+ static final int INVERT = 13;
251
+ static final int OPAQUE = 14;
252
+ static final int POSTERIZE = 15;
253
+ static final int THRESHOLD = 16;
254
+ static final int ERODE = 17;
255
+ static final int DILATE = 18;
256
+
257
+
258
+ // blend mode keyword definitions
259
+ // @see processing.core.PImage#blendColor(int,int,int)
260
+
261
+ public final static int REPLACE = 0;
262
+ public final static int BLEND = 1;
263
+ public final static int ADD = 1 << 1;
264
+ public final static int SUBTRACT = 1 << 2;
265
+ public final static int LIGHTEST = 1 << 3;
266
+ public final static int DARKEST = 1 << 4;
267
+ public final static int DIFFERENCE = 1 << 5;
268
+ public final static int EXCLUSION = 1 << 6;
269
+ public final static int MULTIPLY = 1 << 7;
270
+ public final static int SCREEN = 1 << 8;
271
+ public final static int OVERLAY = 1 << 9;
272
+ public final static int HARD_LIGHT = 1 << 10;
273
+ public final static int SOFT_LIGHT = 1 << 11;
274
+ public final static int DODGE = 1 << 12;
275
+ public final static int BURN = 1 << 13;
276
+
277
+ // for messages
278
+
279
+ static final int CHATTER = 0;
280
+ static final int COMPLAINT = 1;
281
+ static final int PROBLEM = 2;
282
+
283
+
284
+ // types of transformation matrices
285
+
286
+ static final int PROJECTION = 0;
287
+ static final int MODELVIEW = 1;
288
+
289
+ // types of projection matrices
290
+
291
+ static final int CUSTOM = 0; // user-specified fanciness
292
+ static final int ORTHOGRAPHIC = 2; // 2D isometric projection
293
+ static final int PERSPECTIVE = 3; // perspective matrix
294
+
295
+
296
+ // shapes
297
+
298
+ // the low four bits set the variety,
299
+ // higher bits set the specific shape type
300
+
301
+ static final int GROUP = 0; // createShape()
302
+
303
+ static final int POINT = 2; // primitive
304
+ static final int POINTS = 3; // vertices
305
+
306
+ static final int LINE = 4; // primitive
307
+ static final int LINES = 5; // beginShape(), createShape()
308
+ static final int LINE_STRIP = 50; // beginShape()
309
+ static final int LINE_LOOP = 51;
310
+
311
+ static final int TRIANGLE = 8; // primitive
312
+ static final int TRIANGLES = 9; // vertices
313
+ static final int TRIANGLE_STRIP = 10; // vertices
314
+ static final int TRIANGLE_FAN = 11; // vertices
315
+
316
+ static final int QUAD = 16; // primitive
317
+ static final int QUADS = 17; // vertices
318
+ static final int QUAD_STRIP = 18; // vertices
319
+
320
+ static final int POLYGON = 20; // in the end, probably cannot
321
+ static final int PATH = 21; // separate these two
322
+
323
+ static final int RECT = 30; // primitive
324
+ static final int ELLIPSE = 31; // primitive
325
+ static final int ARC = 32; // primitive
326
+
327
+ static final int SPHERE = 40; // primitive
328
+ static final int BOX = 41; // primitive
301
329
 
302
330
  // static public final int POINT_SPRITES = 52;
303
331
  // static public final int NON_STROKED_SHAPE = 60;
304
332
  // static public final int STROKED_SHAPE = 61;
305
- // shape closing modes
306
- static final int OPEN = 1;
307
- static final int CLOSE = 2;
308
-
309
- // shape drawing modes
310
- /**
311
- * Draw mode convention to use (x, y) to (width, height)
312
- */
313
- static final int CORNER = 0;
314
- /**
315
- * Draw mode convention to use (x1, y1) to (x2, y2) coordinates
316
- */
317
- static final int CORNERS = 1;
318
- /**
319
- * Draw mode from the center, and using the radius
320
- */
321
- static final int RADIUS = 2;
322
- /**
323
- * Draw from the center, using second pair of values as the diameter.
324
- * Formerly called CENTER_DIAMETER in alpha releases.
325
- */
326
- static final int CENTER = 3;
327
- /**
328
- * Synonym for the CENTER constant. Draw from the center, using second pair
329
- * of values as the diameter.
330
- */
331
- static final int DIAMETER = 3;
332
-
333
- // arc drawing modes
334
- //static final int OPEN = 1; // shared
335
- static final int CHORD = 2;
336
- static final int PIE = 3;
337
-
338
- // vertically alignment modes for text
339
- /**
340
- * Default vertical alignment for text placement
341
- */
342
- static final int BASELINE = 0;
343
- /**
344
- * Align text to the top
345
- */
346
- static final int TOP = 101;
347
- /**
348
- * Align text from the bottom, using the baseline.
349
- */
350
- static final int BOTTOM = 102;
351
-
352
- // uv texture orientation modes
353
- /**
354
- * texture coordinates in 0..1 range
355
- */
356
- static final int NORMAL = 1;
357
- /**
358
- * texture coordinates based on image width/height
359
- */
360
- static final int IMAGE = 2;
361
-
362
- // texture wrapping modes
363
- /**
364
- * textures are clamped to their edges
365
- */
366
- public static final int CLAMP = 0;
367
- /**
368
- * textures wrap around when uv values go outside 0..1 range
369
- */
370
- public static final int REPEAT = 1;
371
-
372
- // text placement modes
373
- /**
374
- * textMode(MODEL) is the default, meaning that characters will be affected
375
- * by transformations like any other shapes.
376
- *
377
- * Changed value in 0093 to not interfere with LEFT, CENTER, and RIGHT.
378
- */
379
- static final int MODEL = 4;
380
-
381
- /**
382
- * textMode(SHAPE) draws text using the the glyph outlines of individual
383
- * characters rather than as textures. If the outlines are not available,
384
- * then textMode(SHAPE) will be ignored and textMode(MODEL) will be used
385
- * instead. For this reason, be sure to call textMode()
386
- * <EM>after</EM> calling textFont().
387
- *
388
- * Currently, textMode(SHAPE) is only supported by OPENGL mode. It also
389
- * requires Java 1.2 or higher (OPENGL requires 1.4 anyway)
390
- */
391
- static final int SHAPE = 5;
392
-
393
- // text alignment modes
394
- // are inherited from LEFT, CENTER, RIGHT
395
- // stroke modes
396
- static final int SQUARE = 1; // called 'butt' in the svg spec
397
- static final int ROUND = 1 << 1;
398
- static final int PROJECT = 1 << 2; // called 'square' in the svg spec
399
- static final int MITER = 1 << 3;
400
- static final int BEVEL = 1 << 5;
401
-
402
- // lighting
403
- static final int AMBIENT = 0;
404
- static final int DIRECTIONAL = 1;
405
- //static final int POINT = 2; // shared with shape feature
406
- static final int SPOT = 3;
407
-
408
- // key constants
409
- // only including the most-used of these guys
410
- // if people need more esoteric keys, they can learn about
411
- // the esoteric java KeyEvent api and of virtual keys
412
- // both key and keyCode will equal these values
413
- // for 0125, these were changed to 'char' values, because they
414
- // can be upgraded to ints automatically by Java, but having them
415
- // as ints prevented split(blah, TAB) from working
416
- static final char BACKSPACE = 8;
417
- static final char TAB = 9;
418
- static final char ENTER = 10;
419
- static final char RETURN = 13;
420
- static final char ESC = 27;
421
- static final char DELETE = 127;
422
-
423
- // i.e. if ((key == CODED) && (keyCode == UP))
424
- static final int CODED = 0xffff;
425
-
426
- // key will be CODED and keyCode will be this value
427
- static final int UP = KeyEvent.VK_UP;
428
- static final int DOWN = KeyEvent.VK_DOWN;
429
- static final int LEFT = KeyEvent.VK_LEFT;
430
- static final int RIGHT = KeyEvent.VK_RIGHT;
431
-
432
- // key will be CODED and keyCode will be this value
433
- static final int ALT = KeyEvent.VK_ALT;
434
- static final int CONTROL = KeyEvent.VK_CONTROL;
435
- static final int SHIFT = KeyEvent.VK_SHIFT;
436
-
437
- // orientations (only used on Android, ignored on desktop)
438
- /**
439
- * Screen orientation constant for portrait (the hamburger way).
440
- */
441
- static final int PORTRAIT = 1;
442
- /**
443
- * Screen orientation constant for landscape (the hot dog way).
444
- */
445
- static final int LANDSCAPE = 2;
446
-
447
- /**
448
- * Use with fullScreen() to indicate all available displays.
449
- */
450
- static final int SPAN = 0;
451
-
452
- // cursor types
453
- static final int ARROW = Cursor.DEFAULT_CURSOR;
454
- static final int CROSS = Cursor.CROSSHAIR_CURSOR;
455
- static final int HAND = Cursor.HAND_CURSOR;
456
- static final int MOVE = Cursor.MOVE_CURSOR;
457
- static final int TEXT = Cursor.TEXT_CURSOR;
458
- static final int WAIT = Cursor.WAIT_CURSOR;
459
-
460
- // hints - hint values are positive for the alternate version,
461
- // negative of the same value returns to the normal/default state
462
- @Deprecated
463
- static final int ENABLE_NATIVE_FONTS = 1;
464
- @Deprecated
465
- static final int DISABLE_NATIVE_FONTS = -1;
466
-
467
- static final int DISABLE_DEPTH_TEST = 2;
468
- static final int ENABLE_DEPTH_TEST = -2;
469
-
470
- static final int ENABLE_DEPTH_SORT = 3;
471
- static final int DISABLE_DEPTH_SORT = -3;
472
-
473
- static final int DISABLE_OPENGL_ERRORS = 4;
474
- static final int ENABLE_OPENGL_ERRORS = -4;
475
-
476
- static final int DISABLE_DEPTH_MASK = 5;
477
- static final int ENABLE_DEPTH_MASK = -5;
478
-
479
- static final int DISABLE_OPTIMIZED_STROKE = 6;
480
- static final int ENABLE_OPTIMIZED_STROKE = -6;
481
-
482
- static final int ENABLE_STROKE_PERSPECTIVE = 7;
483
- static final int DISABLE_STROKE_PERSPECTIVE = -7;
484
-
485
- static final int DISABLE_TEXTURE_MIPMAPS = 8;
486
- static final int ENABLE_TEXTURE_MIPMAPS = -8;
487
-
488
- static final int ENABLE_STROKE_PURE = 9;
489
- static final int DISABLE_STROKE_PURE = -9;
490
-
491
- static final int ENABLE_BUFFER_READING = 10;
492
- static final int DISABLE_BUFFER_READING = -10;
493
-
494
- static final int DISABLE_KEY_REPEAT = 11;
495
- static final int ENABLE_KEY_REPEAT = -11;
496
-
497
- static final int DISABLE_ASYNC_SAVEFRAME = 12;
498
- static final int ENABLE_ASYNC_SAVEFRAME = -12;
499
-
500
- static final int HINT_COUNT = 13;
333
+
334
+
335
+ // shape closing modes
336
+
337
+ static final int OPEN = 1;
338
+ static final int CLOSE = 2;
339
+
340
+
341
+ // shape drawing modes
342
+
343
+ /** Draw mode convention to use (x, y) to (width, height) */
344
+ static final int CORNER = 0;
345
+ /** Draw mode convention to use (x1, y1) to (x2, y2) coordinates */
346
+ static final int CORNERS = 1;
347
+ /** Draw mode from the center, and using the radius */
348
+ static final int RADIUS = 2;
349
+ /**
350
+ * Draw from the center, using second pair of values as the diameter.
351
+ * Formerly called CENTER_DIAMETER in alpha releases.
352
+ */
353
+ static final int CENTER = 3;
354
+ /**
355
+ * Synonym for the CENTER constant. Draw from the center,
356
+ * using second pair of values as the diameter.
357
+ */
358
+ static final int DIAMETER = 3;
359
+
360
+
361
+ // arc drawing modes
362
+
363
+ //static final int OPEN = 1; // shared
364
+ static final int CHORD = 2;
365
+ static final int PIE = 3;
366
+
367
+
368
+ // vertically alignment modes for text
369
+
370
+ /** Default vertical alignment for text placement */
371
+ static final int BASELINE = 0;
372
+ /** Align text to the top */
373
+ static final int TOP = 101;
374
+ /** Align text from the bottom, using the baseline. */
375
+ static final int BOTTOM = 102;
376
+
377
+
378
+ // uv texture orientation modes
379
+
380
+ /** texture coordinates in 0..1 range */
381
+ static final int NORMAL = 1;
382
+ /** texture coordinates based on image width/height */
383
+ static final int IMAGE = 2;
384
+
385
+
386
+ // texture wrapping modes
387
+
388
+ /** textures are clamped to their edges */
389
+ public static final int CLAMP = 0;
390
+ /** textures wrap around when uv values go outside 0..1 range */
391
+ public static final int REPEAT = 1;
392
+
393
+
394
+ // text placement modes
395
+
396
+ /**
397
+ * textMode(MODEL) is the default, meaning that characters
398
+ * will be affected by transformations like any other shapes.
399
+ *
400
+ * Changed value in 0093 to not interfere with LEFT, CENTER, and RIGHT.
401
+ */
402
+ static final int MODEL = 4;
403
+
404
+ /**
405
+ * textMode(SHAPE) draws text using the the glyph outlines of
406
+ * individual characters rather than as textures. If the outlines are
407
+ * not available, then textMode(SHAPE) will be ignored and textMode(MODEL)
408
+ * will be used instead. For this reason, be sure to call textMode()
409
+ * <EM>after</EM> calling textFont().
410
+ *
411
+ * Currently, textMode(SHAPE) is only supported by OPENGL mode.
412
+ * It also requires Java 1.2 or higher (OPENGL requires 1.4 anyway)
413
+ */
414
+ static final int SHAPE = 5;
415
+
416
+
417
+ // text alignment modes
418
+ // are inherited from LEFT, CENTER, RIGHT
419
+
420
+ // stroke modes
421
+
422
+ static final int SQUARE = 1; // called 'butt' in the svg spec
423
+ static final int ROUND = 1 << 1;
424
+ static final int PROJECT = 1 << 2; // called 'square' in the svg spec
425
+ static final int MITER = 1 << 3;
426
+ static final int BEVEL = 1 << 5;
427
+
428
+
429
+ // lighting
430
+
431
+ static final int AMBIENT = 0;
432
+ static final int DIRECTIONAL = 1;
433
+ //static final int POINT = 2; // shared with shape feature
434
+ static final int SPOT = 3;
435
+
436
+
437
+ // key constants
438
+
439
+ // only including the most-used of these guys
440
+ // if people need more esoteric keys, they can learn about
441
+ // the esoteric java KeyEvent api and of virtual keys
442
+
443
+ // both key and keyCode will equal these values
444
+ // for 0125, these were changed to 'char' values, because they
445
+ // can be upgraded to ints automatically by Java, but having them
446
+ // as ints prevented split(blah, TAB) from working
447
+ static final char BACKSPACE = 8;
448
+ static final char TAB = 9;
449
+ static final char ENTER = 10;
450
+ static final char RETURN = 13;
451
+ static final char ESC = 27;
452
+ static final char DELETE = 127;
453
+
454
+ // i.e. if ((key == CODED) && (keyCode == UP))
455
+ static final int CODED = 0xffff;
456
+
457
+ // key will be CODED and keyCode will be this value
458
+ static final int UP = KeyEvent.VK_UP;
459
+ static final int DOWN = KeyEvent.VK_DOWN;
460
+ static final int LEFT = KeyEvent.VK_LEFT;
461
+ static final int RIGHT = KeyEvent.VK_RIGHT;
462
+
463
+ // key will be CODED and keyCode will be this value
464
+ static final int ALT = KeyEvent.VK_ALT;
465
+ static final int CONTROL = KeyEvent.VK_CONTROL;
466
+ static final int SHIFT = KeyEvent.VK_SHIFT;
467
+
468
+
469
+ // orientations (only used on Android, ignored on desktop)
470
+
471
+ /** Screen orientation constant for portrait (the hamburger way). */
472
+ static final int PORTRAIT = 1;
473
+ /** Screen orientation constant for landscape (the hot dog way). */
474
+ static final int LANDSCAPE = 2;
475
+
476
+ /** Use with fullScreen() to indicate all available displays. */
477
+ static final int SPAN = 0;
478
+
479
+ // cursor types
480
+
481
+ static final int ARROW = Cursor.DEFAULT_CURSOR;
482
+ static final int CROSS = Cursor.CROSSHAIR_CURSOR;
483
+ static final int HAND = Cursor.HAND_CURSOR;
484
+ static final int MOVE = Cursor.MOVE_CURSOR;
485
+ static final int TEXT = Cursor.TEXT_CURSOR;
486
+ static final int WAIT = Cursor.WAIT_CURSOR;
487
+
488
+
489
+ // hints - hint values are positive for the alternate version,
490
+ // negative of the same value returns to the normal/default state
491
+
492
+ @Deprecated
493
+ static final int ENABLE_NATIVE_FONTS = 1;
494
+ @Deprecated
495
+ static final int DISABLE_NATIVE_FONTS = -1;
496
+
497
+ static final int DISABLE_DEPTH_TEST = 2;
498
+ static final int ENABLE_DEPTH_TEST = -2;
499
+
500
+ static final int ENABLE_DEPTH_SORT = 3;
501
+ static final int DISABLE_DEPTH_SORT = -3;
502
+
503
+ static final int DISABLE_OPENGL_ERRORS = 4;
504
+ static final int ENABLE_OPENGL_ERRORS = -4;
505
+
506
+ static final int DISABLE_DEPTH_MASK = 5;
507
+ static final int ENABLE_DEPTH_MASK = -5;
508
+
509
+ static final int DISABLE_OPTIMIZED_STROKE = 6;
510
+ static final int ENABLE_OPTIMIZED_STROKE = -6;
511
+
512
+ static final int ENABLE_STROKE_PERSPECTIVE = 7;
513
+ static final int DISABLE_STROKE_PERSPECTIVE = -7;
514
+
515
+ static final int DISABLE_TEXTURE_MIPMAPS = 8;
516
+ static final int ENABLE_TEXTURE_MIPMAPS = -8;
517
+
518
+ static final int ENABLE_STROKE_PURE = 9;
519
+ static final int DISABLE_STROKE_PURE = -9;
520
+
521
+ static final int ENABLE_BUFFER_READING = 10;
522
+ static final int DISABLE_BUFFER_READING = -10;
523
+
524
+ static final int DISABLE_KEY_REPEAT = 11;
525
+ static final int ENABLE_KEY_REPEAT = -11;
526
+
527
+ static final int DISABLE_ASYNC_SAVEFRAME = 12;
528
+ static final int ENABLE_ASYNC_SAVEFRAME = -12;
529
+
530
+ static final int HINT_COUNT = 13;
501
531
  }