picrate 0.3.0-java → 0.4.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -99,7 +99,11 @@ public class PImage implements PConstants, Cloneable {
99
99
 
100
100
  /** Actual dimensions of pixels array, taking into account the 2x setting. */
101
101
  public int pixelWidth;
102
- public int pixelHeight;
102
+
103
+ /**
104
+ *
105
+ */
106
+ public int pixelHeight;
103
107
 
104
108
  /**
105
109
  * ( begin auto-generated from PImage_width.xml )
@@ -137,7 +141,26 @@ public class PImage implements PConstants, Cloneable {
137
141
 
138
142
  /** modified portion of the image */
139
143
  protected boolean modified;
140
- protected int mx1, my1, mx2, my2;
144
+
145
+ /**
146
+ *
147
+ */
148
+ protected int mx1,
149
+
150
+ /**
151
+ *
152
+ */
153
+ my1,
154
+
155
+ /**
156
+ *
157
+ */
158
+ mx2,
159
+
160
+ /**
161
+ *
162
+ */
163
+ my2;
141
164
 
142
165
  /** Loaded pixels flag */
143
166
  public boolean loaded = false;
@@ -166,10 +189,26 @@ public class PImage implements PConstants, Cloneable {
166
189
  private int[][] blurMult;
167
190
 
168
191
  // colour component bitmasks (moved from PConstants in 2.0b7)
192
+
193
+ /**
194
+ *
195
+ */
169
196
  public static final int ALPHA_MASK = 0xff000000;
170
- public static final int RED_MASK = 0x00ff0000;
171
- public static final int GREEN_MASK = 0x0000ff00;
172
- public static final int BLUE_MASK = 0x000000ff;
197
+
198
+ /**
199
+ *
200
+ */
201
+ public static final int RED_MASK = 0x00ff0000;
202
+
203
+ /**
204
+ *
205
+ */
206
+ public static final int GREEN_MASK = 0x0000ff00;
207
+
208
+ /**
209
+ *
210
+ */
211
+ public static final int BLUE_MASK = 0x000000ff;
173
212
 
174
213
 
175
214
  //////////////////////////////////////////////////////////////
@@ -227,6 +266,8 @@ public class PImage implements PConstants, Cloneable {
227
266
 
228
267
 
229
268
  /**
269
+ * @param width
270
+ * @param height
230
271
  * @nowebref
231
272
  * @param format Either RGB, ARGB, ALPHA (grayscale alpha channel)
232
273
  */
@@ -234,14 +275,23 @@ public class PImage implements PConstants, Cloneable {
234
275
  init(width, height, format, 1);
235
276
  }
236
277
 
237
-
238
- public PImage(int width, int height, int format, int factor) {
278
+ /**
279
+ *
280
+ * @param width
281
+ * @param height
282
+ * @param format
283
+ * @param factor
284
+ */
285
+ public PImage(int width, int height, int format, int factor) {
239
286
  init(width, height, format, factor);
240
287
  }
241
288
 
242
289
 
243
290
  /**
244
291
  * Do not remove, see notes in the other variant.
292
+ * @param width
293
+ * @param height
294
+ * @param format
245
295
  */
246
296
  public void init(int width, int height, int format) { // ignore
247
297
  init(width, height, format, 1);
@@ -254,6 +304,10 @@ public class PImage implements PConstants, Cloneable {
254
304
  * Used by Capture and Movie classes (and perhaps others),
255
305
  * because the width/height will not be known when super() is called.
256
306
  * (Leave this public so that other libraries can do the same.)
307
+ * @param width
308
+ * @param factor
309
+ * @param height
310
+ * @param format
257
311
  */
258
312
  public void init(int width, int height, int format, int factor) { // ignore
259
313
  this.width = width;
@@ -346,6 +400,7 @@ public class PImage implements PConstants, Cloneable {
346
400
  * Use the getNative() method instead, which allows library interfaces to be
347
401
  * written in a cross-platform fashion for desktop, Android, and others.
348
402
  * This is still included for PGraphics objects, which may need the image.
403
+ * @return
349
404
  */
350
405
  public Image getImage() { // ignore
351
406
  return (Image) getNative();
@@ -354,6 +409,7 @@ public class PImage implements PConstants, Cloneable {
354
409
 
355
410
  /**
356
411
  * Returns a native BufferedImage from this PImage.
412
+ * @return
357
413
  */
358
414
  public Object getNative() { // ignore
359
415
  loadPixels();
@@ -370,13 +426,20 @@ public class PImage implements PConstants, Cloneable {
370
426
 
371
427
  // MARKING IMAGE AS MODIFIED / FOR USE w/ GET/SET
372
428
 
429
+ /**
430
+ *
431
+ * @return
432
+ */
433
+
373
434
 
374
435
  public boolean isModified() { // ignore
375
436
  return modified;
376
437
  }
377
438
 
378
-
379
- public void setModified() { // ignore
439
+ /**
440
+ *
441
+ */
442
+ public void setModified() { // ignore
380
443
  modified = true;
381
444
  mx1 = 0;
382
445
  my1 = 0;
@@ -384,28 +447,43 @@ public class PImage implements PConstants, Cloneable {
384
447
  my2 = pixelHeight;
385
448
  }
386
449
 
387
-
388
- public void setModified(boolean m) { // ignore
450
+ /**
451
+ *
452
+ * @param m
453
+ */
454
+ public void setModified(boolean m) { // ignore
389
455
  modified = m;
390
456
  }
391
457
 
392
-
393
- public int getModifiedX1() { // ignore
458
+ /**
459
+ *
460
+ * @return
461
+ */
462
+ public int getModifiedX1() { // ignore
394
463
  return mx1;
395
464
  }
396
465
 
397
-
398
- public int getModifiedX2() { // ignore
466
+ /**
467
+ *
468
+ * @return
469
+ */
470
+ public int getModifiedX2() { // ignore
399
471
  return mx2;
400
472
  }
401
473
 
402
-
403
- public int getModifiedY1() { // ignore
474
+ /**
475
+ *
476
+ * @return
477
+ */
478
+ public int getModifiedY1() { // ignore
404
479
  return my1;
405
480
  }
406
481
 
407
-
408
- public int getModifiedY2() { // ignore
482
+ /**
483
+ *
484
+ * @return
485
+ */
486
+ public int getModifiedY2() { // ignore
409
487
  return my2;
410
488
  }
411
489
 
@@ -442,8 +520,10 @@ public class PImage implements PConstants, Cloneable {
442
520
  setLoaded();
443
521
  }
444
522
 
445
-
446
- public void updatePixels() { // ignore
523
+ /**
524
+ *
525
+ */
526
+ public void updatePixels() { // ignore
447
527
  updatePixels(0, 0, pixelWidth, pixelHeight);
448
528
  }
449
529
 
@@ -516,6 +596,8 @@ public class PImage implements PConstants, Cloneable {
516
596
  * override of Object.clone(). We recommend using get() instead,
517
597
  * because it prevents you from needing to catch the
518
598
  * CloneNotSupportedException, and from doing a cast from the result.
599
+ * @return
600
+ * @throws java.lang.CloneNotSupportedException
519
601
  */
520
602
  @Override
521
603
  public Object clone() throws CloneNotSupportedException { // ignore
@@ -652,18 +734,28 @@ public class PImage implements PConstants, Cloneable {
652
734
 
653
735
  // MARKING IMAGE AS LOADED / FOR USE IN RENDERERS
654
736
 
737
+ /**
738
+ *
739
+ * @return
740
+ */
741
+
655
742
 
656
743
  public boolean isLoaded() { // ignore
657
744
  return loaded;
658
745
  }
659
746
 
660
-
661
- public void setLoaded() { // ignore
747
+ /**
748
+ *
749
+ */
750
+ public void setLoaded() { // ignore
662
751
  loaded = true;
663
752
  }
664
753
 
665
-
666
- public void setLoaded(boolean l) { // ignore
754
+ /**
755
+ *
756
+ * @param l
757
+ */
758
+ public void setLoaded(boolean l) { // ignore
667
759
  loaded = l;
668
760
  }
669
761
 
@@ -715,6 +807,7 @@ public class PImage implements PConstants, Cloneable {
715
807
  * type it is. If you want things to be more efficient, access the
716
808
  * pixels[] array directly.
717
809
  *
810
+ * @return
718
811
  * @webref image:pixels
719
812
  * @brief Reads the color of any pixel or grabs a rectangle of pixels
720
813
  * @usage web_application
@@ -742,8 +835,11 @@ public class PImage implements PConstants, Cloneable {
742
835
 
743
836
 
744
837
  /**
838
+ * @param x
839
+ * @param y
745
840
  * @param w width of pixel rectangle to get
746
841
  * @param h height of pixel rectangle to get
842
+ * @return
747
843
  */
748
844
  public PImage get(int x, int y, int w, int h) {
749
845
  int targetX = 0;
@@ -800,6 +896,7 @@ public class PImage implements PConstants, Cloneable {
800
896
  /**
801
897
  * Returns a copy of this PImage. Equivalent to get(0, 0, width, height).
802
898
  * Deprecated, just use copy() instead.
899
+ * @return
803
900
  */
804
901
  public PImage get() {
805
902
  // Formerly this used clone(), which caused memory problems.
@@ -807,8 +904,11 @@ public class PImage implements PConstants, Cloneable {
807
904
  return get(0, 0, pixelWidth, pixelHeight);
808
905
  }
809
906
 
810
-
811
- public PImage copy() {
907
+ /**
908
+ *
909
+ * @return
910
+ */
911
+ public PImage copy() {
812
912
  return get(0, 0, pixelWidth, pixelHeight);
813
913
  }
814
914
 
@@ -818,6 +918,13 @@ public class PImage implements PConstants, Cloneable {
818
918
  * has already been properly cropped to a valid region. That is, x/y/w/h
819
919
  * are guaranteed to be inside the image space, so the implementation can
820
920
  * use the fastest possible pixel copying method.
921
+ * @param sourceX
922
+ * @param sourceY
923
+ * @param sourceWidth
924
+ * @param target
925
+ * @param sourceHeight
926
+ * @param targetX
927
+ * @param targetY
821
928
  */
822
929
  protected void getImpl(int sourceX, int sourceY,
823
930
  int sourceWidth, int sourceHeight,
@@ -876,7 +983,9 @@ public class PImage implements PConstants, Cloneable {
876
983
  * No variations are employed, meaning that any scale, tint, or imageMode
877
984
  * settings will be ignored.
878
985
  *
986
+ * @param x
879
987
  * @param img image to copy into the original image
988
+ * @param y
880
989
  */
881
990
  public void set(int x, int y, PImage img) {
882
991
  int sx = 0;
@@ -911,6 +1020,13 @@ public class PImage implements PConstants, Cloneable {
911
1020
  /**
912
1021
  * Internal function to actually handle setting a block of pixels that
913
1022
  * has already been properly cropped from the image to a valid region.
1023
+ * @param sourceImage
1024
+ * @param sourceX
1025
+ * @param targetY
1026
+ * @param sourceHeight
1027
+ * @param sourceY
1028
+ * @param sourceWidth
1029
+ * @param targetX
914
1030
  */
915
1031
  protected void setImpl(PImage sourceImage,
916
1032
  int sourceX, int sourceY,
@@ -1000,6 +1116,11 @@ public class PImage implements PConstants, Cloneable {
1000
1116
 
1001
1117
  // IMAGE FILTERS
1002
1118
 
1119
+ /**
1120
+ *
1121
+ * @param kind
1122
+ */
1123
+
1003
1124
 
1004
1125
  public void filter(int kind) {
1005
1126
  loadPixels();
@@ -1208,6 +1329,7 @@ public class PImage implements PConstants, Cloneable {
1208
1329
  * bigger speed gains for larger radii (~30%)
1209
1330
  * added support for various image types (ALPHA, RGB, ARGB)
1210
1331
  * [toxi 050728]
1332
+ * @param r
1211
1333
  */
1212
1334
  protected void buildBlurKernel(float r) {
1213
1335
  int radius = (int) (r * 3.5f);
@@ -1235,8 +1357,11 @@ public class PImage implements PConstants, Cloneable {
1235
1357
  }
1236
1358
  }
1237
1359
 
1238
-
1239
- protected void blurAlpha(float r) {
1360
+ /**
1361
+ *
1362
+ * @param r
1363
+ */
1364
+ protected void blurAlpha(float r) {
1240
1365
  int sum, cb;
1241
1366
  int read, ri, ym, ymi, bk0;
1242
1367
  int b2[] = new int[pixels.length];
@@ -1306,8 +1431,11 @@ public class PImage implements PConstants, Cloneable {
1306
1431
  }
1307
1432
  }
1308
1433
 
1309
-
1310
- protected void blurRGB(float r) {
1434
+ /**
1435
+ *
1436
+ * @param r
1437
+ */
1438
+ protected void blurRGB(float r) {
1311
1439
  int sum, cr, cg, cb; //, k;
1312
1440
  int /*pixel,*/ read, ri, /*roff,*/ ym, ymi, /*riw,*/ bk0;
1313
1441
  int r2[] = new int[pixels.length];
@@ -1388,8 +1516,11 @@ public class PImage implements PConstants, Cloneable {
1388
1516
  }
1389
1517
  }
1390
1518
 
1391
-
1392
- protected void blurARGB(float r) {
1519
+ /**
1520
+ *
1521
+ * @param r
1522
+ */
1523
+ protected void blurARGB(float r) {
1393
1524
  int sum, cr, cg, cb, ca;
1394
1525
  int /*pixel,*/ read, ri, /*roff,*/ ym, ymi, /*riw,*/ bk0;
1395
1526
  int wh = pixels.length;
@@ -1548,8 +1679,10 @@ public class PImage implements PConstants, Cloneable {
1548
1679
  System.arraycopy(outgoing, 0, pixels, 0, maxIndex);
1549
1680
  }
1550
1681
 
1551
-
1552
- protected void erode() { // formerly dilate(true)
1682
+ /**
1683
+ *
1684
+ */
1685
+ protected void erode() { // formerly dilate(true)
1553
1686
  int index = 0;
1554
1687
  int maxIndex = pixels.length;
1555
1688
  int[] outgoing = new int[maxIndex];
@@ -1659,6 +1792,14 @@ public class PImage implements PConstants, Cloneable {
1659
1792
 
1660
1793
  /**
1661
1794
  * @param src an image variable referring to the source image.
1795
+ * @param sx
1796
+ * @param sy
1797
+ * @param dh
1798
+ * @param sw
1799
+ * @param dx
1800
+ * @param sh
1801
+ * @param dy
1802
+ * @param dw
1662
1803
  */
1663
1804
  public void copy(PImage src,
1664
1805
  int sx, int sy, int sw, int sh,
@@ -1744,6 +1885,7 @@ public class PImage implements PConstants, Cloneable {
1744
1885
  * are preferrable, and the difference is insignificant for applications
1745
1886
  * built with Processing.</P>
1746
1887
  *
1888
+ * @return
1747
1889
  * @webref color:creating_reading
1748
1890
  * @usage web_application
1749
1891
  * @param c1 the first color to blend
@@ -1779,8 +1921,19 @@ public class PImage implements PConstants, Cloneable {
1779
1921
  return 0;
1780
1922
  }
1781
1923
 
1782
-
1783
- public void blend(int sx, int sy, int sw, int sh,
1924
+ /**
1925
+ *
1926
+ * @param sx
1927
+ * @param sy
1928
+ * @param sw
1929
+ * @param sh
1930
+ * @param dx
1931
+ * @param dy
1932
+ * @param dw
1933
+ * @param dh
1934
+ * @param mode
1935
+ */
1936
+ public void blend(int sx, int sy, int sw, int sh,
1784
1937
  int dx, int dy, int dw, int dh, int mode) {
1785
1938
  blend(this, sx, sy, sw, sh, dx, dy, dw, dh, mode);
1786
1939
  }
@@ -2961,7 +3114,12 @@ int testFunction(int dst, int src) {
2961
3114
  static final String TIFF_ERROR =
2962
3115
  "Error: Processing can only read its own TIFF files.";
2963
3116
 
2964
- static protected PImage loadTIFF(byte tiff[]) {
3117
+ /**
3118
+ *
3119
+ * @param tiff
3120
+ * @return
3121
+ */
3122
+ static protected PImage loadTIFF(byte tiff[]) {
2965
3123
  if ((tiff[42] != tiff[102]) || // width/height in both places
2966
3124
  (tiff[43] != tiff[103])) {
2967
3125
  System.err.println(TIFF_ERROR);
@@ -3008,8 +3166,12 @@ int testFunction(int dst, int src) {
3008
3166
  return outgoing;
3009
3167
  }
3010
3168
 
3011
-
3012
- protected boolean saveTIFF(OutputStream output) {
3169
+ /**
3170
+ *
3171
+ * @param output
3172
+ * @return
3173
+ */
3174
+ protected boolean saveTIFF(OutputStream output) {
3013
3175
  // shutting off the warning, people can figure this out themselves
3014
3176
  /*
3015
3177
  if (format != RGB) {
@@ -3067,6 +3229,8 @@ int testFunction(int dst, int src) {
3067
3229
  * </p>
3068
3230
  * Contributed by toxi 8-10 May 2005, based on this RLE
3069
3231
  * <A HREF="http://www.wotsit.org/download.asp?f=tga">specification</A>
3232
+ * @param output
3233
+ * @return
3070
3234
  */
3071
3235
  protected boolean saveTGA(OutputStream output) {
3072
3236
  byte header[] = new byte[18];
@@ -3209,6 +3373,9 @@ int testFunction(int dst, int src) {
3209
3373
  * Various formats are supported, typically jpeg, png, bmp, and wbmp.
3210
3374
  * To get a list of the supported formats for writing, use: <BR>
3211
3375
  * <TT>println(javax.imageio.ImageIO.getReaderFormatNames())</TT>
3376
+ * @param path
3377
+ * @return
3378
+ * @throws java.io.IOException
3212
3379
  */
3213
3380
  protected boolean saveImageIO(String path) throws IOException {
3214
3381
  try {
@@ -3322,8 +3489,10 @@ int testFunction(int dst, int src) {
3322
3489
  return null;
3323
3490
  }
3324
3491
 
3325
-
3326
- protected String[] saveImageFormats;
3492
+ /**
3493
+ *
3494
+ */
3495
+ protected String[] saveImageFormats;
3327
3496
 
3328
3497
  /**
3329
3498
  * ( begin auto-generated from PImage_save.xml )
@@ -3366,6 +3535,7 @@ int testFunction(int dst, int src) {
3366
3535
  * require a black and white image. Basic testing produced a zero-length
3367
3536
  * file with no error.
3368
3537
  *
3538
+ * @return
3369
3539
  * @webref pimage:method
3370
3540
  * @brief Saves the image to a TIFF, TARGA, PNG, or JPEG file
3371
3541
  * @usage application