Skip to content

Commit 241a61c

Browse files
committed
fixed some examples
1 parent 978991d commit 241a61c

File tree

9 files changed

+10
-7
lines changed

9 files changed

+10
-7
lines changed

examples/Basics/Image/CreateImage/CreateImage.pde

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void setup()
1111
{
1212
size(200, 200);
1313
img = createImage(120, 120, ARGB);
14+
img.loadPixels();
1415
for(int i=0; i < img.pixels.length; i++) {
1516
img.pixels[i] = color(0, 90, 102, i%img.width * 2);
1617
}

examples/Topics/Effects/FireCube/FireCube.pde

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void setup(){
2828

2929
// Create buffered image for 3d cube
3030
pg = createGraphics(width, height, P3D);
31+
pg.loadPixels();
3132

3233
calc1 = new int[width];
3334
calc3 = new int[width];

examples/Topics/Effects/Lens/Lens.pde

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int dy = 1;
2828

2929
void setup() {
3030

31-
size(640, 360);
31+
size(640, 360, P2D);
3232

3333
// Create buffered image for lens effect
3434
lensEffect = createGraphics(width, height, P2D);
@@ -78,14 +78,13 @@ void draw() {
7878
xx += dx;
7979
yy += dy;
8080

81-
lensImage = createGraphics(lensD, lensD, P2D);
82-
8381
// save the backgrounlensD of lensHeight*lensWilensDth pixels rectangle at the coorlensDinates
8482
// where the lens effect will be applielensD.
8583
lensImage2.copy(lensEffect, xx, yy, lensD, lensD, 0, 0, lensD, lensD);
8684

8785
// output into a bufferelensD image for reuse
8886
lensImage.loadPixels();
87+
lensImage2.loadPixels();
8988

9089
// For each pixel in the destination rectangle, apply the color
9190
// from the appropriate pixel in the saved background. The lensArray

examples/Topics/Effects/Metaball/Metaball.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PGraphics pg;
2020
int[][] vy,vx;
2121

2222
void setup() {
23-
size(640, 360);
23+
size(640, 360, P2D);
2424
pg = createGraphics(160, 90, P2D);
2525
vy = new int[numBlobs][pg.height];
2626
vx = new int[numBlobs][pg.width];

examples/Topics/Effects/Plasma/Plasma.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int pixelSize=2;
1111
PGraphics pg;
1212

1313
void setup(){
14-
size(640, 360);
14+
size(640, 360, P2D);
1515
// Create buffered image for plasma effect
1616
pg = createGraphics(160, 90, P2D);
1717
colorMode(HSB);

examples/Topics/Effects/Tunnel/Tunnel.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int[][] shadeTable;
2424
int w, h;
2525

2626
void setup() {
27-
size(640, 360);
27+
size(640, 360, P2D);
2828

2929
// Load texture 512 x 512
3030
textureImg = loadImage("red_smoke.jpg");

examples/Topics/Effects/UnlimitedSprites/UnlimitedSprites.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void setup() {
2727

2828
// Create blank surfaces to draw on
2929
for (int i = 0; i < spriteFrames.length; i++) {
30-
spriteFrames[i] = createGraphics(width, height, JAVA2D);
30+
spriteFrames[i] = createGraphics(width, height);
3131
}
3232
}
3333

examples/Topics/Image Processing/Blur/Blur.pde

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ img.loadPixels();
1818

1919
// Create an opaque image of the same size as the original
2020
PImage edgeImg = createImage(img.width, img.height, RGB);
21+
edgeImg.loadPixels();
2122

2223
// Loop through every pixel in the image.
2324
for (int y = 1; y < img.height-1; y++) { // Skip top and bottom edges

examples/Topics/Image Processing/Convolution/Convolution.pde

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void setup() {
2020
size(200, 200);
2121
frameRate(30);
2222
img = loadImage("end.jpg");
23+
img.loadPixels();
2324
}
2425

2526
void draw() {

0 commit comments

Comments
 (0)