Fit n rectangles (images) in another rectangle (window) changing scale...
I'm developing a image viewing program, and I would like to offer the possibility to show all images in a directory as a single window (no scrolling) mosaic, wasting as little space as possible, and in the case the images cannot fit, reduce the scale of all images. In concept, is really similar to the "Expos? functionality in the latest Mac OS X version.
I would appreciate pointers on how to solve this problem. I've been looking into "bin-packing" algorithms, and maybe I could achieve the desired effect making some kind of search applying that algorithm, and if the rectangles cannot be fit then reduce the scale...
Does anyone know if there's a similar feature in any open source program, so I could take a look at the implementation?
Is there any "bin packing approximation" implementation/library in Java?

