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

video library updates · ranlevinstein/processing@7f909db · GitHub

Repository navigation

Commit 7f909db

Browse files
committed
video library updates
1 parent b700cf5 commit 7f909db

24 files changed

Lines changed: 137 additions & 140 deletions

File tree

‎java/libraries/video/examples/Capture/AsciiVideo/AsciiVideo.pde‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ PFont font;
2626
float fontSize = 1.5;
2727

2828

29-
public void setup() {
30-
size(640, 480, P3D);
31-
// Or run full screen, more fun! Use with Sketch -> Present
32-
//size(screen.width, screen.height, OPENGL);
29+
void setup() {
30+
size(640, 480, P2D);
3331

3432
// Uses the default video input, see the reference if this causes an error
3533
video = new Capture(this, 160, 120);
@@ -59,7 +57,7 @@ public void setup() {
5957
}
6058

6159

62-
public void captureEvent(Capture c) {
60+
void captureEvent(Capture c) {
6361
c.read();
6462
}
6563

@@ -76,6 +74,7 @@ void draw() {
7674
textFont(font, fontSize);
7775

7876
int index = 0;
77+
video.loadPixels();
7978
for (int y = 1; y < video.height; y++) {
8079

8180
// Move down for next line
@@ -127,7 +126,7 @@ void draw() {
127126
* 'g' grabs an image and saves the frame to a tiff image
128127
* 'f' and 'F' increase and decrease the font size
129128
*/
130-
public void keyPressed() {
129+
void keyPressed() {
131130
switch (key) {
132131
case 'g': saveFrame(); break;
133132
case 'c': cheatScreen = !cheatScreen; break;

‎java/libraries/video/examples/Capture/BackgroundSubtraction/BackgroundSubtraction.pde‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Capture video;
1515

1616
void setup() {
1717
// Change size to 320 x 240 if too slow at 640 x 480
18-
size(640, 480);
18+
size(640, 480, P2D);
1919

2020
video = new Capture(this, width, height);
2121
video.start();

‎java/libraries/video/examples/Capture/BrightnessThresholding/BrightnessThresholding.pde‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int numPixels;
1515
Capture video;
1616

1717
void setup() {
18-
size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480
18+
size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480
1919
strokeWeight(5);
2020
// Uses the default video input, see the reference if this causes an error
2121
video = new Capture(this, width, height);

‎java/libraries/video/examples/Capture/BrightnessTracking/BrightnessTracking.pde‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import processing.video.*;
1111
Capture video;
1212

1313
void setup() {
14-
size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480
14+
size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480
1515
// Uses the default video input, see the reference if this causes an error
1616
video = new Capture(this, width, height);
1717
video.start();

‎java/libraries/video/examples/Capture/ColorSorting/ColorSorting.pde‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ int[] bright;
2020
int increment = 5;
2121

2222

23-
public void setup() {
24-
size(800, 600, P3D);
23+
void setup() {
24+
size(800, 600, P2D);
2525

2626
noCursor();
2727
// Uses the default video input, see the reference if this causes an error
@@ -39,9 +39,10 @@ public void setup() {
3939
}
4040

4141

42-
public void draw() {
42+
void draw() {
4343
if (video.available()) {
4444
video.read();
45+
video.loadPixels();
4546

4647
background(0);
4748
noStroke();
@@ -85,7 +86,7 @@ public void draw() {
8586
}
8687

8788

88-
public void keyPressed() {
89+
void keyPressed() {
8990
if (key == 'g') {
9091
saveFrame();
9192
} else if (key == 'c') {

‎java/libraries/video/examples/Capture/ColorSorting/Tuple.pde‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
class Tuple {
44
float x, y, z;
55

6-
public Tuple() { }
6+
Tuple() { }
77

8-
public Tuple(float x, float y, float z) {
8+
Tuple(float x, float y, float z) {
99
set(x, y, z);
1010
}
1111

12-
public void set(float x, float y, float z) {
12+
void set(float x, float y, float z) {
1313
this.x = x;
1414
this.y = y;
1515
this.z = z;
1616
}
1717

18-
public void target(Tuple another, float amount) {
18+
void target(Tuple another, float amount) {
1919
float amount1 = 1.0 - amount;
2020
x = x*amount1 + another.x*amount;
2121
y = y*amount1 + another.y*amount;
2222
z = z*amount1 + another.z*amount;
2323
}
2424

25-
public void phil() {
25+
void phil() {
2626
fill(x, y, z);
2727
}
2828
}

‎java/libraries/video/examples/Capture/Disgrand/Disgrand.pde‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ int[] bright;
1919
int increment = 5;
2020

2121

22-
public void setup() {
23-
size(800, 600, P3D);
22+
void setup() {
23+
size(800, 600, P2D);
2424

2525
noCursor();
2626
// Uses the default video input, see the reference if this causes an error
@@ -38,9 +38,10 @@ public void setup() {
3838
}
3939

4040

41-
public void draw() {
41+
void draw() {
4242
if (video.available()) {
4343
video.read();
44+
video.loadPixels();
4445

4546
background(0);
4647
noStroke();
@@ -84,7 +85,7 @@ public void draw() {
8485
}
8586

8687

87-
public void keyPressed() {
88+
void keyPressed() {
8889
if (key == 'g') {
8990
saveFrame();
9091
} else if (key == 'c') {

‎java/libraries/video/examples/Capture/Disgrand/Tuple.pde‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
class Tuple {
44
float x, y, z;
55

6-
public Tuple() { }
6+
Tuple() { }
77

8-
public Tuple(float x, float y, float z) {
8+
Tuple(float x, float y, float z) {
99
set(x, y, z);
1010
}
1111

12-
public void set(float x, float y, float z) {
12+
void set(float x, float y, float z) {
1313
this.x = x;
1414
this.y = y;
1515
this.z = z;
1616
}
1717

18-
public void target(Tuple another, float amount) {
18+
void target(Tuple another, float amount) {
1919
float amount1 = 1.0 - amount;
2020
x = x*amount1 + another.x*amount;
2121
y = y*amount1 + another.y*amount;
2222
z = z*amount1 + another.z*amount;
2323
}
2424

25-
public void phil() {
25+
void phil() {
2626
fill(x, y, z);
2727
}
2828
}

‎java/libraries/video/examples/Capture/FrameDifferencing/FrameDifferencing.pde‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int[] previousFrame;
1313
Capture video;
1414

1515
void setup() {
16-
size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480
16+
size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480
1717
// Uses the default video input, see the reference if this causes an error
1818
video = new Capture(this, width, height);
1919
video.start();

‎java/libraries/video/examples/Capture/Framingham/Framingham.pde‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Currently broken with the P2D renderer.
2+
13
/**
24
* Framingham
35
* by Ben Fry.
@@ -18,7 +20,7 @@ int[] scoot;
1820

1921

2022
void setup() {
21-
size(640, 480, P3D);
23+
size(640, 480, P2D);
2224

2325
// Uses the default video input, see the reference if this causes an error
2426
video = new Capture(this, 160, 120);
@@ -39,6 +41,7 @@ void draw() {
3941
// By using video.available, only the frame rate need be set inside setup()
4042
if (video.available()) {
4143
video.read();
44+
video.loadPixels();
4245
set(video.width*column, video.height*lastRow, video);
4346
column++;
4447
if (column == columnCount) {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL