propane 3.4.0-java → 3.4.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -2
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +2 -0
  5. data/README.md +12 -7
  6. data/Rakefile +2 -2
  7. data/lib/propane.rb +2 -2
  8. data/lib/propane/app.rb +18 -9
  9. data/lib/propane/helper_methods.rb +1 -1
  10. data/lib/propane/runner.rb +1 -1
  11. data/lib/propane/version.rb +1 -1
  12. data/library/color_group/color_group.rb +26 -0
  13. data/library/dxf/dxf.rb +4 -0
  14. data/library/net/net.rb +5 -0
  15. data/library/video_event/video_event.rb +2 -1
  16. data/pom.rb +3 -3
  17. data/pom.xml +3 -3
  18. data/propane.gemspec +1 -1
  19. data/src/main/java/japplemenubar/JAppleMenuBar.java +3 -3
  20. data/src/main/java/monkstone/ColorUtil.java +14 -0
  21. data/src/main/java/monkstone/MathToolModule.java +243 -194
  22. data/src/main/java/monkstone/filechooser/Chooser.java +1 -0
  23. data/src/main/java/monkstone/slider/WheelHandler.java +6 -5
  24. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +3 -2
  25. data/src/main/java/monkstone/videoevent/CaptureEvent.java +27 -0
  26. data/src/main/java/monkstone/videoevent/{VideoInterface.java → MovieEvent.java} +10 -26
  27. data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
  28. data/src/main/java/processing/core/PApplet.java +1236 -599
  29. data/src/main/java/processing/core/PGraphics.java +59 -59
  30. data/src/main/java/processing/core/PImage.java +528 -129
  31. data/src/main/java/processing/core/PShape.java +10 -10
  32. data/src/main/java/processing/core/PVector.java +2 -2
  33. data/src/main/java/processing/core/ThinkDifferent.java +5 -7
  34. data/src/main/java/processing/dxf/RawDXF.java +404 -0
  35. data/src/main/java/processing/net/Client.java +744 -0
  36. data/src/main/java/processing/net/Server.java +388 -0
  37. data/src/main/java/processing/opengl/FontTexture.java +19 -20
  38. data/src/main/java/processing/opengl/FrameBuffer.java +27 -17
  39. data/src/main/java/processing/opengl/LinePath.java +512 -508
  40. data/src/main/java/processing/opengl/PGL.java +3106 -3066
  41. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +4 -4
  42. data/src/main/java/processing/opengl/PShader.java +1442 -1341
  43. data/vendors/Rakefile +3 -27
  44. metadata +12 -25
  45. data/src/main/java/processing/core/util/image/ImageLoadFacade.java +0 -161
  46. data/src/main/java/processing/core/util/image/ImageSaveFacade.java +0 -169
  47. data/src/main/java/processing/core/util/image/constants/TifConstants.java +0 -45
  48. data/src/main/java/processing/core/util/image/load/AwtImageLoadStrategy.java +0 -80
  49. data/src/main/java/processing/core/util/image/load/Base64StringImageLoadStrategy.java +0 -73
  50. data/src/main/java/processing/core/util/image/load/FallbackImageLoadStrategy.java +0 -70
  51. data/src/main/java/processing/core/util/image/load/ImageIoImageLoadStrategy.java +0 -132
  52. data/src/main/java/processing/core/util/image/load/ImageLoadStrategy.java +0 -48
  53. data/src/main/java/processing/core/util/image/load/ImageLoadUtil.java +0 -45
  54. data/src/main/java/processing/core/util/image/load/TgaImageLoadStrategy.java +0 -255
  55. data/src/main/java/processing/core/util/image/load/TiffImageLoadStrategy.java +0 -98
  56. data/src/main/java/processing/core/util/image/save/ImageSaveStrategy.java +0 -49
  57. data/src/main/java/processing/core/util/image/save/ImageSaveUtil.java +0 -48
  58. data/src/main/java/processing/core/util/image/save/ImageWriterImageSaveStrategy.java +0 -179
  59. data/src/main/java/processing/core/util/image/save/SaveImageException.java +0 -41
  60. data/src/main/java/processing/core/util/image/save/TgaImageSaveStrategy.java +0 -198
  61. data/src/main/java/processing/core/util/image/save/TiffImageSaveStrategy.java +0 -91
  62. data/src/main/java/processing/core/util/image/save/TiffNakedFilenameImageSaveStrategy.java +0 -57
  63. data/src/main/java/processing/core/util/io/InputFactory.java +0 -285
  64. data/src/main/java/processing/core/util/io/PathUtil.java +0 -109
