propane 3.8.0-java → 4.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +7 -1
  6. data/README.md +7 -7
  7. data/Rakefile +6 -5
  8. data/lib/propane/app.rb +10 -17
  9. data/lib/propane/helper_methods.rb +6 -6
  10. data/lib/propane/version.rb +1 -1
  11. data/lib/propane-4.0.0.jar +0 -0
  12. data/library/pdf/itextpdf-5.5.13.2.jar +0 -0
  13. data/library/pdf/pdf.rb +7 -0
  14. data/library/slider/slider.rb +1 -1
  15. data/library/svg/batik-all-1.14.jar +0 -0
  16. data/library/svg/svg.rb +7 -0
  17. data/mvnw +3 -3
  18. data/mvnw.cmd +2 -2
  19. data/pom.rb +35 -8
  20. data/pom.xml +60 -9
  21. data/propane.gemspec +9 -7
  22. data/src/main/java/monkstone/ColorUtil.java +1 -1
  23. data/src/main/java/monkstone/FastNoiseModuleJava.java +127 -0
  24. data/src/main/java/monkstone/MathToolModule.java +31 -31
  25. data/src/main/java/monkstone/PropaneLibrary.java +3 -1
  26. data/src/main/java/monkstone/SmoothNoiseModuleJava.java +127 -0
  27. data/src/main/java/monkstone/fastmath/DegLutTables.java +25 -26
  28. data/src/main/java/monkstone/fastmath/Deglut.java +1 -1
  29. data/src/main/java/monkstone/filechooser/Chooser.java +2 -2
  30. data/src/main/java/monkstone/noise/LICENSE +121 -0
  31. data/src/main/java/monkstone/noise/OpenSimplex2F.java +914 -0
  32. data/src/main/java/monkstone/noise/OpenSimplex2S.java +1138 -0
  33. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  34. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  35. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  36. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  37. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  38. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  39. data/src/main/java/monkstone/slider/WheelHandler.java +2 -2
  40. data/src/main/java/monkstone/vecmath/JRender.java +6 -6
  41. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  42. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +103 -83
  43. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +27 -41
  44. data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
  45. data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
  46. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  47. data/src/main/java/processing/awt/PGraphicsJava2D.java +11 -4
  48. data/src/main/java/processing/awt/PImageAWT.java +8 -8
  49. data/src/main/java/processing/core/PApplet.java +245 -254
  50. data/src/main/java/processing/core/PConstants.java +155 -163
  51. data/src/main/java/processing/core/PGraphics.java +116 -109
  52. data/src/main/java/processing/core/PImage.java +3025 -3047
  53. data/src/main/java/processing/core/PMatrix.java +5 -2
  54. data/src/main/java/processing/data/DoubleDict.java +72 -43
  55. data/src/main/java/processing/data/DoubleList.java +6 -2
  56. data/src/main/java/processing/data/FloatDict.java +744 -756
  57. data/src/main/java/processing/data/FloatList.java +68 -26
  58. data/src/main/java/processing/data/IntDict.java +72 -45
  59. data/src/main/java/processing/data/IntList.java +63 -26
  60. data/src/main/java/processing/data/JSONArray.java +892 -931
  61. data/src/main/java/processing/data/JSONObject.java +1169 -1262
  62. data/src/main/java/processing/data/JSONTokener.java +30 -49
  63. data/src/main/java/processing/data/LongDict.java +699 -712
  64. data/src/main/java/processing/data/LongList.java +676 -700
  65. data/src/main/java/processing/data/Sort.java +1 -0
  66. data/src/main/java/processing/data/Table.java +4040 -3661
  67. data/src/main/java/processing/data/TableRow.java +16 -0
  68. data/src/main/java/processing/data/XML.java +1041 -956
  69. data/src/main/java/processing/event/TouchEvent.java +1 -1
  70. data/src/main/java/processing/opengl/FontTexture.java +2 -2
  71. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +28 -31
  72. data/src/main/java/processing/opengl/PJOGL.java +8 -7
  73. data/src/main/java/processing/opengl/PShader.java +1 -6
  74. data/src/main/java/processing/opengl/PShapeOpenGL.java +23 -24
  75. data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
  76. data/src/main/java/processing/pdf/PGraphicsPDF.java +581 -0
  77. data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
  78. data/src/main/{java/processing/opengl → resources}/cursors/arrow.png +0 -0
  79. data/src/main/{java/processing/opengl → resources}/cursors/cross.png +0 -0
  80. data/src/main/{java/processing/opengl → resources}/cursors/hand.png +0 -0
  81. data/src/main/{java/processing/opengl → resources}/cursors/license.txt +0 -0
  82. data/src/main/{java/processing/opengl → resources}/cursors/move.png +0 -0
  83. data/src/main/{java/processing/opengl → resources}/cursors/text.png +0 -0
  84. data/src/main/{java/processing/opengl → resources}/cursors/wait.png +0 -0
  85. data/src/main/{java/processing/opengl → resources}/shaders/ColorFrag.glsl +0 -0
  86. data/src/main/{java/processing/opengl → resources}/shaders/ColorVert.glsl +0 -0
  87. data/src/main/{java/processing/opengl → resources}/shaders/LightFrag.glsl +0 -0
  88. data/src/main/{java/processing/opengl → resources}/shaders/LightVert.glsl +0 -0
  89. data/src/main/{java/processing/opengl → resources}/shaders/LineFrag.glsl +0 -0
  90. data/src/main/{java/processing/opengl → resources}/shaders/LineVert.glsl +0 -0
  91. data/src/main/{java/processing/opengl → resources}/shaders/MaskFrag.glsl +0 -0
  92. data/src/main/{java/processing/opengl → resources}/shaders/PointFrag.glsl +0 -0
  93. data/src/main/{java/processing/opengl → resources}/shaders/PointVert.glsl +0 -0
  94. data/src/main/{java/processing/opengl → resources}/shaders/TexFrag.glsl +0 -0
  95. data/src/main/{java/processing/opengl → resources}/shaders/TexLightFrag.glsl +0 -0
  96. data/src/main/{java/processing/opengl → resources}/shaders/TexLightVert.glsl +0 -0
  97. data/src/main/{java/processing/opengl → resources}/shaders/TexVert.glsl +0 -0
  98. data/test/test_helper.rb +1 -0
  99. data/test/vecmath_spec_test.rb +14 -3
  100. data/vendors/Rakefile +1 -1
  101. metadata +53 -53
  102. data/lib/propane-3.8.0.jar +0 -0
  103. data/src/main/java/monkstone/noise/Noise.java +0 -116
  104. data/src/main/java/monkstone/noise/NoiseGenerator.java +0 -63
  105. data/src/main/java/monkstone/noise/NoiseMode.java +0 -15
  106. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -470
  107. data/src/main/java/monkstone/noise/ValueNoise.java +0 -170
