picrate 0.3.0-java → 0.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/CHANGELOG.md +1 -2
  4. data/README.md +1 -1
  5. data/Rakefile +2 -2
  6. data/lib/picrate.rb +1 -0
  7. data/lib/picrate/app.rb +4 -4
  8. data/lib/picrate/helper_methods.rb +0 -4
  9. data/lib/picrate/version.rb +1 -1
  10. data/library/color_group/color_group.rb +27 -0
  11. data/picrate.gemspec +1 -1
  12. data/pom.rb +5 -5
  13. data/pom.xml +5 -5
  14. data/src/main/java/monkstone/ColorUtil.java +57 -32
  15. data/src/main/java/processing/awt/PShapeJava2D.java +33 -9
  16. data/src/main/java/processing/awt/PSurfaceAWT.java +169 -76
  17. data/src/main/java/processing/core/PApplet.java +15921 -13981
  18. data/src/main/java/processing/core/PConstants.java +981 -475
  19. data/src/main/java/processing/core/PFont.java +202 -50
  20. data/src/main/java/processing/core/PGraphics.java +8470 -7323
  21. data/src/main/java/processing/core/PImage.java +212 -42
  22. data/src/main/java/processing/core/PMatrix.java +160 -21
  23. data/src/main/java/processing/core/PMatrix2D.java +178 -18
  24. data/src/main/java/processing/core/PMatrix3D.java +324 -48
  25. data/src/main/java/processing/core/PShape.java +42 -20
  26. data/src/main/java/processing/core/PShapeOBJ.java +91 -16
  27. data/src/main/java/processing/core/PShapeSVG.java +253 -53
  28. data/src/main/java/processing/core/PStyle.java +179 -34
  29. data/src/main/java/processing/core/PSurface.java +94 -13
  30. data/src/main/java/processing/core/PSurfaceNone.java +140 -35
  31. data/src/main/java/processing/core/PVector.java +87 -10
  32. data/src/main/java/processing/data/JSONObject.java +2 -2
  33. data/src/main/java/processing/event/Event.java +69 -86
  34. data/src/main/java/processing/event/MouseEvent.java +102 -102
  35. data/src/main/java/processing/opengl/PJOGL.java +3 -0
  36. data/test/color_group_test.rb +33 -0
  37. data/vendors/Rakefile +1 -1
  38. metadata +7 -4
