picrate 0.5.0-java → 0.6.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  3. data/CHANGELOG.md +3 -1
  4. data/README.md +1 -1
  5. data/Rakefile +8 -6
  6. data/docs/_editors/geany.md +5 -4
  7. data/docs/_editors/vim.md +6 -0
  8. data/docs/_includes/head.html +1 -0
  9. data/docs/_libraries/control_panel.md +2 -2
  10. data/docs/_libraries/gl_video.md +21 -0
  11. data/docs/_posts/2018-05-06-getting_started.md +10 -9
  12. data/docs/_posts/2018-05-06-install_jruby.md +19 -2
  13. data/docs/_posts/2018-06-26-auto_install_picrate.md +19 -4
  14. data/docs/_posts/2018-11-18-building-gem.md +18 -0
  15. data/docs/_posts/2018-11-27-getting_started_geany.md +38 -0
  16. data/docs/about.md +21 -10
  17. data/docs/assets/android-chrome-192x192.png +0 -0
  18. data/docs/assets/android-chrome-512x512.png +0 -0
  19. data/docs/assets/favicon.ico +0 -0
  20. data/docs/assets/geany.png +0 -0
  21. data/docs/assets/jwishy_picrate.png +0 -0
  22. data/docs/assets/picrate.svg +251 -0
  23. data/docs/index.html +8 -14
  24. data/lib/picrate/runner.rb +6 -2
  25. data/lib/picrate/version.rb +1 -1
  26. data/library/boids/boids.rb +10 -13
  27. data/mvnw +234 -0
  28. data/picrate.gemspec +2 -1
  29. data/pom.rb +1 -1
  30. data/pom.xml +1 -1
  31. data/src/main/java/japplemenubar/JAppleMenuBar.java +10 -2
  32. data/src/main/java/monkstone/ColorUtil.java +11 -1
  33. data/src/main/java/monkstone/MathToolModule.java +1 -0
  34. data/src/main/java/monkstone/PicrateLibrary.java +1 -0
  35. data/src/main/java/monkstone/fastmath/Deglut.java +1 -0
  36. data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
  37. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  38. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  39. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  40. data/src/main/java/monkstone/slider/SimpleSlider.java +8 -8
  41. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  42. data/src/main/java/monkstone/slider/Slider.java +3 -3
  43. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  44. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  45. data/src/main/java/monkstone/vecmath/AppRender.java +1 -0
  46. data/src/main/java/monkstone/vecmath/JRender.java +1 -0
  47. data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -0
  48. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -0
  49. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -0
  50. data/src/main/java/processing/awt/PGraphicsJava2D.java +85 -16
  51. data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
  52. data/src/main/java/processing/core/PApplet.java +18 -12
  53. data/src/main/java/processing/core/PShape.java +1182 -305
  54. data/src/main/java/processing/core/PStyle.java +1 -1
  55. data/src/main/java/processing/core/PSurface.java +1 -1
  56. data/src/main/java/processing/data/FloatDict.java +196 -54
  57. data/src/main/java/processing/data/FloatList.java +167 -54
  58. data/src/main/java/processing/data/IntDict.java +211 -56
  59. data/src/main/java/processing/data/IntList.java +185 -52
  60. data/src/main/java/processing/data/JSONArray.java +69 -20
  61. data/src/main/java/processing/data/JSONObject.java +53 -12
  62. data/src/main/java/processing/data/Sort.java +40 -10
  63. data/src/main/java/processing/data/StringDict.java +159 -49
  64. data/src/main/java/processing/data/StringList.java +147 -42
  65. data/src/main/java/processing/data/Table.java +778 -223
  66. data/src/main/java/processing/data/TableRow.java +26 -2
  67. data/src/main/java/processing/data/XML.java +190 -50
  68. data/src/main/java/processing/event/Event.java +93 -0
  69. data/src/main/java/processing/event/KeyEvent.java +55 -13
  70. data/src/main/java/processing/event/MouseEvent.java +77 -1
  71. data/src/main/java/processing/event/TouchEvent.java +14 -1
  72. data/src/main/java/processing/javafx/PGraphicsFX2D.java +8 -0
  73. data/src/main/java/processing/opengl/FrameBuffer.java +228 -66
  74. data/src/main/java/processing/opengl/LinePath.java +131 -27
  75. data/src/main/java/processing/opengl/LineStroker.java +30 -5
  76. data/src/main/java/processing/opengl/PGL.java +4066 -865
  77. data/src/main/java/processing/opengl/PGraphics2D.java +38 -10
  78. data/src/main/java/processing/opengl/PGraphics3D.java +38 -6
  79. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +1980 -474
  80. data/src/main/java/processing/opengl/PJOGL.java +1460 -248
  81. data/src/main/java/processing/opengl/PShader.java +904 -217
  82. data/src/main/java/processing/opengl/PShapeOpenGL.java +1811 -487
  83. data/src/main/java/processing/opengl/PSurfaceJOGL.java +278 -71
  84. data/src/main/java/processing/opengl/Texture.java +610 -135
  85. data/src/main/java/processing/opengl/VertexBuffer.java +45 -9
  86. data/src/main/resources/icon/icon-1024.png +0 -0
  87. data/src/main/resources/icon/icon-128.png +0 -0
  88. data/src/main/resources/icon/icon-16.png +0 -0
  89. data/src/main/resources/icon/icon-256.png +0 -0
  90. data/src/main/resources/icon/icon-32.png +0 -0
  91. data/src/main/resources/icon/icon-48.png +0 -0
  92. data/src/main/resources/icon/icon-512.png +0 -0
  93. data/src/main/resources/icon/icon-64.png +0 -0
  94. data/vendors/Rakefile +1 -1
  95. metadata +13 -6
  96. data/docs/assets/circle_collisions.png +0 -0
  97. data/docs/favicon.ico +0 -0