@@ -1,45 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2012-18 The Processing Foundation
7
- Copyright (c) 2004-12 Ben Fry and Casey Reas
8
- Copyright (c) 2001-04 Massachusetts Institute of Technology
9
-
10
- This library is free software; you can redistribute it and/or
11
- modify it under the terms of the GNU Lesser General Public
12
- License as published by the Free Software Foundation, version 2.1.
13
-
14
- This library is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- Lesser General Public License for more details.
18
-
19
- You should have received a copy of the GNU Lesser General
20
- Public License along with this library; if not, write to the
21
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
- Boston, MA 02111-1307 USA
23
- */
24
-
25
- package processing.core.util.image.constants;
26
-
27
-
28
- /**
29
- * Constants to use for tif images.
30
- */
31
- public class TifConstants {
32
-
33
- public static final byte TIFF_HEADER[] = {
34
- 77, 77, 0, 42, 0, 0, 0, 8, 0, 9, 0, -2, 0, 4, 0, 0, 0, 1, 0, 0,
35
- 0, 0, 1, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 3, 0, 0, 0, 1,
36
- 0, 0, 0, 0, 1, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 122, 1, 6, 0, 3, 0,
37
- 0, 0, 1, 0, 2, 0, 0, 1, 17, 0, 4, 0, 0, 0, 1, 0, 0, 3, 0, 1, 21,
38
- 0, 3, 0, 0, 0, 1, 0, 3, 0, 0, 1, 22, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0,
39
- 1, 23, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 8, 0, 8
40
- };
41
-
42
- public static final String TIFF_ERROR =
43
- "Error: Processing can only read its own TIFF files.";
44
-
45
- }
@@ -1,80 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2012-18 The Processing Foundation
7
- Copyright (c) 2004-12 Ben Fry and Casey Reas
8
- Copyright (c) 2001-04 Massachusetts Institute of Technology
9
-
10
- This library is free software; you can redistribute it and/or
11
- modify it under the terms of the GNU Lesser General Public
12
- License as published by the Free Software Foundation, version 2.1.
13
-
14
- This library is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- Lesser General Public License for more details.
18
-
19
- You should have received a copy of the GNU Lesser General
20
- Public License along with this library; if not, write to the
21
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
- Boston, MA 02111-1307 USA
23
- */
24
-
25
- package processing.core.util.image.load;
26
-
27
- import processing.core.PApplet;
28
- import processing.core.PImage;
29
-
30
- import javax.swing.*;
31
- import java.awt.*;
32
- import java.awt.color.ColorSpace;
33
- import java.awt.image.BufferedImage;
34
-
35
-
36
- /**
37
- * Strategy to load an image through ImageIcon / abstract window toolkit.
38
- */
39
- public class AwtImageLoadStrategy implements ImageLoadStrategy {
40
-
41
- @Override
42
- public PImage load(PApplet pApplet, String path, String extension) {
43
- byte bytes[] = pApplet.loadBytes(path);
44
- if (bytes == null) {
45
- return null;
46
- } else {
47
- //Image awtImage = Toolkit.getDefaultToolkit().createImage(bytes);
48
- Image awtImage = new ImageIcon(bytes).getImage();
49
-
50
- if (awtImage instanceof BufferedImage) {
51
- BufferedImage buffImage = (BufferedImage) awtImage;
52
- int space = buffImage.getColorModel().getColorSpace().getType();
53
- if (space == ColorSpace.TYPE_CMYK) {
54
- System.err.println(path + " is a CMYK image, " +
55
- "only RGB images are supported.");
56
- return null;
57
- /*
58
- // wishful thinking, appears to not be supported
59
- // https://community.oracle.com/thread/1272045?start=0&tstart=0
60
- BufferedImage destImage =
61
- new BufferedImage(buffImage.getWidth(),
62
- buffImage.getHeight(),
63
- BufferedImage.TYPE_3BYTE_BGR);
64
- ColorConvertOp op = new ColorConvertOp(null);
65
- op.filter(buffImage, destImage);
66
- image = new PImage(destImage);
67
- */
68
- }
69
- }
70
-
71
- boolean checkAlpha = extension.equalsIgnoreCase("gif")
72
- || extension.equalsIgnoreCase("png")
73
- || extension.equalsIgnoreCase("unknown");
74
-
75
- PImage image = new PImage(awtImage, checkAlpha, pApplet);
76
- return image;
77
- }
78
- }
79
-
80
- }
@@ -1,73 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2012-18 The Processing Foundation
7
- Copyright (c) 2004-12 Ben Fry and Casey Reas
8
- Copyright (c) 2001-04 Massachusetts Institute of Technology
9
-
10
- This library is free software; you can redistribute it and/or
11
- modify it under the terms of the GNU Lesser General Public
12
- License as published by the Free Software Foundation, version 2.1.
13
-
14
- This library is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- Lesser General Public License for more details.
18
-
19
- You should have received a copy of the GNU Lesser General
20
- Public License along with this library; if not, write to the
21
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
- Boston, MA 02111-1307 USA
23
- */
24
-
25
- package processing.core.util.image.load;
26
-
27
- import processing.core.PApplet;
28
- import processing.core.PImage;
29
-
30
- import javax.swing.*;
31
- import java.awt.*;
32
- import java.awt.color.ColorSpace;
33
- import java.awt.image.BufferedImage;
34
- import java.util.Base64;
35
-
36
-
37
- /**
38
- * Strategy for loading images from Base64 strings.
39
- */
40
- public class Base64StringImageLoadStrategy implements ImageLoadStrategy {
41
-
42
- @Override
43
- public PImage load(PApplet pApplet, String content, String extension) {
44
- byte[] decodedBytes = Base64.getDecoder().decode(content);
45
-
46
- if(decodedBytes == null){
47
- System.err.println("Decode Error on image: " + content.substring(0, 20));
48
- return null;
49
- }
50
-
51
- Image awtImage = new ImageIcon(decodedBytes).getImage();
52
-
53
- if (awtImage instanceof BufferedImage) {
54
- BufferedImage buffImage = (BufferedImage) awtImage;
55
- int space = buffImage.getColorModel().getColorSpace().getType();
56
- if (space == ColorSpace.TYPE_CMYK) {
57
- return null;
58
- }
59
- }
60
-
61
- PImage loadedImage = new PImage(
62
- awtImage,
63
- ImageLoadUtil.checkExtensionRequiresAlpha(extension)
64
- );
65
-
66
- if (loadedImage.width == -1) {
67
- // error...
68
- }
69
-
70
- return loadedImage;
71
- }
72
-
73
- }
@@ -1,70 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2012-18 The Processing Foundation
7
- Copyright (c) 2004-12 Ben Fry and Casey Reas
8
- Copyright (c) 2001-04 Massachusetts Institute of Technology
9
-
10
- This library is free software; you can redistribute it and/or
11
- modify it under the terms of the GNU Lesser General Public
12
- License as published by the Free Software Foundation, version 2.1.
13
-
14
- This library is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- Lesser General Public License for more details.
18
-
19
- You should have received a copy of the GNU Lesser General
20
- Public License along with this library; if not, write to the
21
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
- Boston, MA 02111-1307 USA
23
- */
24
-
25
- package processing.core.util.image.load;
26
-
27
- import processing.core.PApplet;
28
- import processing.core.PImage;
29
-
30
-
31
- /**
32
- * Image load strategy which uses a secondary strategy if failed.
33
- *
34
- * <p>
35
- * Image loading strategy strategy which attempts to load an image first through a "primary
36
- * strategy" and, if the primary failed, it then attemps loading through an alternative "secondary
37
- * strategy".
38
- * </p>
39
- */
40
- public class FallbackImageLoadStrategy implements ImageLoadStrategy {
41
-
42
- private ImageLoadStrategy primaryStrategy;
43
- private ImageLoadStrategy secondaryStrategy;
44
-
45
- /**
46
- * Create a new fallback image loading strategy.
47
- *
48
- * @param newPrimaryStrategy The strategy to try first.
49
- * @param newSecondaryStrategy The strategy to try if the first fails.
50
- */
51
- public FallbackImageLoadStrategy(ImageLoadStrategy newPrimaryStrategy,
52
- ImageLoadStrategy newSecondaryStrategy) {
53
-
54
- primaryStrategy = newPrimaryStrategy;
55
- secondaryStrategy = newSecondaryStrategy;
56
- }
57
-
58
- @Override
59
- public PImage load(PApplet pApplet, String path, String extension) {
60
- try {
61
- return primaryStrategy.load(pApplet, path, extension);
62
- } catch (Exception e) {
63
- // show error, but move on to the stuff below, see if it'll work
64
- e.printStackTrace();
65
-
66
- return secondaryStrategy.load(pApplet, path, extension);
67
- }
68
- }
69
-
70
- }
@@ -1,132 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2012-18 The Processing Foundation
7
- Copyright (c) 2004-12 Ben Fry and Casey Reas
8
- Copyright (c) 2001-04 Massachusetts Institute of Technology
9
-
10
- This library is free software; you can redistribute it and/or
11
- modify it under the terms of the GNU Lesser General Public
12
- License as published by the Free Software Foundation, version 2.1.
13
-
14
- This library is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- Lesser General Public License for more details.
18
-
19
- You should have received a copy of the GNU Lesser General
20
- Public License along with this library; if not, write to the
21
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
- Boston, MA 02111-1307 USA
23
- */
24
-
25
-
26
- package processing.core.util.image.load;
27
-
28
- import processing.core.PApplet;
29
- import processing.core.PImage;
30
- import processing.core.util.io.InputFactory;
31
-
32
- import javax.imageio.ImageIO;
33
- import java.awt.image.BufferedImage;
34
- import java.io.IOException;
35
- import java.io.InputStream;
36
- import java.util.concurrent.atomic.AtomicReference;
37
-
38
-
39
- /**
40
- * Use Java 1.4 ImageIO methods to load an image.
41
- */
42
- public class ImageIoImageLoadStrategy implements ImageLoadStrategy {
43
-
44
- private final AtomicReference<String[]> cachedLoadImageFormats;
45
-
46
- public ImageIoImageLoadStrategy() {
47
- cachedLoadImageFormats = new AtomicReference<>(null);
48
- }
49
-
50
- /**
51
- * Load an image after checking that its format is supported.
52
- *
53
- * @param pApplet The PApplet on whose behalf an image is being loaded. If null, cannot use sketch
54
- * relative file paths.
55
- * @param path The path to the file like "subdirectory/file.png". Note that paths without
56
- * extensions are supported and the extension is not read off this path but instead must be
57
- * specified in the extension parameter.
58
- * @param extension The extension of the file to open.
59
- * @return The newly loaded image.
60
- */
61
- @Override
62
- public PImage load(PApplet pApplet, String path, String extension) {
63
- String[] loadImageFormats = getLoadImageFormats();
64
-
65
- if (loadImageFormats != null) {
66
- for (String loadImageFormat : loadImageFormats) {
67
- if (extension.equals(loadImageFormat)) {
68
- return loadImageIOInner(pApplet, path);
69
- }
70
- }
71
- }
72
-
73
- // failed, could not load image after all those attempts
74
- System.err.println("Could not find a method to load " + path);
75
- return null;
76
- }
77
-
78
- /**
79
- * Get the list of supported image formats.
80
- *
81
- * @return List of image formats like "png" that are supported by this strategy.
82
- */
83
- private String[] getLoadImageFormats() {
84
- cachedLoadImageFormats.compareAndSet(null, ImageIO.getReaderFormatNames());
85
- return cachedLoadImageFormats.get();
86
- }
87
-
88
- /**
89
- * Load an image without checking that its format is supported.
90
- *
91
- * @param pApplet The PApplet on whose behalf an image is being loaded. If null, cannot use sketch
92
- * relative file paths.
93
- * @param path The path to the file like "subdirectory/file.png". Note that paths without
94
- * extensions are supported and the extension is not read off this path but instead must be
95
- * specified in the extension parameter.
96
- * @return The newly loaded image.
97
- */
98
- private PImage loadImageIOInner(PApplet pApplet, String filename) {
99
- InputStream stream = InputFactory.createInput(pApplet, filename);
100
- if (stream == null) {
101
- System.err.println("The image " + filename + " could not be found.");
102
- return null;
103
- }
104
-
105
- try {
106
- BufferedImage bi = ImageIO.read(stream);
107
-
108
- int width = bi.getWidth();
109
- int height = bi.getHeight();
110
- int[] pixels = new int[width * height];
111
-
112
- bi.getRGB(0, 0, width, height, pixels, 0, width);
113
-
114
- // check the alpha for this image
115
- // was gonna call getType() on the image to see if RGB or ARGB,
116
- // but it's not actually useful, since gif images will come through
117
- // as TYPE_BYTE_INDEXED, which means it'll still have to check for
118
- // the transparency. also, would have to iterate through all the other
119
- // types and guess whether alpha was in there, so.. just gonna stick
120
- // with the old method.
121
- PImage outgoing = new PImage(width, height, pixels, true, pApplet);
122
-
123
- stream.close();
124
- // return the image
125
- return outgoing;
126
-
127
- } catch (IOException e) {
128
- return null;
129
- }
130
- }
131
-
132
- }
@@ -1,48 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2012-18 The Processing Foundation
7
- Copyright (c) 2004-12 Ben Fry and Casey Reas
8
- Copyright (c) 2001-04 Massachusetts Institute of Technology
9
-
10
- This library is free software; you can redistribute it and/or
11
- modify it under the terms of the GNU Lesser General Public
12
- License as published by the Free Software Foundation, version 2.1.
13
-
14
- This library is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- Lesser General Public License for more details.
18
-
19
- You should have received a copy of the GNU Lesser General
20
- Public License along with this library; if not, write to the
21
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
- Boston, MA 02111-1307 USA
23
- */
24
-
25
- package processing.core.util.image.load;
26
-
27
- import processing.core.PApplet;
28
- import processing.core.PImage;
29
-
30
-
31
- /**
32
- * Interface for strategies to load different image formats and through different methods.
33
- */
34
- public interface ImageLoadStrategy {
35
-
36
- /**
37
- * Load an image.
38
- *
39
- * @param pApplet The PApplet on whose behalf an image is being loaded.
40
- * @param path The path to the file like "subdirectory/file.png". Note that paths without
41
- * extensions are supported and the extension is not read off this path but instead must be
42
- * specified in the extension parameter.
43
- * @param extension The extension of the file to open.
44
- * @return The PImage loaded from the given path.
45
- */
46
- PImage load(PApplet pApplet, String path, String extension);
47
-
48
- }