Created
October 29, 2013 07:04
-
-
Save yoggy/7210199 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.*; | |
| PImage [] imgs; | |
| void setup() { | |
| size(1200, 800); | |
| File folder = new java.io.File(dataPath("")); | |
| FilenameFilter jpgFilter = new java.io.FilenameFilter() { | |
| public boolean accept(File dir, String name) { | |
| return name.toLowerCase().endsWith(".jpg"); | |
| } | |
| }; | |
| String[] filenames = folder.list(jpgFilter); | |
| // | |
| imgs = new PImage[filenames.length]; | |
| for (int i = 0; i < filenames.length; ++i) { | |
| println("filenames[" + i + "]=" + filenames[i]); | |
| imgs[i] = loadImage(filenames[i]); | |
| imgs[i].resize(120, 80); | |
| } | |
| } | |
| void draw() { | |
| int x = 0, y = 0; | |
| for (int i = 0; i < imgs.length; ++i) { | |
| image(imgs[i], x, y); | |
| x += imgs[i].width; | |
| if (x >= width) { | |
| x = 0; | |
| y += imgs[i].height; | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment