MCPcopy Index your code
hub / github.com/benfry/processing4 / saveImpl

Method saveImpl

core/src/processing/core/PImage.java:3227–3251  ·  view source on GitHub ↗

Override this in subclasses to intercept save calls for other formats or higher-performance implementations. When reaching this code, pixels must be loaded and that path should be absolute. @param path must be a full path (not relative or simply a filename)

(String path)

Source from the content-addressed store, hash-verified

3225 * @param path must be a full path (not relative or simply a filename)
3226 */
3227 protected boolean saveImpl(String path) {
3228 // Make sure the pixel data is ready to go
3229 loadPixels();
3230 boolean success;
3231
3232 try {
3233 final String lower = path.toLowerCase();
3234
3235 if (lower.endsWith(".tga")) {
3236 OutputStream os = new BufferedOutputStream(new FileOutputStream(path), 32768);
3237 success = saveTGA(os); //, pixels, width, height, format);
3238 os.close();
3239
3240 } else {
3241 // TODO Imperfect, possibly temporary solution for 4.x releases
3242 // https://github.com/processing/processing4/wiki/Exorcising-AWT
3243 success = ShimAWT.saveImage(this, path);
3244 }
3245 } catch (IOException e) {
3246 System.err.println("Error while saving " + path);
3247 e.printStackTrace();
3248 success = false;
3249 }
3250 return success;
3251 }
3252}

Callers 1

saveMethod · 0.95

Calls 6

loadPixelsMethod · 0.95
saveTGAMethod · 0.95
saveImageMethod · 0.95
closeMethod · 0.45
printlnMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected