We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Slowly revealing parts of an image with the mouse
Page Index Toggle Pages: 1
Slowly revealing parts of an image with the mouse (Read 274 times)
Slowly revealing parts of an image with the mouse
Jul 10th, 2009, 6:49am
 
Hi all,

I was wondering why the code below does not reveal the point where my mouse is on the screen?  Any ideas?

Code:


PImage img;
int columns, rows;
int i, j, x, y, c, z;
Hashtable hm = new Hashtable();


void setup() {

 // Get the pic info
 img = loadImage("400-high.jpg");

 // Stage size
 size(img.width, img.height, P3D);
 

}

void draw() {
 
  loadPixels();

    x = mouseX;
    y = mouseY;

    pixels[(y) * img.height + (x)] = img.pixels[(y) * img.height + (x)];
    updatePixels();

}
 

Re: Slowly revealing parts of an image with the mouse
Reply #1 - Jul 10th, 2009, 7:02am
 

img.width does it  Wink
Re: Slowly revealing parts of an image with the mouse
Reply #2 - Jul 10th, 2009, 7:04am
 
Solved, thanks VERY much Smiley))
Page Index Toggle Pages: 1