@@ -71,66 +71,224 @@ public class Texture implements PConstants {
71
71
  // This constant controls how many times pixelBuffer and rgbaPixels can be
72
72
  // accessed before they are not released anymore. The idea is that if they
73
73
  // have been used only a few times, it doesn't make sense to keep them around.
74
+
75
+ /**
76
+ *
77
+ */
74
78
  protected static final int MAX_UPDATES = 10;
75
79
 
76
80
  // The minimum amount of free JVM's memory (in MB) before pixelBuffer and
77
81
  // rgbaPixels are released every time after they are used.
82
+
83
+ /**
84
+ *
85
+ */
78
86
  protected static final int MIN_MEMORY = 5;
79
87
 
80
- public int width, height;
81
-
82
- public int glName;
83
- public int glTarget;
84
- public int glFormat;
85
- public int glMinFilter;
86
- public int glMagFilter;
87
- public int glWrapS;
88
- public int glWrapT;
89
- public int glWidth;
90
- public int glHeight;
88
+ /**
89
+ *
90
+ */
91
+ public int width,
92
+
93
+ /**
94
+ *
95
+ */
96
+ height;
97
+
98
+ /**
99
+ *
100
+ */
101
+ public int glName;
102
+
103
+ /**
104
+ *
105
+ */
106
+ public int glTarget;
107
+
108
+ /**
109
+ *
110
+ */
111
+ public int glFormat;
112
+
113
+ /**
114
+ *
115
+ */
116
+ public int glMinFilter;
117
+
118
+ /**
119
+ *
120
+ */
121
+ public int glMagFilter;
122
+
123
+ /**
124
+ *
125
+ */
126
+ public int glWrapS;
127
+
128
+ /**
129
+ *
130
+ */
131
+ public int glWrapT;
132
+
133
+ /**
134
+ *
135
+ */
136
+ public int glWidth;
137
+
138
+ /**
139
+ *
140
+ */
141
+ public int glHeight;
91
142
  private GLResourceTexture glres;
92
143
 
93
- protected PGraphicsOpenGL pg;
94
- protected PGL pgl; // The interface between Processing and OpenGL.
95
- protected int context; // The context that created this texture.
96
- protected boolean colorBuffer; // true if it is the color attachment of
144
+ /**
145
+ *
146
+ */
147
+ protected PGraphicsOpenGL pg;
148
+
149
+ /**
150
+ *
151
+ */
152
+ protected PGL pgl; // The interface between Processing and OpenGL.
153
+
154
+ /**
155
+ *
156
+ */
157
+ protected int context; // The context that created this texture.
158
+
159
+ /**
160
+ *
161
+ */
162
+ protected boolean colorBuffer; // true if it is the color attachment of
97
163
  // FrameBuffer object.
98
164
 
99
- protected boolean usingMipmaps;
100
- protected boolean usingRepeat;
101
- protected float maxTexcoordU;
102
- protected float maxTexcoordV;
103
- protected boolean bound;
165
+ /**
166
+ *
167
+ */
168
+ protected boolean usingMipmaps;
169
+
170
+ /**
171
+ *
172
+ */
173
+ protected boolean usingRepeat;
174
+
175
+ /**
176
+ *
177
+ */
178
+ protected float maxTexcoordU;
179
+
180
+ /**
181
+ *
182
+ */
183
+ protected float maxTexcoordV;
184
+
185
+ /**
186
+ *
187
+ */
188
+ protected boolean bound;
189
+
190
+ /**
191
+ *
192
+ */
193
+ protected boolean invertedX;
194
+
195
+ /**
196
+ *
197
+ */
198
+ protected boolean invertedY;
199
+
200
+ /**
201
+ *
202
+ */
203
+ protected int[] rgbaPixels = null;
204
+
205
+ /**
206
+ *
207
+ */
208
+ protected IntBuffer pixelBuffer = null;
209
+
210
+ /**
211
+ *
212
+ */
213
+ protected int[] edgePixels = null;
104
214
 
105
- protected boolean invertedX;
106
- protected boolean invertedY;
215
+ /**
216
+ *
217
+ */
218
+ protected IntBuffer edgeBuffer = null;
107
219
 
108
- protected int[] rgbaPixels = null;
109
- protected IntBuffer pixelBuffer = null;
220
+ /**
221
+ *
222
+ */
223
+ protected FrameBuffer tempFbo = null;
110
224
 
111
- protected int[] edgePixels = null;
112
- protected IntBuffer edgeBuffer = null;
225
+ /**
226
+ *
227
+ */
228
+ protected int pixBufUpdateCount = 0;
113
229
 
114
- protected FrameBuffer tempFbo = null;
115
- protected int pixBufUpdateCount = 0;
116
- protected int rgbaPixUpdateCount = 0;
230
+ /**
231
+ *
232
+ */
233
+ protected int rgbaPixUpdateCount = 0;
117
234
 
118
235
  /** Modified portion of the texture */
119
236
  protected boolean modified;
120
- protected int mx1, my1, mx2, my2;
121
237
 
122
- protected Object bufferSource;
123
- protected LinkedList<BufferData> bufferCache = null;
124
- protected LinkedList<BufferData> usedBuffers = null;
125
- protected Method disposeBufferMethod;
126
- public static final int MAX_BUFFER_CACHE_SIZE = 3;
238
+ /**
239
+ *
240
+ */
241
+ protected int mx1,
242
+
243
+ /**
244
+ *
245
+ */
246
+ my1,
247
+
248
+ /**
249
+ *
250
+ */
251
+ mx2,
252
+
253
+ /**
254
+ *
255
+ */
256
+ my2;
257
+
258
+ /**
259
+ *
260
+ */
261
+ protected Object bufferSource;
262
+
263
+ /**
264
+ *
265
+ */
266
+ protected LinkedList<BufferData> bufferCache = null;
267
+
268
+ /**
269
+ *
270
+ */
271
+ protected LinkedList<BufferData> usedBuffers = null;
272
+
273
+ /**
274
+ *
275
+ */
276
+ protected Method disposeBufferMethod;
277
+
278
+ /**
279
+ *
280
+ */
281
+ public static final int MAX_BUFFER_CACHE_SIZE = 3;
127
282
 
128
283
  ////////////////////////////////////////////////////////////
129
284
 
130
285
  // Constructors.
131
286
 
132
-
133
- public Texture(PGraphicsOpenGL pg) {
287
+ /**
288
+ *
289
+ * @param pg
290
+ */
291
+ public Texture(PGraphicsOpenGL pg) {
134
292
  this.pg = pg;
135
293
  pgl = pg.pgl;
136
294
  context = pgl.createEmptyContext();
@@ -142,8 +300,9 @@ public class Texture implements PConstants {
142
300
 
143
301
 
144
302
  /**
145
- * Creates an instance of PTexture with size width x height. The texture is
146
- * initialized (empty) to that size.
303
+ * Creates an instance of PTexture with size width x height.The texture is
304
+ initialized (empty) to that size.
305
+ * @param pg
147
306
  * @param width int
148
307
  * @param height int
149
308
  */
@@ -154,7 +313,8 @@ public class Texture implements PConstants {
154
313
 
155
314
  /**
156
315
  * Creates an instance of PTexture with size width x height and with the
157
- * specified parameters. The texture is initialized (empty) to that size.
316
+ * specified parameters.The texture is initialized (empty) to that size.
317
+ * @param pg
158
318
  * @param width int
159
319
  * @param height int
160
320
  * @param params Parameters
@@ -216,6 +376,17 @@ public class Texture implements PConstants {
216
376
 
217
377
  /**
218
378
  * Initializes the texture using GL parameters
379
+ * @param width
380
+ * @param glWidth
381
+ * @param height
382
+ * @param glTarget
383
+ * @param glFormat
384
+ * @param glName
385
+ * @param glHeight
386
+ * @param glWrapS
387
+ * @param glMinFilter
388
+ * @param glMagFilter
389
+ * @param glWrapT
219
390
  */
220
391
  public void init(int width, int height,
221
392
  int glName, int glTarget, int glFormat,
@@ -244,8 +415,12 @@ public class Texture implements PConstants {
244
415
  usingRepeat = glWrapS == PGL.REPEAT || glWrapT == PGL.REPEAT;
245
416
  }
246
417
 
247
-
248
- public void resize(int wide, int high) {
418
+ /**
419
+ *
420
+ * @param wide
421
+ * @param high
422
+ */
423
+ public void resize(int wide, int high) {
249
424
  // Disposing current resources.
250
425
  dispose();
251
426
 
@@ -277,45 +452,99 @@ public class Texture implements PConstants {
277
452
 
278
453
  // Set methods
279
454
 
455
+ /**
456
+ *
457
+ * @param tex
458
+ */
459
+
280
460
 
281
461
  public void set(Texture tex) {
282
462
  copyTexture(tex, 0, 0, tex.width, tex.height, true);
283
463
  }
284
464
 
285
-
286
- public void set(Texture tex, int x, int y, int w, int h) {
465
+ /**
466
+ *
467
+ * @param tex
468
+ * @param x
469
+ * @param y
470
+ * @param w
471
+ * @param h
472
+ */
473
+ public void set(Texture tex, int x, int y, int w, int h) {
287
474
  copyTexture(tex, x, y, w, h, true);
288
475
  }
289
476
 
290
-
291
- public void set(int texTarget, int texName, int texWidth, int texHeight,
477
+ /**
478
+ *
479
+ * @param texTarget
480
+ * @param texName
481
+ * @param texWidth
482
+ * @param texHeight
483
+ * @param w
484
+ * @param h
485
+ */
486
+ public void set(int texTarget, int texName, int texWidth, int texHeight,
292
487
  int w, int h) {
293
488
  copyTexture(texTarget, texName, texWidth, texHeight, 0, 0, w, h, true);
294
489
  }
295
490
 
296
-
297
- public void set(int texTarget, int texName, int texWidth, int texHeight,
491
+ /**
492
+ *
493
+ * @param texTarget
494
+ * @param texName
495
+ * @param texWidth
496
+ * @param texHeight
497
+ * @param target
498
+ * @param tex
499
+ * @param x
500
+ * @param y
501
+ * @param w
502
+ * @param h
503
+ */
504
+ public void set(int texTarget, int texName, int texWidth, int texHeight,
298
505
  int target, int tex, int x, int y, int w, int h) {
299
506
  copyTexture(texTarget, texName, texWidth, texHeight, x, y, w, h, true);
300
507
  }
301
508
 
302
-
303
- public void set(int[] pixels) {
509
+ /**
510
+ *
511
+ * @param pixels
512
+ */
513
+ public void set(int[] pixels) {
304
514
  set(pixels, 0, 0, width, height, ARGB);
305
515
  }
306
516
 
307
-
308
- public void set(int[] pixels, int format) {
517
+ /**
518
+ *
519
+ * @param pixels
520
+ * @param format
521
+ */
522
+ public void set(int[] pixels, int format) {
309
523
  set(pixels, 0, 0, width, height, format);
310
524
  }
311
525
 
312
-
313
- public void set(int[] pixels, int x, int y, int w, int h) {
526
+ /**
527
+ *
528
+ * @param pixels
529
+ * @param x
530
+ * @param y
531
+ * @param w
532
+ * @param h
533
+ */
534
+ public void set(int[] pixels, int x, int y, int w, int h) {
314
535
  set(pixels, x, y, w, h, ARGB);
315
536
  }
316
537
 
317
-
318
- public void set(int[] pixels, int x, int y, int w, int h, int format) {
538
+ /**
539
+ *
540
+ * @param pixels
541
+ * @param x
542
+ * @param y
543
+ * @param w
544
+ * @param h
545
+ * @param format
546
+ */
547
+ public void set(int[] pixels, int x, int y, int w, int h, int format) {
319
548
  if (pixels == null) {
320
549
  PGraphics.showWarning("The pixels array is null.");
321
550
  return;
@@ -371,20 +600,39 @@ public class Texture implements PConstants {
371
600
 
372
601
  // Native set methods
373
602
 
603
+ /**
604
+ *
605
+ * @param pixels
606
+ */
607
+
374
608
 
375
609
  public void setNative(int[] pixels) {
376
610
  setNative(pixels, 0, 0, width, height);
377
611
  }
378
612
 
379
-
380
- public void setNative(int[] pixels, int x, int y, int w, int h) {
613
+ /**
614
+ *
615
+ * @param pixels
616
+ * @param x
617
+ * @param y
618
+ * @param w
619
+ * @param h
620
+ */
621
+ public void setNative(int[] pixels, int x, int y, int w, int h) {
381
622
  updatePixelBuffer(pixels);
382
623
  setNative(pixelBuffer, x, y, w, h);
383
624
  releasePixelBuffer();
384
625
  }
385
626
 
386
-
387
- public void setNative(IntBuffer pixBuf, int x, int y, int w, int h) {
627
+ /**
628
+ *
629
+ * @param pixBuf
630
+ * @param x
631
+ * @param y
632
+ * @param w
633
+ * @param h
634
+ */
635
+ public void setNative(IntBuffer pixBuf, int x, int y, int w, int h) {
388
636
  if (pixBuf == null) {
389
637
  pixBuf = null;
390
638
  PGraphics.showWarning("The pixel buffer is null.");
@@ -435,7 +683,8 @@ public class Texture implements PConstants {
435
683
 
436
684
 
437
685
  /**
438
- * Copy texture to pixels. Involves video memory to main memory transfer (slow).
686
+ * Copy texture to pixels.Involves video memory to main memory transfer (slow).
687
+ * @param pixels
439
688
  */
440
689
  public void get(int[] pixels) {
441
690
  if (pixels == null) {
@@ -472,24 +721,56 @@ public class Texture implements PConstants {
472
721
  // Put methods (the source texture is not resized to cover the entire
473
722
  // destination).
474
723
 
724
+ /**
725
+ *
726
+ * @param tex
727
+ */
728
+
475
729
 
476
730
  public void put(Texture tex) {
477
731
  copyTexture(tex, 0, 0, tex.width, tex.height, false);
478
732
  }
479
733
 
480
-
481
- public void put(Texture tex, int x, int y, int w, int h) {
734
+ /**
735
+ *
736
+ * @param tex
737
+ * @param x
738
+ * @param y
739
+ * @param w
740
+ * @param h
741
+ */
742
+ public void put(Texture tex, int x, int y, int w, int h) {
482
743
  copyTexture(tex, x, y, w, h, false);
483
744
  }
484
745
 
485
-
486
- public void put(int texTarget, int texName, int texWidth, int texHeight,
746
+ /**
747
+ *
748
+ * @param texTarget
749
+ * @param texName
750
+ * @param texWidth
751
+ * @param texHeight
752
+ * @param w
753
+ * @param h
754
+ */
755
+ public void put(int texTarget, int texName, int texWidth, int texHeight,
487
756
  int w, int h) {
488
757
  copyTexture(texTarget, texName, texWidth, texHeight, 0, 0, w, h, false);
489
758
  }
490
759
 
491
-
492
- public void put(int texTarget, int texName, int texWidth, int texHeight,
760
+ /**
761
+ *
762
+ * @param texTarget
763
+ * @param texName
764
+ * @param texWidth
765
+ * @param texHeight
766
+ * @param target
767
+ * @param tex
768
+ * @param x
769
+ * @param y
770
+ * @param w
771
+ * @param h
772
+ */
773
+ public void put(int texTarget, int texName, int texWidth, int texHeight,
493
774
  int target, int tex, int x, int y, int w, int h) {
494
775
  copyTexture(texTarget, texName, texWidth, texHeight, x, y, w, h, false);
495
776
  }
@@ -508,8 +789,12 @@ public class Texture implements PConstants {
508
789
  return usingMipmaps;
509
790
  }
510
791
 
511
-
512
- public void usingMipmaps(boolean mipmaps, int sampling) {
792
+ /**
793
+ *
794
+ * @param mipmaps
795
+ * @param sampling
796
+ */
797
+ public void usingMipmaps(boolean mipmaps, int sampling) {
513
798
  int glMagFilter0 = glMagFilter;
514
799
  int glMinFilter0 = glMinFilter;
515
800
  if (mipmaps) {
@@ -576,8 +861,11 @@ public class Texture implements PConstants {
576
861
  return usingRepeat;
577
862
  }
578
863
 
579
-
580
- public void usingRepeat(boolean repeat) {
864
+ /**
865
+ *
866
+ * @param repeat
867
+ */
868
+ public void usingRepeat(boolean repeat) {
581
869
  if (repeat) {
582
870
  glWrapS = PGL.REPEAT;
583
871
  glWrapT = PGL.REPEAT;
@@ -649,8 +937,11 @@ public class Texture implements PConstants {
649
937
  invertedY = v;
650
938
  }
651
939
 
652
-
653
- public int currentSampling() {
940
+ /**
941
+ *
942
+ * @return
943
+ */
944
+ public int currentSampling() {
654
945
  if (glMagFilter == PGL.NEAREST && glMinFilter == PGL.NEAREST) {
655
946
  return POINT;
656
947
  } else if (glMagFilter == PGL.NEAREST &&
@@ -671,8 +962,10 @@ public class Texture implements PConstants {
671
962
 
672
963
  // Bind/unbind
673
964
 
674
-
675
- public void bind() {
965
+ /**
966
+ *
967
+ */
968
+ public void bind() {
676
969
  // Binding a texture automatically enables texturing for the
677
970
  // texture target from that moment onwards. Unbinding the texture
678
971
  // won't disable texturing.
@@ -683,8 +976,10 @@ public class Texture implements PConstants {
683
976
  bound = true;
684
977
  }
685
978
 
686
-
687
- public void unbind() {
979
+ /**
980
+ *
981
+ */
982
+ public void unbind() {
688
983
  if (pgl.textureIsBound(glTarget, glName)) {
689
984
  // We don't want to unbind another texture
690
985
  // that might be bound instead of this one.
@@ -699,8 +994,11 @@ public class Texture implements PConstants {
699
994
  bound = false;
700
995
  }
701
996
 
702
-
703
- public boolean bound() {
997
+ /**
998
+ *
999
+ * @return
1000
+ */
1001
+ public boolean bound() {
704
1002
  // A true result might not necessarily mean that texturing is enabled
705
1003
  // (a texture can be bound to the target, but texturing is disabled).
706
1004
  return bound;
@@ -711,53 +1009,89 @@ public class Texture implements PConstants {
711
1009
 
712
1010
  // Modified flag
713
1011
 
1012
+ /**
1013
+ *
1014
+ * @return
1015
+ */
1016
+
714
1017
 
715
1018
  public boolean isModified() {
716
1019
  return modified;
717
1020
  }
718
1021
 
719
-
720
- public void setModified() {
1022
+ /**
1023
+ *
1024
+ */
1025
+ public void setModified() {
721
1026
  modified = true;
722
1027
  }
723
1028
 
724
-
725
- public void setModified(boolean m) {
1029
+ /**
1030
+ *
1031
+ * @param m
1032
+ */
1033
+ public void setModified(boolean m) {
726
1034
  modified = m;
727
1035
  }
728
1036
 
729
-
730
- public int getModifiedX1() {
1037
+ /**
1038
+ *
1039
+ * @return
1040
+ */
1041
+ public int getModifiedX1() {
731
1042
  return mx1;
732
1043
  }
733
1044
 
734
-
735
- public int getModifiedX2() {
1045
+ /**
1046
+ *
1047
+ * @return
1048
+ */
1049
+ public int getModifiedX2() {
736
1050
  return mx2;
737
1051
  }
738
1052
 
739
-
740
- public int getModifiedY1() {
1053
+ /**
1054
+ *
1055
+ * @return
1056
+ */
1057
+ public int getModifiedY1() {
741
1058
  return my1;
742
1059
  }
743
1060
 
744
-
745
- public int getModifiedY2() {
1061
+ /**
1062
+ *
1063
+ * @return
1064
+ */
1065
+ public int getModifiedY2() {
746
1066
  return my2;
747
1067
  }
748
1068
 
749
-
750
- public void updateTexels() {
1069
+ /**
1070
+ *
1071
+ */
1072
+ public void updateTexels() {
751
1073
  updateTexelsImpl(0, 0, width, height);
752
1074
  }
753
1075
 
754
-
755
- public void updateTexels(int x, int y, int w, int h) {
1076
+ /**
1077
+ *
1078
+ * @param x
1079
+ * @param y
1080
+ * @param w
1081
+ * @param h
1082
+ */
1083
+ public void updateTexels(int x, int y, int w, int h) {
756
1084
  updateTexelsImpl(x, y, w, h);
757
1085
  }
758
1086
 
759
-
760
- protected void updateTexelsImpl(int x, int y, int w, int h) {
1087
+ /**
1088
+ *
1089
+ * @param x
1090
+ * @param y
1091
+ * @param w
1092
+ * @param h
1093
+ */
1094
+ protected void updateTexelsImpl(int x, int y, int w, int h) {
761
1095
  int x2 = x + w;
762
1096
  int y2 = y + h;
763
1097
 
@@ -781,21 +1115,29 @@ public class Texture implements PConstants {
781
1115
  }
782
1116
  }
783
1117
 
784
-
785
- protected void loadPixels(int len) {
1118
+ /**
1119
+ *
1120
+ * @param len
1121
+ */
1122
+ protected void loadPixels(int len) {
786
1123
  if (rgbaPixels == null || rgbaPixels.length < len) {
787
1124
  rgbaPixels = new int[len];
788
1125
  }
789
1126
  }
790
1127
 
791
-
792
- protected void updatePixelBuffer(int[] pixels) {
1128
+ /**
1129
+ *
1130
+ * @param pixels
1131
+ */
1132
+ protected void updatePixelBuffer(int[] pixels) {
793
1133
  pixelBuffer = PGL.updateIntBuffer(pixelBuffer, pixels, true);
794
1134
  pixBufUpdateCount++;
795
1135
  }
796
1136
 
797
-
798
- protected void manualMipmap() {
1137
+ /**
1138
+ *
1139
+ */
1140
+ protected void manualMipmap() {
799
1141
  // TODO: finish manual mipmap generation,
800
1142
  // https://github.com/processing/processing/issues/3335
801
1143
  }
@@ -805,14 +1147,25 @@ public class Texture implements PConstants {
805
1147
 
806
1148
  // Buffer sink interface.
807
1149
 
1150
+ /**
1151
+ *
1152
+ * @param source
1153
+ */
1154
+
808
1155
 
809
1156
  public void setBufferSource(Object source) {
810
1157
  bufferSource = source;
811
1158
  getSourceMethods();
812
1159
  }
813
1160
 
814
-
815
- public void copyBufferFromSource(Object natRef, ByteBuffer byteBuf,
1161
+ /**
1162
+ *
1163
+ * @param natRef
1164
+ * @param byteBuf
1165
+ * @param w
1166
+ * @param h
1167
+ */
1168
+ public void copyBufferFromSource(Object natRef, ByteBuffer byteBuf,
816
1169
  int w, int h) {
817
1170
  if (bufferCache == null) {
818
1171
  bufferCache = new LinkedList<BufferData>();
@@ -831,8 +1184,10 @@ public class Texture implements PConstants {
831
1184
  }
832
1185
  }
833
1186
 
834
-
835
- public void disposeSourceBuffer() {
1187
+ /**
1188
+ *
1189
+ */
1190
+ public void disposeSourceBuffer() {
836
1191
  if (usedBuffers == null) return;
837
1192
 
838
1193
  while (0 < usedBuffers.size()) {
@@ -848,7 +1203,11 @@ public class Texture implements PConstants {
848
1203
  }
849
1204
  }
850
1205
 
851
- public void getBufferPixels(int[] pixels) {
1206
+ /**
1207
+ *
1208
+ * @param pixels
1209
+ */
1210
+ public void getBufferPixels(int[] pixels) {
852
1211
  // We get the buffer either from the used buffers or the cache, giving
853
1212
  // priority to the used buffers. Why? Because the used buffer was already
854
1213
  // transferred to the texture, so the pixels should be in sync with the
@@ -881,19 +1240,28 @@ public class Texture implements PConstants {
881
1240
  }
882
1241
  }
883
1242
 
884
-
885
- public boolean hasBufferSource() {
1243
+ /**
1244
+ *
1245
+ * @return
1246
+ */
1247
+ public boolean hasBufferSource() {
886
1248
  return bufferSource != null;
887
1249
  }
888
1250
 
889
-
890
- public boolean hasBuffers() {
1251
+ /**
1252
+ *
1253
+ * @return
1254
+ */
1255
+ public boolean hasBuffers() {
891
1256
  return bufferSource != null && bufferCache != null &&
892
1257
  0 < bufferCache.size();
893
1258
  }
894
1259
 
895
-
896
- protected boolean bufferUpdate() {
1260
+ /**
1261
+ *
1262
+ * @return
1263
+ */
1264
+ protected boolean bufferUpdate() {
897
1265
  BufferData data = null;
898
1266
  try {
899
1267
  data = bufferCache.remove(0);
@@ -921,8 +1289,10 @@ public class Texture implements PConstants {
921
1289
  }
922
1290
  }
923
1291
 
924
-
925
- protected void getSourceMethods() {
1292
+ /**
1293
+ *
1294
+ */
1295
+ protected void getSourceMethods() {
926
1296
  try {
927
1297
  disposeBufferMethod = bufferSource.getClass().
928
1298
  getMethod("disposeBuffer", new Class[] { Object.class });
@@ -1097,6 +1467,12 @@ public class Texture implements PConstants {
1097
1467
 
1098
1468
  // Allocate/release texture.
1099
1469
 
1470
+ /**
1471
+ *
1472
+ * @param w
1473
+ * @param h
1474
+ */
1475
+
1100
1476
 
1101
1477
  protected void setSize(int w, int h) {
1102
1478
  width = w;
@@ -1183,8 +1559,11 @@ public class Texture implements PConstants {
1183
1559
  }
1184
1560
  }
1185
1561
 
1186
-
1187
- protected boolean contextIsOutdated() {
1562
+ /**
1563
+ *
1564
+ * @return
1565
+ */
1566
+ protected boolean contextIsOutdated() {
1188
1567
  boolean outdated = !pgl.contextIsCurrent(context);
1189
1568
  if (outdated) {
1190
1569
  dispose();
@@ -1192,13 +1571,19 @@ public class Texture implements PConstants {
1192
1571
  return outdated;
1193
1572
  }
1194
1573
 
1195
-
1196
- public void colorBuffer(boolean value) {
1574
+ /**
1575
+ *
1576
+ * @param value
1577
+ */
1578
+ public void colorBuffer(boolean value) {
1197
1579
  colorBuffer = value;
1198
1580
  }
1199
1581
 
1200
-
1201
- public boolean colorBuffer() {
1582
+ /**
1583
+ *
1584
+ * @return
1585
+ */
1586
+ public boolean colorBuffer() {
1202
1587
  return colorBuffer;
1203
1588
  }
1204
1589
 
@@ -1209,6 +1594,16 @@ public class Texture implements PConstants {
1209
1594
 
1210
1595
 
1211
1596
  // Copies source texture tex into this.
1597
+
1598
+ /**
1599
+ *
1600
+ * @param tex
1601
+ * @param x
1602
+ * @param y
1603
+ * @param w
1604
+ * @param h
1605
+ * @param scale
1606
+ */
1212
1607
  protected void copyTexture(Texture tex, int x, int y, int w, int h,
1213
1608
  boolean scale) {
1214
1609
  if (tex == null) {
@@ -1254,6 +1649,19 @@ public class Texture implements PConstants {
1254
1649
 
1255
1650
 
1256
1651
  // Copies source texture tex into this.
1652
+
1653
+ /**
1654
+ *
1655
+ * @param texTarget
1656
+ * @param texName
1657
+ * @param texWidth
1658
+ * @param texHeight
1659
+ * @param x
1660
+ * @param y
1661
+ * @param w
1662
+ * @param h
1663
+ * @param scale
1664
+ */
1257
1665
  protected void copyTexture(int texTarget, int texName,
1258
1666
  int texWidth, int texHeight,
1259
1667
  int x, int y, int w, int h, boolean scale) {
@@ -1294,8 +1702,11 @@ public class Texture implements PConstants {
1294
1702
  updateTexels(x, y, w, h);
1295
1703
  }
1296
1704
 
1297
-
1298
- protected void copyObject(Texture src) {
1705
+ /**
1706
+ *
1707
+ * @param src
1708
+ */
1709
+ protected void copyObject(Texture src) {
1299
1710
  // The OpenGL texture of this object is replaced with the one from the
1300
1711
  // source object, so we delete the former to avoid resource wasting.
1301
1712
  dispose();
@@ -1324,6 +1735,10 @@ public class Texture implements PConstants {
1324
1735
 
1325
1736
  // Releases the memory used by pixelBuffer either if the buffer hasn't been
1326
1737
  // used many times yet, or if the JVM is running low in free memory.
1738
+
1739
+ /**
1740
+ *
1741
+ */
1327
1742
  protected void releasePixelBuffer() {
1328
1743
  double freeMB = Runtime.getRuntime().freeMemory() / 1E6;
1329
1744
  if (pixBufUpdateCount < MAX_UPDATES || freeMB < MIN_MEMORY) {
@@ -1334,6 +1749,10 @@ public class Texture implements PConstants {
1334
1749
 
1335
1750
  // Releases the memory used by rgbaPixels either if the array hasn't been
1336
1751
  // used many times yet, or if the JVM is running low in free memory.
1752
+
1753
+ /**
1754
+ *
1755
+ */
1337
1756
  protected void releaseRGBAPixels() {
1338
1757
  double freeMB = Runtime.getRuntime().freeMemory() / 1E6;
1339
1758
  if (rgbaPixUpdateCount < MAX_UPDATES || freeMB < MIN_MEMORY) {
@@ -1346,6 +1765,11 @@ public class Texture implements PConstants {
1346
1765
 
1347
1766
  // Parameter handling
1348
1767
 
1768
+ /**
1769
+ *
1770
+ * @return
1771
+ */
1772
+
1349
1773
 
1350
1774
  public Parameters getParameters() {
1351
1775
  Parameters res = new Parameters();
@@ -1474,8 +1898,14 @@ public class Texture implements PConstants {
1474
1898
  invertedY = false;
1475
1899
  }
1476
1900
 
1477
-
1478
- protected void fillEdges(int x, int y, int w, int h) {
1901
+ /**
1902
+ *
1903
+ * @param x
1904
+ * @param y
1905
+ * @param w
1906
+ * @param h
1907
+ */
1908
+ protected void fillEdges(int x, int y, int w, int h) {
1479
1909
  if ((width < glWidth || height < glHeight) && (x + w == width || y + h == height)) {
1480
1910
  if (x + w == width) {
1481
1911
  int ew = glWidth - width;
@@ -1565,7 +1995,11 @@ public class Texture implements PConstants {
1565
1995
  this.wrapV = CLAMP;
1566
1996
  }
1567
1997
 
1568
- public Parameters(int format) {
1998
+ /**
1999
+ *
2000
+ * @param format
2001
+ */
2002
+ public Parameters(int format) {
1569
2003
  this.target = TEX2D;
1570
2004
  this.format = format;
1571
2005
  this.sampling = BILINEAR;
@@ -1574,7 +2008,12 @@ public class Texture implements PConstants {
1574
2008
  this.wrapV = CLAMP;
1575
2009
  }
1576
2010
 
1577
- public Parameters(int format, int sampling) {
2011
+ /**
2012
+ *
2013
+ * @param format
2014
+ * @param sampling
2015
+ */
2016
+ public Parameters(int format, int sampling) {
1578
2017
  this.target = TEX2D;
1579
2018
  this.format = format;
1580
2019
  this.sampling = sampling;
@@ -1583,7 +2022,13 @@ public class Texture implements PConstants {
1583
2022
  this.wrapV = CLAMP;
1584
2023
  }
1585
2024
 
1586
- public Parameters(int format, int sampling, boolean mipmaps) {
2025
+ /**
2026
+ *
2027
+ * @param format
2028
+ * @param sampling
2029
+ * @param mipmaps
2030
+ */
2031
+ public Parameters(int format, int sampling, boolean mipmaps) {
1587
2032
  this.target = TEX2D;
1588
2033
  this.format = format;
1589
2034
  this.mipmaps = mipmaps;
@@ -1596,7 +2041,14 @@ public class Texture implements PConstants {
1596
2041
  this.wrapV = CLAMP;
1597
2042
  }
1598
2043
 
1599
- public Parameters(int format, int sampling, boolean mipmaps, int wrap) {
2044
+ /**
2045
+ *
2046
+ * @param format
2047
+ * @param sampling
2048
+ * @param mipmaps
2049
+ * @param wrap
2050
+ */
2051
+ public Parameters(int format, int sampling, boolean mipmaps, int wrap) {
1600
2052
  this.target = TEX2D;
1601
2053
  this.format = format;
1602
2054
  this.mipmaps = mipmaps;
@@ -1609,26 +2061,49 @@ public class Texture implements PConstants {
1609
2061
  this.wrapV = wrap;
1610
2062
  }
1611
2063
 
1612
- public Parameters(Parameters src) {
2064
+ /**
2065
+ *
2066
+ * @param src
2067
+ */
2068
+ public Parameters(Parameters src) {
1613
2069
  set(src);
1614
2070
  }
1615
2071
 
1616
- public void set(int format) {
2072
+ /**
2073
+ *
2074
+ * @param format
2075
+ */
2076
+ public void set(int format) {
1617
2077
  this.format = format;
1618
2078
  }
1619
2079
 
1620
- public void set(int format, int sampling) {
2080
+ /**
2081
+ *
2082
+ * @param format
2083
+ * @param sampling
2084
+ */
2085
+ public void set(int format, int sampling) {
1621
2086
  this.format = format;
1622
2087
  this.sampling = sampling;
1623
2088
  }
1624
2089
 
1625
- public void set(int format, int sampling, boolean mipmaps) {
2090
+ /**
2091
+ *
2092
+ * @param format
2093
+ * @param sampling
2094
+ * @param mipmaps
2095
+ */
2096
+ public void set(int format, int sampling, boolean mipmaps) {
1626
2097
  this.format = format;
1627
2098
  this.sampling = sampling;
1628
2099
  this.mipmaps = mipmaps;
1629
2100
  }
1630
2101
 
1631
- public void set(Parameters src) {
2102
+ /**
2103
+ *
2104
+ * @param src
2105
+ */
2106
+ public void set(Parameters src) {
1632
2107
  this.target = src.target;
1633
2108
  this.format = src.format;
1634
2109
  this.sampling = src.sampling;