I'd appreciate some advice on the best (or a better) way of displaying multiple resized images on-screen. I'm writing a rack planning application for modular synthesizers. Take a look at the image below:
You can see that there are 18 fairly large jpegs being displayed, each of which uses another small overlayed image of a screw 4 times. The example above runs pretty well at around 20fps, but when zoomed in so that the majority of the screen is filled with the images, this can drop down to below 10fps.
This is running in a 'standard' window in Processing 1.5.1. If I switch to OpenGL then I get a constant 60fps on my works laptop which has a powerful graphics card. The problem is that on a lesser laptop with nono-dedicated graphics then I still get the high frame rate, but the quality of the drawn curves really breaks down and it all 'goes jaggy' so I really need a 'standard mode' solution.
The sketch first checks to see if a each image is on-screen before drawing it. The jpegs are all resized on load to a maximum of 400px high. This keeps the detail nice on zooming-in. The screen is then scaled and transformed to show the area of interest.
I was considering a re-write to somehow only update the screen with moving elements, but am concerned that if I write all the existing images to one big image then that'll degrade performance even more.
Are there any back-buffering tricks that might help? Or any other advice ondrawing many (potentially 100's of) images to the screen.
I've managed to get unzipping working just fine using the unzipit library, but am having trouble with getting zipping-up (creating a zip file) working. I've found a couple of java examples like the one below:
FileInputStream in =newFileInputStream("F:/sometxt.txt");
// out put file
ZipOutputStream out =newZipOutputStream(newFileOutputStream("F:/tmp.zip"));
// name the file inside the zip file
out.putNextEntry(newZipEntry("zippedjava.txt"));
byte[] b =newbyte[1024];
int count;
while((count = in.read(b))>0){
System.out.println();
out.write(b,0, count);
}
out.close();
in.close();
}
}
... but I'm unable to get any of them to work. I've searched the forum but not found a simple example. Could one of you please help me out with some simple working Processing code that can compress 2 (or more) files into a single zip?