FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

whyi/processing@ed4d1a2 · GitHub

Repository navigation

Commit ed4d1a2

Browse files
committed
1 parent 53fdb9b commit ed4d1a2

4 files changed

Lines changed: 49 additions & 136 deletions

File tree

‎java/examples/Topics/File IO/SaveFrames/SaveFrames.pde‎

Lines changed: 0 additions & 68 deletions
This file was deleted.

‎java/examples/Topics/File IO/SavingFrames/SavingFrames.pde‎

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Extrusion.
3+
*
4+
* Converts a flat image into spatial data points and rotates the points
5+
* around the center.
6+
*/
7+
8+
PImage a;
9+
boolean onetime = true;
10+
int[][] aPixels;
11+
int[][] values;
12+
float angle;
13+
14+
void setup() {
15+
size(640, 360, P3D);
16+
17+
aPixels = new int[width][height];
18+
values = new int[width][height];
19+
noFill();
20+
21+
// Load the image into a new array
22+
// Extract the values and store in an array
23+
a = loadImage("ystone08.jpg");
24+
a.loadPixels();
25+
for (int i = 0; i < a.height; i++) {
26+
for (int j = 0; j < a.width; j++) {
27+
aPixels[j][i] = a.pixels[i*a.width + j];
28+
values[j][i] = int(blue(aPixels[j][i]));
29+
}
30+
}
31+
}
32+
33+
void draw() {
34+
background(0);
35+
translate(width/2, height/2, -height/2);
36+
scale(2.0);
37+
38+
// Update and constrain the angle
39+
angle += 0.005;
40+
rotateY(angle);
41+
42+
// Display the image mass
43+
for (int i = 0; i < a.height; i += 4) {
44+
for (int j = 0; j < a.width; j += 4) {
45+
stroke(values[j][i], 255);
46+
line(j-a.width/2, i-a.height/2, -values[j][i], j-a.width/2, i-a.height/2, -values[j][i]-10);
47+
}
48+
}
49+
}
55.7 KB
LoadingViewer requires iframe.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL