diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index afa0dae10..bc0ec02f1 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -35,6 +35,13 @@ PROCESSING 2.0b7 (REV 0215) - 25 November 2012 http://code.google.com/p/processing/issues/detail?id=1354 http://guides.macrumors.com/Keyboard_shortcuts§ion=10#Text_Shortcuts ++ Set quality level higher when exporting JPEG images. This will result + in larger JPEG files with save() and saveFrame(), but the default quality + setting in the past was unacceptable for many/most projects. + http://code.google.com/p/processing/issues/detail?id=58 + See the bug report link for how to implement in case you want to set + the quality lower (or even higher) than the new default. + + Table row iterating syntax has changed. This code: for (TableRow row : table) { ... } has now changed to @@ -185,6 +192,9 @@ PROCESSING 2.0b7 (REV 0215) - 25 November 2012 + begin/endShape with a single vertex causing crash on P2D/P3D. http://code.google.com/p/processing/issues/detail?id=1421 ++ Using a PGraphics as a texture produces visual artifacts. + http://code.google.com/p/processing/issues/detail?id=1420 + [ android ] + Like the desktop release, removed default imports. This includes: diff --git a/core/src/processing/core/PImage.java b/core/src/processing/core/PImage.java index 84f01a535..83464060b 100644 --- a/core/src/processing/core/PImage.java +++ b/core/src/processing/core/PImage.java @@ -29,6 +29,8 @@ import java.awt.image.*; import java.io.*; import java.lang.reflect.Method; +import com.sun.image.codec.jpeg.*; + /** * ( begin auto-generated from PImage.xml ) @@ -3067,11 +3069,15 @@ public class PImage implements PConstants, Cloneable { int outputFormat = (format == ARGB) ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB; + String extension = + path.substring(path.lastIndexOf('.') + 1).toLowerCase(); + // JPEG and BMP images that have an alpha channel set get pretty unhappy. // BMP just doesn't write, and JPEG writes it as a CMYK image. // http://code.google.com/p/processing/issues/detail?id=415 - String lower = path.toLowerCase(); - if (lower.endsWith("bmp") || lower.endsWith("jpg") || lower.endsWith("jpeg")) { +// String lower = path.toLowerCase(); +// if (lower.endsWith("bmp") || lower.endsWith("jpg") || lower.endsWith("jpeg")) { + if (extension.equals("bmp") || extension.equals("jpg") || extension.equals("jpeg")) { outputFormat = BufferedImage.TYPE_INT_RGB; } @@ -3079,9 +3085,31 @@ public class PImage implements PConstants, Cloneable { bimage.setRGB(0, 0, width, height, pixels, 0, width); File file = new File(path); - String extension = path.substring(path.lastIndexOf('.') + 1); - return javax.imageio.ImageIO.write(bimage, extension, file); + if (extension.equals("jpg") || extension.equals("jpeg")) { +// ByteArrayOutputStream out = new ByteArrayOutputStream(); +// JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); + BufferedOutputStream output = + new BufferedOutputStream(new FileOutputStream(file)); + JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(output); + JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bimage); + // Set JPEG quality to 90% with baseline optimization. Setting this + // to 1 was a huge jump (about triple the size), so this seems good. + // Oddly, a smaller file size than Photoshop at 90%, but it's a + // completely different algorithm, I suppose. + param.setQuality(0.9f, true); +// p.setQuality(1, true); + encoder.setJPEGEncodeParam(param); + encoder.encode(bimage); + output.flush(); + output.close(); +// FileOutputStream fo = new FileOutputStream(new File(path)); +// out.writeTo(fo); + return true; + + } else { + return javax.imageio.ImageIO.write(bimage, extension, file); + } } catch (Exception e) { e.printStackTrace(); diff --git a/core/todo.txt b/core/todo.txt index f5fe8cb7f..dc97260cc 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -78,6 +78,12 @@ A set(x, y, PImage) doesn't work with P2D/P3D A http://code.google.com/p/processing/issues/detail?id=1185 A Processing 2.0b6 p2d / p3d arraylist pvector display issues A http://code.google.com/p/processing/issues/detail?id=1421 +A Using a PGraphics as a texture produces visual artifacts in P2D/P3D. +A http://code.google.com/p/processing/issues/detail?id=1420 +X set quality level higher when exporting JPEG images +o add ability to control jpeg compression level with save() and saveFrame() +o or just write a better example for this one? +X http://code.google.com/p/processing/issues/detail?id=58 _ implement mousePressed(Event) etc _ better to do this instead of bringing back the magic event @@ -624,10 +630,6 @@ _ http://code.google.com/p/processing/issues/detail?id=219 _ Semitransparent rect drawn over image not rendered correctly _ http://code.google.com/p/processing/issues/detail?id=182 -_ add ability to control jpeg compression level with save() and saveFrame() -_ or just write a better example for this one? -_ http://code.google.com/p/processing/issues/detail?id=58 - CORE / PShape diff --git a/todo.txt b/todo.txt index 74943ebae..d7ac35bdf 100644 --- a/todo.txt +++ b/todo.txt @@ -60,6 +60,12 @@ earlier X The sketch name can't begin with '_' (underscore) X http://code.google.com/p/processing/issues/detail?id=859 +_ add to build.xml +_ insert "@SuppressWarnings({"unused", "cast"})" into +_ JavaLexer, JavaRecognizer, PdeLexer, PdeRecognizer +_ from processing/mode/java/preproc/ + + 2.0 FINAL / casey requests _ errors that cannot be placed (i.e. missing brace)