@@ -30,9 +30,11 @@ import java.awt.Color;
30
30
 
31
31
  // Used for the 'image' object that's been here forever
32
32
  import java.awt.Font;
33
+ import java.awt.FontFormatException;
33
34
  import java.awt.Image;
34
35
 
35
36
  import java.io.File;
37
+ import java.io.IOException;
36
38
  import java.io.InputStream;
37
39
  import java.util.Map;
38
40
  import java.util.HashMap;
@@ -1984,35 +1986,32 @@ public class PGraphics extends PImage implements PConstants {
1984
1986
  * @param d height of the rectangle, by default
1985
1987
  */
1986
1988
  public void clip(float a, float b, float c, float d) {
1987
- if (imageMode == CORNER) {
1988
- if (c < 0) { // reset a negative width
1989
- a += c; c = -c;
1989
+ switch (imageMode) {
1990
+ case CORNER:
1991
+ if (c < 0) { // reset a negative width
1992
+ a += c; c = -c;
1993
+ } if (d < 0) { // reset a negative height
1994
+ b += d; d = -d;
1995
+ } clipImpl(a, b, a + c, b + d);
1996
+ break;
1997
+ case CORNERS:
1998
+ if (c < a) { // reverse because x2 < x1
1999
+ float temp = a; a = c; c = temp;
2000
+ } if (d < b) { // reverse because y2 < y1
2001
+ float temp = b; b = d; d = temp;
2002
+ } clipImpl(a, b, c, d);
2003
+ break;
2004
+ case CENTER:
2005
+ // c and d are width/height
2006
+ if (c < 0) c = -c;
2007
+ if (d < 0) d = -d;
2008
+ float x1 = a - c/2;
2009
+ float y1 = b - d/2;
2010
+ clipImpl(x1, y1, x1 + c, y1 + d);
2011
+ break;
2012
+ default:
2013
+ break;
1990
2014
  }
1991
- if (d < 0) { // reset a negative height
1992
- b += d; d = -d;
1993
- }
1994
-
1995
- clipImpl(a, b, a + c, b + d);
1996
-
1997
- } else if (imageMode == CORNERS) {
1998
- if (c < a) { // reverse because x2 < x1
1999
- float temp = a; a = c; c = temp;
2000
- }
2001
- if (d < b) { // reverse because y2 < y1
2002
- float temp = b; b = d; d = temp;
2003
- }
2004
-
2005
- clipImpl(a, b, c, d);
2006
-
2007
- } else if (imageMode == CENTER) {
2008
- // c and d are width/height
2009
- if (c < 0) c = -c;
2010
- if (d < 0) d = -d;
2011
- float x1 = a - c/2;
2012
- float y1 = b - d/2;
2013
-
2014
- clipImpl(x1, y1, x1 + c, y1 + d);
2015
- }
2016
2015
  }
2017
2016
 
2018
2017
 
@@ -2811,20 +2810,24 @@ public class PGraphics extends PImage implements PConstants {
2811
2810
  float w = c;
2812
2811
  float h = d;
2813
2812
 
2814
- if (ellipseMode == CORNERS) {
2815
- w = c - a;
2816
- h = d - b;
2817
-
2818
- } else if (ellipseMode == RADIUS) {
2819
- x = a - c;
2820
- y = b - d;
2821
- w = c * 2;
2822
- h = d * 2;
2823
-
2824
- } else if (ellipseMode == DIAMETER) {
2825
- x = a - c/2f;
2826
- y = b - d/2f;
2827
- }
2813
+ switch (ellipseMode) {
2814
+ case CORNERS:
2815
+ w = c - a;
2816
+ h = d - b;
2817
+ break;
2818
+ case RADIUS:
2819
+ x = a - c;
2820
+ y = b - d;
2821
+ w = c * 2;
2822
+ h = d * 2;
2823
+ break;
2824
+ case DIAMETER:
2825
+ x = a - c/2f;
2826
+ y = b - d/2f;
2827
+ break;
2828
+ default:
2829
+ break;
2830
+ }
2828
2831
 
2829
2832
  if (w < 0) { // undo negative width
2830
2833
  x += w;
@@ -2881,20 +2884,24 @@ public class PGraphics extends PImage implements PConstants {
2881
2884
  float w = c;
2882
2885
  float h = d;
2883
2886
 
2884
- if (ellipseMode == CORNERS) {
2885
- w = c - a;
2886
- h = d - b;
2887
-
2888
- } else if (ellipseMode == RADIUS) {
2889
- x = a - c;
2890
- y = b - d;
2891
- w = c * 2;
2892
- h = d * 2;
2893
-
2894
- } else if (ellipseMode == CENTER) {
2895
- x = a - c/2f;
2896
- y = b - d/2f;
2897
- }
2887
+ switch (ellipseMode) {
2888
+ case CORNERS:
2889
+ w = c - a;
2890
+ h = d - b;
2891
+ break;
2892
+ case RADIUS:
2893
+ x = a - c;
2894
+ y = b - d;
2895
+ w = c * 2;
2896
+ h = d * 2;
2897
+ break;
2898
+ case CENTER:
2899
+ x = a - c/2f;
2900
+ y = b - d/2f;
2901
+ break;
2902
+ default:
2903
+ break;
2904
+ }
2898
2905
 
2899
2906
  // make sure the loop will exit before starting while
2900
2907
  if (!Float.isInfinite(start) && !Float.isInfinite(stop)) {
@@ -3854,41 +3861,38 @@ public class PGraphics extends PImage implements PConstants {
3854
3861
  // loadImageAsync() sets width and height to -1 when loading fails.
3855
3862
  if (img.width == -1 || img.height == -1) return;
3856
3863
 
3857
- if (imageMode == CORNER) {
3858
- if (c < 0) { // reset a negative width
3859
- a += c; c = -c;
3860
- }
3861
- if (d < 0) { // reset a negative height
3862
- b += d; d = -d;
3864
+ switch (imageMode) {
3865
+ case CORNER:
3866
+ if (c < 0) { // reset a negative width
3867
+ a += c; c = -c;
3868
+ } if (d < 0) { // reset a negative height
3869
+ b += d; d = -d;
3870
+ } imageImpl(img,
3871
+ a, b, a + c, b + d,
3872
+ u1, v1, u2, v2);
3873
+ break;
3874
+ case CORNERS:
3875
+ if (c < a) { // reverse because x2 < x1
3876
+ float temp = a; a = c; c = temp;
3877
+ } if (d < b) { // reverse because y2 < y1
3878
+ float temp = b; b = d; d = temp;
3879
+ } imageImpl(img,
3880
+ a, b, c, d,
3881
+ u1, v1, u2, v2);
3882
+ break;
3883
+ case CENTER:
3884
+ // c and d are width/height
3885
+ if (c < 0) c = -c;
3886
+ if (d < 0) d = -d;
3887
+ float x1 = a - c/2;
3888
+ float y1 = b - d/2;
3889
+ imageImpl(img,
3890
+ x1, y1, x1 + c, y1 + d,
3891
+ u1, v1, u2, v2);
3892
+ break;
3893
+ default:
3894
+ break;
3863
3895
  }
3864
-
3865
- imageImpl(img,
3866
- a, b, a + c, b + d,
3867
- u1, v1, u2, v2);
3868
-
3869
- } else if (imageMode == CORNERS) {
3870
- if (c < a) { // reverse because x2 < x1
3871
- float temp = a; a = c; c = temp;
3872
- }
3873
- if (d < b) { // reverse because y2 < y1
3874
- float temp = b; b = d; d = temp;
3875
- }
3876
-
3877
- imageImpl(img,
3878
- a, b, c, d,
3879
- u1, v1, u2, v2);
3880
-
3881
- } else if (imageMode == CENTER) {
3882
- // c and d are width/height
3883
- if (c < 0) c = -c;
3884
- if (d < 0) d = -d;
3885
- float x1 = a - c/2;
3886
- float y1 = b - d/2;
3887
-
3888
- imageImpl(img,
3889
- x1, y1, x1 + c, y1 + d,
3890
- u1, v1, u2, v2);
3891
- }
3892
3896
  }
3893
3897
 
3894
3898
 
@@ -4062,6 +4066,7 @@ public class PGraphics extends PImage implements PConstants {
4062
4066
 
4063
4067
 
4064
4068
  /**
4069
+ * @param shape
4065
4070
  * @param a x-coordinate of the shape
4066
4071
  * @param b y-coordinate of the shape
4067
4072
  * @param c width to display the shape
@@ -4073,23 +4078,26 @@ public class PGraphics extends PImage implements PConstants {
4073
4078
 
4074
4079
  pushMatrix();
4075
4080
 
4076
- if (shapeMode == CENTER) {
4077
- // x and y are center, c and d refer to a diameter
4078
- translate(a - c/2f, b - d/2f);
4079
- scale(c / shape.getWidth(), d / shape.getHeight());
4080
-
4081
- } else if (shapeMode == CORNER) {
4082
- translate(a, b);
4083
- scale(c / shape.getWidth(), d / shape.getHeight());
4084
-
4085
- } else if (shapeMode == CORNERS) {
4086
- // c and d are x2/y2, make them into width/height
4087
- c -= a;
4088
- d -= b;
4089
- // then same as above
4090
- translate(a, b);
4091
- scale(c / shape.getWidth(), d / shape.getHeight());
4092
- }
4081
+ switch (shapeMode) {
4082
+ case CENTER:
4083
+ // x and y are center, c and d refer to a diameter
4084
+ translate(a - c/2f, b - d/2f);
4085
+ scale(c / shape.getWidth(), d / shape.getHeight());
4086
+ break;
4087
+ case CORNER:
4088
+ translate(a, b);
4089
+ scale(c / shape.getWidth(), d / shape.getHeight());
4090
+ break;
4091
+ case CORNERS:
4092
+ // c and d are x2/y2, make them into width/height
4093
+ c -= a; d -= b;
4094
+ // then same as above
4095
+ translate(a, b);
4096
+ scale(c / shape.getWidth(), d / shape.getHeight());
4097
+ break;
4098
+ default:
4099
+ break;
4100
+ }
4093
4101
  shape.draw(this);
4094
4102
 
4095
4103
  popMatrix();
@@ -4141,9 +4149,8 @@ public class PGraphics extends PImage implements PConstants {
4141
4149
  }
4142
4150
  return createFont(baseFont, size, smooth, charset, stream != null);
4143
4151
 
4144
- } catch (Exception e) {
4152
+ } catch (FontFormatException | IOException e) {
4145
4153
  System.err.println("Problem with createFont(\"" + name + "\")");
4146
- e.printStackTrace();
4147
4154
  return null;
4148
4155
  }
4149
4156
  }