propane 3.4.0-java → 3.4.1-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.
- checksums.yaml +4 -4
- data/.mvn/extensions.xml +1 -2
- data/.travis.yml +2 -2
- data/CHANGELOG.md +2 -0
- data/README.md +12 -7
- data/Rakefile +2 -2
- data/lib/propane.rb +2 -2
- data/lib/propane/app.rb +18 -9
- data/lib/propane/helper_methods.rb +1 -1
- data/lib/propane/runner.rb +1 -1
- data/lib/propane/version.rb +1 -1
- data/library/color_group/color_group.rb +26 -0
- data/library/dxf/dxf.rb +4 -0
- data/library/net/net.rb +5 -0
- data/library/video_event/video_event.rb +2 -1
- data/pom.rb +3 -3
- data/pom.xml +3 -3
- data/propane.gemspec +1 -1
- data/src/main/java/japplemenubar/JAppleMenuBar.java +3 -3
- data/src/main/java/monkstone/ColorUtil.java +14 -0
- data/src/main/java/monkstone/MathToolModule.java +243 -194
- data/src/main/java/monkstone/filechooser/Chooser.java +1 -0
- data/src/main/java/monkstone/slider/WheelHandler.java +6 -5
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +3 -2
- data/src/main/java/monkstone/videoevent/CaptureEvent.java +27 -0
- data/src/main/java/monkstone/videoevent/{VideoInterface.java → MovieEvent.java} +10 -26
- data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
- data/src/main/java/processing/core/PApplet.java +1236 -599
- data/src/main/java/processing/core/PGraphics.java +59 -59
- data/src/main/java/processing/core/PImage.java +528 -129
- data/src/main/java/processing/core/PShape.java +10 -10
- data/src/main/java/processing/core/PVector.java +2 -2
- data/src/main/java/processing/core/ThinkDifferent.java +5 -7
- data/src/main/java/processing/dxf/RawDXF.java +404 -0
- data/src/main/java/processing/net/Client.java +744 -0
- data/src/main/java/processing/net/Server.java +388 -0
- data/src/main/java/processing/opengl/FontTexture.java +19 -20
- data/src/main/java/processing/opengl/FrameBuffer.java +27 -17
- data/src/main/java/processing/opengl/LinePath.java +512 -508
- data/src/main/java/processing/opengl/PGL.java +3106 -3066
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +4 -4
- data/src/main/java/processing/opengl/PShader.java +1442 -1341
- data/vendors/Rakefile +3 -27
- metadata +12 -25
- data/src/main/java/processing/core/util/image/ImageLoadFacade.java +0 -161
- data/src/main/java/processing/core/util/image/ImageSaveFacade.java +0 -169
- data/src/main/java/processing/core/util/image/constants/TifConstants.java +0 -45
- data/src/main/java/processing/core/util/image/load/AwtImageLoadStrategy.java +0 -80
- data/src/main/java/processing/core/util/image/load/Base64StringImageLoadStrategy.java +0 -73
- data/src/main/java/processing/core/util/image/load/FallbackImageLoadStrategy.java +0 -70
- data/src/main/java/processing/core/util/image/load/ImageIoImageLoadStrategy.java +0 -132
- data/src/main/java/processing/core/util/image/load/ImageLoadStrategy.java +0 -48
- data/src/main/java/processing/core/util/image/load/ImageLoadUtil.java +0 -45
- data/src/main/java/processing/core/util/image/load/TgaImageLoadStrategy.java +0 -255
- data/src/main/java/processing/core/util/image/load/TiffImageLoadStrategy.java +0 -98
- data/src/main/java/processing/core/util/image/save/ImageSaveStrategy.java +0 -49
- data/src/main/java/processing/core/util/image/save/ImageSaveUtil.java +0 -48
- data/src/main/java/processing/core/util/image/save/ImageWriterImageSaveStrategy.java +0 -179
- data/src/main/java/processing/core/util/image/save/SaveImageException.java +0 -41
- data/src/main/java/processing/core/util/image/save/TgaImageSaveStrategy.java +0 -198
- data/src/main/java/processing/core/util/image/save/TiffImageSaveStrategy.java +0 -91
- data/src/main/java/processing/core/util/image/save/TiffNakedFilenameImageSaveStrategy.java +0 -57
- data/src/main/java/processing/core/util/io/InputFactory.java +0 -285
- 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.load;
|
26
|
-
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Convenience functions for use while loading images.
|
30
|
-
*/
|
31
|
-
public class ImageLoadUtil {
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Determine if a file requires alpha channel checking.
|
35
|
-
*
|
36
|
-
* @param extension The file extension.
|
37
|
-
* @return True if one needs to look for alpha channel and false otherwise.
|
38
|
-
*/
|
39
|
-
public static boolean checkExtensionRequiresAlpha(String extension) {
|
40
|
-
return extension.equals("gif") ||
|
41
|
-
extension.equals("png") ||
|
42
|
-
extension.equals("unknown");
|
43
|
-
}
|
44
|
-
|
45
|
-
}
|
@@ -1,255 +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.PConstants;
|
29
|
-
import processing.core.PImage;
|
30
|
-
|
31
|
-
import java.io.IOException;
|
32
|
-
import java.io.InputStream;
|
33
|
-
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Strategy for loading a RLE-compressed TGA image.
|
37
|
-
*/
|
38
|
-
public class TgaImageLoadStrategy implements ImageLoadStrategy {
|
39
|
-
|
40
|
-
@Override
|
41
|
-
public PImage load(PApplet pApplet, String path, String extension) {
|
42
|
-
try {
|
43
|
-
PImage image = loadNoCatch(pApplet, path);
|
44
|
-
return image;
|
45
|
-
} catch (IOException e) {
|
46
|
-
e.printStackTrace();
|
47
|
-
return null;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Targa image loader for RLE-compressed TGA files which throws exceptions.
|
53
|
-
* <p>
|
54
|
-
* Rewritten for 0115 to read/write RLE-encoded targa images.
|
55
|
-
* For 0125, non-RLE encoded images are now supported, along with
|
56
|
-
* images whose y-order is reversed (which is standard for TGA files).
|
57
|
-
* <p>
|
58
|
-
* A version of this function is in MovieMaker.java. Any fixes here
|
59
|
-
* should be applied over in MovieMaker as well.
|
60
|
-
* <p>
|
61
|
-
* Known issue with RLE encoding and odd behavior in some apps:
|
62
|
-
* https://github.com/processing/processing/issues/2096
|
63
|
-
* Please help!
|
64
|
-
*/
|
65
|
-
private PImage loadNoCatch(PApplet pApplet, String filename) throws IOException {
|
66
|
-
InputStream is = pApplet.createInput(filename);
|
67
|
-
if (is == null) return null;
|
68
|
-
|
69
|
-
byte header[] = new byte[18];
|
70
|
-
int offset = 0;
|
71
|
-
do {
|
72
|
-
int count = is.read(header, offset, header.length - offset);
|
73
|
-
if (count == -1) return null;
|
74
|
-
offset += count;
|
75
|
-
} while (offset < 18);
|
76
|
-
|
77
|
-
/*
|
78
|
-
header[2] image type code
|
79
|
-
2 (0x02) - Uncompressed, RGB images.
|
80
|
-
3 (0x03) - Uncompressed, black and white images.
|
81
|
-
10 (0x0A) - Run-length encoded RGB images.
|
82
|
-
11 (0x0B) - Compressed, black and white images. (grayscale?)
|
83
|
-
|
84
|
-
header[16] is the bit depth (8, 24, 32)
|
85
|
-
|
86
|
-
header[17] image descriptor (packed bits)
|
87
|
-
0x20 is 32 = origin upper-left
|
88
|
-
0x28 is 32 + 8 = origin upper-left + 32 bits
|
89
|
-
|
90
|
-
7 6 5 4 3 2 1 0
|
91
|
-
128 64 32 16 8 4 2 1
|
92
|
-
*/
|
93
|
-
|
94
|
-
int format = 0;
|
95
|
-
|
96
|
-
if (((header[2] == 3) || (header[2] == 11)) && // B&W, plus RLE or not
|
97
|
-
(header[16] == 8) && // 8 bits
|
98
|
-
((header[17] == 0x8) || (header[17] == 0x28))) { // origin, 32 bit
|
99
|
-
format = PConstants.ALPHA;
|
100
|
-
|
101
|
-
} else if (((header[2] == 2) || (header[2] == 10)) && // RGB, RLE or not
|
102
|
-
(header[16] == 24) && // 24 bits
|
103
|
-
((header[17] == 0x20) || (header[17] == 0))) { // origin
|
104
|
-
format = PConstants.RGB;
|
105
|
-
|
106
|
-
} else if (((header[2] == 2) || (header[2] == 10)) &&
|
107
|
-
(header[16] == 32) &&
|
108
|
-
((header[17] == 0x8) || (header[17] == 0x28))) { // origin, 32
|
109
|
-
format = PConstants.ARGB;
|
110
|
-
}
|
111
|
-
|
112
|
-
if (format == 0) {
|
113
|
-
System.err.println("Unknown .tga file format for " + filename);
|
114
|
-
//" (" + header[2] + " " +
|
115
|
-
//(header[16] & 0xff) + " " +
|
116
|
-
//hex(header[17], 2) + ")");
|
117
|
-
return null;
|
118
|
-
}
|
119
|
-
|
120
|
-
int w = ((header[13] & 0xff) << 8) + (header[12] & 0xff);
|
121
|
-
int h = ((header[15] & 0xff) << 8) + (header[14] & 0xff);
|
122
|
-
PImage outgoing = pApplet.createImage(w, h, format);
|
123
|
-
|
124
|
-
// where "reversed" means upper-left corner (normal for most of
|
125
|
-
// the modernized world, but "reversed" for the tga spec)
|
126
|
-
//boolean reversed = (header[17] & 0x20) != 0;
|
127
|
-
// https://github.com/processing/processing/issues/1682
|
128
|
-
boolean reversed = (header[17] & 0x20) == 0;
|
129
|
-
|
130
|
-
if ((header[2] == 2) || (header[2] == 3)) { // not RLE encoded
|
131
|
-
if (reversed) {
|
132
|
-
int index = (h-1) * w;
|
133
|
-
switch (format) {
|
134
|
-
case PConstants.ALPHA:
|
135
|
-
for (int y = h-1; y >= 0; y--) {
|
136
|
-
for (int x = 0; x < w; x++) {
|
137
|
-
outgoing.pixels[index + x] = is.read();
|
138
|
-
}
|
139
|
-
index -= w;
|
140
|
-
}
|
141
|
-
break;
|
142
|
-
case PConstants.RGB:
|
143
|
-
for (int y = h-1; y >= 0; y--) {
|
144
|
-
for (int x = 0; x < w; x++) {
|
145
|
-
outgoing.pixels[index + x] =
|
146
|
-
is.read() | (is.read() << 8) | (is.read() << 16) |
|
147
|
-
0xff000000;
|
148
|
-
}
|
149
|
-
index -= w;
|
150
|
-
}
|
151
|
-
break;
|
152
|
-
case PConstants.ARGB:
|
153
|
-
for (int y = h-1; y >= 0; y--) {
|
154
|
-
for (int x = 0; x < w; x++) {
|
155
|
-
outgoing.pixels[index + x] =
|
156
|
-
is.read() | (is.read() << 8) | (is.read() << 16) |
|
157
|
-
(is.read() << 24);
|
158
|
-
}
|
159
|
-
index -= w;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
} else { // not reversed
|
163
|
-
int count = w * h;
|
164
|
-
switch (format) {
|
165
|
-
case PConstants.ALPHA:
|
166
|
-
for (int i = 0; i < count; i++) {
|
167
|
-
outgoing.pixels[i] = is.read();
|
168
|
-
}
|
169
|
-
break;
|
170
|
-
case PConstants.RGB:
|
171
|
-
for (int i = 0; i < count; i++) {
|
172
|
-
outgoing.pixels[i] =
|
173
|
-
is.read() | (is.read() << 8) | (is.read() << 16) |
|
174
|
-
0xff000000;
|
175
|
-
}
|
176
|
-
break;
|
177
|
-
case PConstants.ARGB:
|
178
|
-
for (int i = 0; i < count; i++) {
|
179
|
-
outgoing.pixels[i] =
|
180
|
-
is.read() | (is.read() << 8) | (is.read() << 16) |
|
181
|
-
(is.read() << 24);
|
182
|
-
}
|
183
|
-
break;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
} else { // header[2] is 10 or 11
|
188
|
-
int index = 0;
|
189
|
-
int px[] = outgoing.pixels;
|
190
|
-
|
191
|
-
while (index < px.length) {
|
192
|
-
int num = is.read();
|
193
|
-
boolean isRLE = (num & 0x80) != 0;
|
194
|
-
if (isRLE) {
|
195
|
-
num -= 127; // (num & 0x7F) + 1
|
196
|
-
int pixel = 0;
|
197
|
-
switch (format) {
|
198
|
-
case PConstants.ALPHA:
|
199
|
-
pixel = is.read();
|
200
|
-
break;
|
201
|
-
case PConstants.RGB:
|
202
|
-
pixel = 0xFF000000 |
|
203
|
-
is.read() | (is.read() << 8) | (is.read() << 16);
|
204
|
-
//(is.read() << 16) | (is.read() << 8) | is.read();
|
205
|
-
break;
|
206
|
-
case PConstants.ARGB:
|
207
|
-
pixel = is.read() |
|
208
|
-
(is.read() << 8) | (is.read() << 16) | (is.read() << 24);
|
209
|
-
break;
|
210
|
-
}
|
211
|
-
for (int i = 0; i < num; i++) {
|
212
|
-
px[index++] = pixel;
|
213
|
-
if (index == px.length) break;
|
214
|
-
}
|
215
|
-
} else { // write up to 127 bytes as uncompressed
|
216
|
-
num += 1;
|
217
|
-
switch (format) {
|
218
|
-
case PConstants.ALPHA:
|
219
|
-
for (int i = 0; i < num; i++) {
|
220
|
-
px[index++] = is.read();
|
221
|
-
}
|
222
|
-
break;
|
223
|
-
case PConstants.RGB:
|
224
|
-
for (int i = 0; i < num; i++) {
|
225
|
-
px[index++] = 0xFF000000 |
|
226
|
-
is.read() | (is.read() << 8) | (is.read() << 16);
|
227
|
-
//(is.read() << 16) | (is.read() << 8) | is.read();
|
228
|
-
}
|
229
|
-
break;
|
230
|
-
case PConstants.ARGB:
|
231
|
-
for (int i = 0; i < num; i++) {
|
232
|
-
px[index++] = is.read() | //(is.read() << 24) |
|
233
|
-
(is.read() << 8) | (is.read() << 16) | (is.read() << 24);
|
234
|
-
//(is.read() << 16) | (is.read() << 8) | is.read();
|
235
|
-
}
|
236
|
-
break;
|
237
|
-
}
|
238
|
-
}
|
239
|
-
}
|
240
|
-
|
241
|
-
if (!reversed) {
|
242
|
-
int[] temp = new int[w];
|
243
|
-
for (int y = 0; y < h/2; y++) {
|
244
|
-
int z = (h-1) - y;
|
245
|
-
System.arraycopy(px, y*w, temp, 0, w);
|
246
|
-
System.arraycopy(px, z*w, px, y*w, w);
|
247
|
-
System.arraycopy(temp, 0, px, z*w, w);
|
248
|
-
}
|
249
|
-
}
|
250
|
-
}
|
251
|
-
is.close();
|
252
|
-
return outgoing;
|
253
|
-
}
|
254
|
-
|
255
|
-
}
|
@@ -1,98 +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.PConstants;
|
29
|
-
import processing.core.PImage;
|
30
|
-
import processing.core.util.image.constants.TifConstants;
|
31
|
-
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Strategy for loading a tif image.
|
35
|
-
*/
|
36
|
-
public class TiffImageLoadStrategy implements ImageLoadStrategy {
|
37
|
-
|
38
|
-
@Override
|
39
|
-
public PImage load(PApplet pApplet, String path, String extension) {
|
40
|
-
byte bytes[] = pApplet.loadBytes(path);
|
41
|
-
PImage image = (bytes == null) ? null : loadFromBytes(bytes);
|
42
|
-
return image;
|
43
|
-
}
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Load the tif image from bytes.
|
47
|
-
*
|
48
|
-
* @param tiff The bytes of the tif image.
|
49
|
-
* @return PImage created from the provided bytes.
|
50
|
-
*/
|
51
|
-
private PImage loadFromBytes(byte[] tiff) {
|
52
|
-
if ((tiff[42] != tiff[102]) || // width/height in both places
|
53
|
-
(tiff[43] != tiff[103])) {
|
54
|
-
System.err.println(TifConstants.TIFF_ERROR);
|
55
|
-
return null;
|
56
|
-
}
|
57
|
-
|
58
|
-
int width =
|
59
|
-
((tiff[30] & 0xff) << 8) | (tiff[31] & 0xff);
|
60
|
-
int height =
|
61
|
-
((tiff[42] & 0xff) << 8) | (tiff[43] & 0xff);
|
62
|
-
|
63
|
-
int count =
|
64
|
-
((tiff[114] & 0xff) << 24) |
|
65
|
-
((tiff[115] & 0xff) << 16) |
|
66
|
-
((tiff[116] & 0xff) << 8) |
|
67
|
-
(tiff[117] & 0xff);
|
68
|
-
if (count != width * height * 3) {
|
69
|
-
System.err.println(TifConstants.TIFF_ERROR + " (" + width + ", " + height +")");
|
70
|
-
return null;
|
71
|
-
}
|
72
|
-
|
73
|
-
// check the rest of the header
|
74
|
-
for (int i = 0; i < TifConstants.TIFF_HEADER.length; i++) {
|
75
|
-
if ((i == 30) || (i == 31) || (i == 42) || (i == 43) ||
|
76
|
-
(i == 102) || (i == 103) ||
|
77
|
-
(i == 114) || (i == 115) || (i == 116) || (i == 117)) continue;
|
78
|
-
|
79
|
-
if (tiff[i] != TifConstants.TIFF_HEADER[i]) {
|
80
|
-
System.err.println(TifConstants.TIFF_ERROR + " (" + i + ")");
|
81
|
-
return null;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
|
-
PImage outgoing = new PImage(width, height, PConstants.RGB);
|
86
|
-
int index = 768;
|
87
|
-
count /= 3;
|
88
|
-
for (int i = 0; i < count; i++) {
|
89
|
-
outgoing.pixels[i] =
|
90
|
-
0xFF000000 |
|
91
|
-
(tiff[index++] & 0xff) << 16 |
|
92
|
-
(tiff[index++] & 0xff) << 8 |
|
93
|
-
(tiff[index++] & 0xff);
|
94
|
-
}
|
95
|
-
return outgoing;
|
96
|
-
}
|
97
|
-
|
98
|
-
}
|
@@ -1,49 +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.save;
|
26
|
-
|
27
|
-
import java.io.IOException;
|
28
|
-
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Interface for strategies that can save images to different formats or via different methods.
|
32
|
-
*/
|
33
|
-
public interface ImageSaveStrategy {
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Save an image.
|
37
|
-
*
|
38
|
-
* @param pixels The raw pixel values (described by format) to be saved.
|
39
|
-
* @param pixelWidth The width of the image in pixels.
|
40
|
-
* @param pixelHeight The height of the image in pixels.
|
41
|
-
* @param format The format as described in PConstants like PConstants.RGB.
|
42
|
-
* @param filename The path to which the image should be written.
|
43
|
-
* @return True if writting succeeded and false otherwise.
|
44
|
-
* @throws IOException Thrown if the file writing encountered an unexpected error.
|
45
|
-
*/
|
46
|
-
boolean save(int[] pixels, int pixelWidth, int pixelHeight, int format,
|
47
|
-
String filename) throws IOException;
|
48
|
-
|
49
|
-
}
|