@@ -43,89 +43,197 @@ public interface PMatrix {
43
43
 
44
44
  /**
45
45
  * Returns a copy of this PMatrix.
46
+ * @return
46
47
  */
47
48
  public PMatrix get();
48
49
 
49
50
  /**
50
51
  * Copies the matrix contents into a float array.
51
52
  * If target is null (or not the correct size), a new array will be created.
53
+ * @param target
54
+ * @return
52
55
  */
53
56
  public float[] get(float[] target);
54
57
 
55
58
 
56
59
  /**
57
60
  * Make this matrix become a copy of src.
61
+ * @param src
58
62
  */
59
63
  public void set(PMatrix src);
60
64
 
61
65
  /**
62
66
  * Set the contents of this matrix to the contents of source. Fills the
63
67
  * matrix left-to-right, starting in the top row.
68
+ * @param source
64
69
  */
65
70
  public void set(float[] source);
66
71
 
67
72
  /**
68
73
  * Set the matrix content to this 2D matrix or its 3D equivalent.
74
+ * @param m00
75
+ * @param m01
76
+ * @param m10
77
+ * @param m02
78
+ * @param m12
79
+ * @param m11
69
80
  */
70
81
  public void set(float m00, float m01, float m02,
71
82
  float m10, float m11, float m12);
72
83
 
73
84
  /**
74
85
  * Set the matrix content to the 3D matrix supplied, if this matrix is 3D.
86
+ * @param m00
87
+ * @param m01
88
+ * @param m20
89
+ * @param m02
90
+ * @param m03
91
+ * @param m10
92
+ * @param m12
93
+ * @param m11
94
+ * @param m22
95
+ * @param m33
96
+ * @param m13
97
+ * @param m23
98
+ * @param m30
99
+ * @param m31
100
+ * @param m21
101
+ * @param m32
75
102
  */
76
103
  public void set(float m00, float m01, float m02, float m03,
77
104
  float m10, float m11, float m12, float m13,
78
105
  float m20, float m21, float m22, float m23,
79
106
  float m30, float m31, float m32, float m33);
80
107
 
108
+ /**
109
+ *
110
+ * @param tx
111
+ * @param ty
112
+ */
113
+ public void translate(float tx, float ty);
81
114
 
82
- public void translate(float tx, float ty);
115
+ /**
116
+ *
117
+ * @param tx
118
+ * @param ty
119
+ * @param tz
120
+ */
121
+ public void translate(float tx, float ty, float tz);
122
+
123
+ /**
124
+ *
125
+ * @param angle
126
+ */
127
+ public void rotate(float angle);
128
+
129
+ /**
130
+ *
131
+ * @param angle
132
+ */
133
+ public void rotateX(float angle);
134
+
135
+ /**
136
+ *
137
+ * @param angle
138
+ */
139
+ public void rotateY(float angle);
140
+
141
+ /**
142
+ *
143
+ * @param angle
144
+ */
145
+ public void rotateZ(float angle);
146
+
147
+ /**
148
+ *
149
+ * @param angle
150
+ * @param v0
151
+ * @param v1
152
+ * @param v2
153
+ */
154
+ public void rotate(float angle, float v0, float v1, float v2);
155
+
156
+ /**
157
+ *
158
+ * @param s
159
+ */
160
+ public void scale(float s);
161
+
162
+ /**
163
+ *
164
+ * @param sx
165
+ * @param sy
166
+ */
167
+ public void scale(float sx, float sy);
168
+
169
+ /**
170
+ *
171
+ * @param x
172
+ * @param y
173
+ * @param z
174
+ */
175
+ public void scale(float x, float y, float z);
83
176
 
84
- public void translate(float tx, float ty, float tz);
85
-
86
- public void rotate(float angle);
87
-
88
- public void rotateX(float angle);
89
-
90
- public void rotateY(float angle);
91
-
92
- public void rotateZ(float angle);
93
-
94
- public void rotate(float angle, float v0, float v1, float v2);
95
-
96
- public void scale(float s);
97
-
98
- public void scale(float sx, float sy);
99
-
100
- public void scale(float x, float y, float z);
101
-
102
- public void shearX(float angle);
177
+ /**
178
+ *
179
+ * @param angle
180
+ */
181
+ public void shearX(float angle);
103
182
 
104
- public void shearY(float angle);
183
+ /**
184
+ *
185
+ * @param angle
186
+ */
187
+ public void shearY(float angle);
105
188
 
106
189
  /**
107
190
  * Multiply this matrix by another.
191
+ * @param source
108
192
  */
109
193
  public void apply(PMatrix source);
110
194
 
111
195
  /**
112
196
  * Multiply this matrix by another.
197
+ * @param source
113
198
  */
114
199
  public void apply(PMatrix2D source);
115
200
 
116
201
  /**
117
202
  * Multiply this matrix by another.
203
+ * @param source
118
204
  */
119
205
  public void apply(PMatrix3D source);
120
206
 
121
207
  /**
122
208
  * Multiply this matrix by another.
209
+ * @param n00
210
+ * @param n11
211
+ * @param n02
212
+ * @param n10
213
+ * @param n01
214
+ * @param n12
123
215
  */
124
216
  public void apply(float n00, float n01, float n02,
125
217
  float n10, float n11, float n12);
126
218
 
127
219
  /**
128
220
  * Multiply this matrix by another.
221
+ * @param n00
222
+ * @param n32
223
+ * @param n02
224
+ * @param n01
225
+ * @param n21
226
+ * @param n10
227
+ * @param n03
228
+ * @param n11
229
+ * @param n13
230
+ * @param n23
231
+ * @param n22
232
+ * @param n20
233
+ * @param n12
234
+ * @param n31
235
+ * @param n30
236
+ * @param n33
129
237
  */
130
238
  public void apply(float n00, float n01, float n02, float n03,
131
239
  float n10, float n11, float n12, float n13,
@@ -134,27 +242,52 @@ public interface PMatrix {
134
242
 
135
243
  /**
136
244
  * Apply another matrix to the left of this one.
245
+ * @param left
137
246
  */
138
247
  public void preApply(PMatrix left);
139
248
 
140
249
  /**
141
250
  * Apply another matrix to the left of this one.
251
+ * @param left
142
252
  */
143
253
  public void preApply(PMatrix2D left);
144
254
 
145
255
  /**
146
256
  * Apply another matrix to the left of this one. 3D only.
257
+ * @param left
147
258
  */
148
259
  public void preApply(PMatrix3D left);
149
260
 
150
261
  /**
151
262
  * Apply another matrix to the left of this one.
263
+ * @param n00
264
+ * @param n12
265
+ * @param n02
266
+ * @param n10
267
+ * @param n01
268
+ * @param n11
152
269
  */
153
270
  public void preApply(float n00, float n01, float n02,
154
271
  float n10, float n11, float n12);
155
272
 
156
273
  /**
157
274
  * Apply another matrix to the left of this one. 3D only.
275
+ * @param n00
276
+ * @param n10
277
+ * @param n02
278
+ * @param n01
279
+ * @param n33
280
+ * @param n13
281
+ * @param n11
282
+ * @param n03
283
+ * @param n20
284
+ * @param n21
285
+ * @param n12
286
+ * @param n30
287
+ * @param n23
288
+ * @param n22
289
+ * @param n32
290
+ * @param n31
158
291
  */
159
292
  public void preApply(float n00, float n01, float n02, float n03,
160
293
  float n10, float n11, float n12, float n13,
@@ -167,6 +300,9 @@ public interface PMatrix {
167
300
  * The result will be stored in target if target is non-null, and target
168
301
  * will then be the matrix returned. This improves performance if you reuse
169
302
  * target, so it's recommended if you call this many times in draw().
303
+ * @param source
304
+ * @param target
305
+ * @return
170
306
  */
171
307
  public PVector mult(PVector source, PVector target);
172
308
 
@@ -175,6 +311,9 @@ public interface PMatrix {
175
311
  * Multiply a multi-element vector against this matrix.
176
312
  * Supplying and recycling a target array improves performance, so it's
177
313
  * recommended if you call this many times in draw().
314
+ * @param source
315
+ * @param target
316
+ * @return
178
317
  */
179
318
  public float[] mult(float[] source, float[] target);
180
319
 
@@ -38,8 +38,35 @@ package processing.core;
38
38
  */
39
39
  public class PMatrix2D implements PMatrix {
40
40
 
41
- public float m00, m01, m02;
42
- public float m10, m11, m12;
41
+ /**
42
+ *
43
+ */
44
+ public float m00,
45
+
46
+ /**
47
+ *
48
+ */
49
+ m01,
50
+
51
+ /**
52
+ *
53
+ */
54
+ m02;
55
+
56
+ /**
57
+ *
58
+ */
59
+ public float m10,
60
+
61
+ /**
62
+ *
63
+ */
64
+ m11,
65
+
66
+ /**
67
+ *
68
+ */
69
+ m12;
43
70
 
44
71
 
45
72
  /**
@@ -49,15 +76,26 @@ public class PMatrix2D implements PMatrix {
49
76
  reset();
50
77
  }
51
78
 
52
-
53
- public PMatrix2D(float m00, float m01, float m02,
79
+ /**
80
+ *
81
+ * @param m00
82
+ * @param m01
83
+ * @param m02
84
+ * @param m10
85
+ * @param m11
86
+ * @param m12
87
+ */
88
+ public PMatrix2D(float m00, float m01, float m02,
54
89
  float m10, float m11, float m12) {
55
90
  set(m00, m01, m02,
56
91
  m10, m11, m12);
57
92
  }
58
93
 
59
-
60
- public PMatrix2D(PMatrix matrix) {
94
+ /**
95
+ *
96
+ * @param matrix
97
+ */
98
+ public PMatrix2D(PMatrix matrix) {
61
99
  set(matrix);
62
100
  }
63
101
 
@@ -70,6 +108,7 @@ public class PMatrix2D implements PMatrix {
70
108
 
71
109
  /**
72
110
  * Returns a copy of this PMatrix.
111
+ * @return
73
112
  */
74
113
  public PMatrix2D get() {
75
114
  PMatrix2D outgoing = new PMatrix2D();
@@ -82,6 +121,8 @@ public class PMatrix2D implements PMatrix {
82
121
  * Copies the matrix contents into a 6 entry float array.
83
122
  * If target is null (or not the correct size), a new array will be created.
84
123
  * Returned in the order {@code {m00, m01, m02, m10, m11, m12}}.
124
+ * @param target
125
+ * @return
85
126
  */
86
127
  public float[] get(float[] target) {
87
128
  if ((target == null) || (target.length != 6)) {
@@ -101,6 +142,7 @@ public class PMatrix2D implements PMatrix {
101
142
 
102
143
  /**
103
144
  * If matrix is a PMatrix2D, sets this matrix to be a copy of it.
145
+ * @param matrix
104
146
  * @throws IllegalArgumentException If <tt>matrix</tt> is not 2D.
105
147
  */
106
148
  public void set(PMatrix matrix) {
@@ -116,6 +158,7 @@ public class PMatrix2D implements PMatrix {
116
158
 
117
159
  /**
118
160
  * Unavailable in 2D. Does nothing.
161
+ * @param src
119
162
  */
120
163
  public void set(PMatrix3D src) {
121
164
  }
@@ -134,6 +177,12 @@ public class PMatrix2D implements PMatrix {
134
177
 
135
178
  /**
136
179
  * Sets the matrix content.
180
+ * @param m00
181
+ * @param m01
182
+ * @param m02
183
+ * @param m11
184
+ * @param m10
185
+ * @param m12
137
186
  */
138
187
  public void set(float m00, float m01, float m02,
139
188
  float m10, float m11, float m12) {
@@ -144,6 +193,22 @@ public class PMatrix2D implements PMatrix {
144
193
 
145
194
  /**
146
195
  * Unavailable in 2D. Does nothing.
196
+ * @param m00
197
+ * @param m23
198
+ * @param m02
199
+ * @param m01
200
+ * @param m10
201
+ * @param m12
202
+ * @param m03
203
+ * @param m11
204
+ * @param m20
205
+ * @param m21
206
+ * @param m13
207
+ * @param m31
208
+ * @param m33
209
+ * @param m22
210
+ * @param m30
211
+ * @param m32
147
212
  */
148
213
  public void set(float m00, float m01, float m02, float m03,
149
214
  float m10, float m11, float m12, float m13,
@@ -152,8 +217,12 @@ public class PMatrix2D implements PMatrix {
152
217
 
153
218
  }
154
219
 
155
-
156
- public void translate(float tx, float ty) {
220
+ /**
221
+ *
222
+ * @param tx
223
+ * @param ty
224
+ */
225
+ public void translate(float tx, float ty) {
157
226
  m02 = tx*m00 + ty*m01 + m02;
158
227
  m12 = tx*m10 + ty*m11 + m12;
159
228
  }
@@ -161,6 +230,9 @@ public class PMatrix2D implements PMatrix {
161
230
 
162
231
  /**
163
232
  * Unavailable in 2D.
233
+ * @param x
234
+ * @param y
235
+ * @param z
164
236
  * @throws IllegalArgumentException
165
237
  */
166
238
  public void translate(float x, float y, float z) {
@@ -169,6 +241,11 @@ public class PMatrix2D implements PMatrix {
169
241
 
170
242
 
171
243
  // Implementation roughly based on AffineTransform.
244
+
245
+ /**
246
+ *
247
+ * @param angle
248
+ */
172
249
  public void rotate(float angle) {
173
250
  float s = sin(angle);
174
251
  float c = cos(angle);
@@ -186,6 +263,7 @@ public class PMatrix2D implements PMatrix {
186
263
 
187
264
  /**
188
265
  * Unavailable in 2D.
266
+ * @param angle
189
267
  * @throws IllegalArgumentException
190
268
  */
191
269
  public void rotateX(float angle) {
@@ -195,33 +273,48 @@ public class PMatrix2D implements PMatrix {
195
273
 
196
274
  /**
197
275
  * Unavailable in 2D.
276
+ * @param angle
198
277
  * @throws IllegalArgumentException
199
278
  */
200
279
  public void rotateY(float angle) {
201
280
  throw new IllegalArgumentException("Cannot use rotateY() on a PMatrix2D.");
202
281
  }
203
282
 
204
-
205
- public void rotateZ(float angle) {
283
+ /**
284
+ *
285
+ * @param angle
286
+ */
287
+ public void rotateZ(float angle) {
206
288
  rotate(angle);
207
289
  }
208
290
 
209
291
 
210
292
  /**
211
293
  * Unavailable in 2D.
294
+ * @param angle
295
+ * @param v0
296
+ * @param v1
297
+ * @param v2
212
298
  * @throws IllegalArgumentException
213
299
  */
214
300
  public void rotate(float angle, float v0, float v1, float v2) {
215
301
  throw new IllegalArgumentException("Cannot use this version of rotate() on a PMatrix2D.");
216
302
  }
217
303
 
218
-
219
- public void scale(float s) {
304
+ /**
305
+ *
306
+ * @param s
307
+ */
308
+ public void scale(float s) {
220
309
  scale(s, s);
221
310
  }
222
311
 
223
-
224
- public void scale(float sx, float sy) {
312
+ /**
313
+ *
314
+ * @param sx
315
+ * @param sy
316
+ */
317
+ public void scale(float sx, float sy) {
225
318
  m00 *= sx; m01 *= sy;
226
319
  m10 *= sx; m11 *= sy;
227
320
  }
@@ -229,19 +322,28 @@ public class PMatrix2D implements PMatrix {
229
322
 
230
323
  /**
231
324
  * Unavailable in 2D.
325
+ * @param x
326
+ * @param y
327
+ * @param z
232
328
  * @throws IllegalArgumentException
233
329
  */
234
330
  public void scale(float x, float y, float z) {
235
331
  throw new IllegalArgumentException("Cannot use this version of scale() on a PMatrix2D.");
236
332
  }
237
333
 
238
-
239
- public void shearX(float angle) {
334
+ /**
335
+ *
336
+ * @param angle
337
+ */
338
+ public void shearX(float angle) {
240
339
  apply(1, 0, 1, tan(angle), 0, 0);
241
340
  }
242
341
 
243
-
244
- public void shearY(float angle) {
342
+ /**
343
+ *
344
+ * @param angle
345
+ */
346
+ public void shearY(float angle) {
245
347
  apply(1, 0, 1, 0, tan(angle), 0);
246
348
  }
247
349
 
@@ -263,6 +365,7 @@ public class PMatrix2D implements PMatrix {
263
365
 
264
366
  /**
265
367
  * Unavailable in 2D.
368
+ * @param source
266
369
  * @throws IllegalArgumentException
267
370
  */
268
371
  public void apply(PMatrix3D source) {
@@ -288,6 +391,22 @@ public class PMatrix2D implements PMatrix {
288
391
 
289
392
  /**
290
393
  * Unavailable in 2D.
394
+ * @param n00
395
+ * @param n21
396
+ * @param n02
397
+ * @param n01
398
+ * @param n03
399
+ * @param n11
400
+ * @param n10
401
+ * @param n30
402
+ * @param n23
403
+ * @param n13
404
+ * @param n12
405
+ * @param n22
406
+ * @param n32
407
+ * @param n20
408
+ * @param n31
409
+ * @param n33
291
410
  * @throws IllegalArgumentException
292
411
  */
293
412
  public void apply(float n00, float n01, float n02, float n03,
@@ -300,6 +419,7 @@ public class PMatrix2D implements PMatrix {
300
419
 
301
420
  /**
302
421
  * Apply another matrix to the left of this one.
422
+ * @param source
303
423
  */
304
424
  public void preApply(PMatrix source) {
305
425
  if (source instanceof PMatrix2D) {
@@ -318,6 +438,7 @@ public class PMatrix2D implements PMatrix {
318
438
 
319
439
  /**
320
440
  * Unavailable in 2D.
441
+ * @param left
321
442
  * @throws IllegalArgumentException
322
443
  */
323
444
  public void preApply(PMatrix3D left) {
@@ -349,6 +470,22 @@ public class PMatrix2D implements PMatrix {
349
470
 
350
471
  /**
351
472
  * Unavailable in 2D.
473
+ * @param n00
474
+ * @param n01
475
+ * @param n03
476
+ * @param n02
477
+ * @param n10
478
+ * @param n12
479
+ * @param n21
480
+ * @param n13
481
+ * @param n11
482
+ * @param n30
483
+ * @param n23
484
+ * @param n20
485
+ * @param n32
486
+ * @param n22
487
+ * @param n31
488
+ * @param n33
352
489
  * @throws IllegalArgumentException
353
490
  */
354
491
  public void preApply(float n00, float n01, float n02, float n03,
@@ -380,6 +517,9 @@ public class PMatrix2D implements PMatrix {
380
517
  * Multiply a two element vector against this matrix.
381
518
  * If out is null or not length four, a new float array will be returned.
382
519
  * The values for vec and out can be the same (though that's less efficient).
520
+ * @param vec
521
+ * @param out
522
+ * @return
383
523
  */
384
524
  public float[] mult(float vec[], float out[]) {
385
525
  if (out == null || out.length != 2) {
@@ -405,6 +545,9 @@ public class PMatrix2D implements PMatrix {
405
545
  /**
406
546
  * Returns the x-coordinate of the result of multiplying the point (x, y)
407
547
  * by this matrix.
548
+ * @param x
549
+ * @param y
550
+ * @return
408
551
  */
409
552
  public float multX(float x, float y) {
410
553
  return m00*x + m01*y + m02;
@@ -414,6 +557,9 @@ public class PMatrix2D implements PMatrix {
414
557
  /**
415
558
  * Returns the y-coordinate of the result of multiplying the point (x, y)
416
559
  * by this matrix.
560
+ * @param x
561
+ * @param y
562
+ * @return
417
563
  */
418
564
  public float multY(float x, float y) {
419
565
  return m10*x + m11*y + m12;
@@ -465,6 +611,10 @@ public class PMatrix2D implements PMatrix {
465
611
 
466
612
  //////////////////////////////////////////////////////////////
467
613
 
614
+ /**
615
+ *
616
+ */
617
+
468
618
 
469
619
  public void print() {
470
620
  int big = (int) abs(max(PApplet.max(abs(m00), abs(m01), abs(m02)),
@@ -495,6 +645,11 @@ public class PMatrix2D implements PMatrix {
495
645
  // implementation needs to be improved first. (e.g. actually keeping track
496
646
  // of whether the matrix is in fact identity internally.)
497
647
 
648
+ /**
649
+ *
650
+ * @return
651
+ */
652
+
498
653
 
499
654
  protected boolean isIdentity() {
500
655
  return ((m00 == 1) && (m01 == 0) && (m02 == 0) &&
@@ -503,6 +658,11 @@ public class PMatrix2D implements PMatrix {
503
658
 
504
659
 
505
660
  // TODO make this more efficient, or move into PMatrix2D
661
+
662
+ /**
663
+ *
664
+ * @return
665
+ */
506
666
  protected boolean isWarped() {
507
667
  return ((m00 != 1) || (m01 != 0) &&
508
668
  (m10 != 0) || (m11 != 1));