What mommy won’t tell you about Processing rev146

Processing rev146 came out a few days ago(since then r148 showed up). Till now, I’ve been using rev135-expert, so it’s about time to upgrade. Since there really weren’t any good new games on the horizon, I dove into revisions.txt(I will marry my procrastination one day). As usual some changes and bugfixes were made.
Here are some of the interesting functions I found there, that haven’t been added to the reference yet:

Dialog boxes
Functions that prompt the user for a file to open, a location to save a file, or select a folder:

String loadPath = selectInput(“What file ya want?”);
String savePath = selectOutput(“Save this masterpiece as…”);
String folderPath = selectFolder(“Which folder has the good stuff?”);

Couldn’t make it work in browser because of

java.security.AccessControlException: access denied

Oh well you can’t have everything. It works in P5 environment and exported application (at least in Windows)

This function load images on a separate thread so that your sketch does not freeze while images load during setup(). While the image is loading, its width and height will be 0. If an error occurs while loading the image, its width and height will be set to -1. You’ll know when the image has loaded properly because its width and height will be > 0.
Wouldn’t it be nice if the height parameter would store the percentage of the loaded data?

PImage.resize(int width, int height)
Allows you to resize a PImage in place. Setting width or height to zero will resize that dimension in proportion to the other.
Keep in mind that this won’t work if called right after requestImage()

textAlign(ALIGN, YALIGN);
Added vertical param fo textAlign for text(str, x, y, w, h)

there’s also
so Hasta la Vista for

image(gfx, -gfx.width*0.5, -gfx.height*0.5);

but it doesn’t work for me. Neither in r146 nor r148.

Download source code that uses all of the presented functions

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.