Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
flixc3
flixc3's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Noob needs brightness help
[3 Replies]
06-Aug-2012 12:37 PM
Forum:
Programming Questions
Literally minutes new to processing and I have an error that i dont understand or know how to resolve, can someone help?
code:
PImage img;
void setup() {
size(200, 200);
frameRate(30);
img = loadImage("pip_boy_3000_wp.jpg");
img.loadPixels();
loadPixels();
}
void draw() { background(0);
image(img,0,0);
for (int x = 0; x < img.width; x++) {
for (int y = 0; y < img.height; y++ ) {
int loc = x + y*img.width;
float r,g,b;
r = red (img.pixels[loc]);
float maxdist = 50;
float d = dist(x,y,mouseX,mouseY);
float adjustbrightness = 255*(maxdist-d)/maxdist;
r += adjustbrightness;
r = constrain(r,0,255);
color c = color(r);
pixels[y*width + x] = c;
}
}
updatePixels();
}
error:
Aug 6 20:30:06 guy.local java[463] <Error>: CGContextGetCTM: invalid context 0x0
Aug 6 20:30:06 guy.local java[463] <Error>: CGContextSetBaseCTM: invalid context 0x0
Aug 6 20:30:06 guy.local java[463] <Error>: CGContextGetCTM: invalid context 0x0
Aug 6 20:30:06 guy.local java[463] <Error>: CGContextSetBaseCTM: invalid context 0x0
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 40000
at Img_bright.draw(Img_bright.java:42)
at processing.core.PApplet.handleDraw(PApplet.java:1631)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)
«Prev
Next »
Moderate user : flixc3
Forum