FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   creating an image from the screen?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: creating an image from the screen?  (Read 756 times)
lunetta

7200475272004752 WWW Email
creating an image from the screen?
« on: Mar 8th, 2005, 11:56pm »

I'm deeply sorry for this post. I know that probably this subject as already been discussed, described everywhere and it should be darn damn simple. But my brain is refusing to work today, and so does my sketches...
 
How do I transform my screen into a BImage object?
 
st33d

WWW Email
Re: creating an image from the screen?
« Reply #1 on: Mar 9th, 2005, 1:52am »

http://processing.org/reference/BImage.html
 
Before an image is used, it must be loaded with the loadImage() function.
 
So I guess if you had a blank the same size as your drawing space in the data folder. You could do this:
Code:

BImage swap;
void setup(){
swap = loadImage("a.gif");
size(swap.width,swap.height);
swap.pixels = pixels;
}
void loop(){
ellipse(mouseX,mouseY,10,10);
image(swap,1,0);
}
void mousePressed(){
background(255);
}

But I can't seem to get the swap image to take a static snap shot. Referencing the screen pixels[] creates a permanent link. Suggestions?
 
Update - Whoops:
 
http://processing.org/reference/copy_.html
 
Even wierder - using copy to initialise the BImage means it won't scroll
Code:

BImage swap;
void setup(){
size(100,100);
swap = copy();
swap.pixels = pixels;
}
void loop(){
ellipse(mouseX,mouseY,10,10);
image(swap,1,0);
}
void mousePressed(){
background(255);
}  
« Last Edit: Mar 9th, 2005, 2:05am by st33d »  

I could murder a pint.
lunetta

7200475272004752 WWW Email
Re: creating an image from the screen?
« Reply #2 on: Mar 9th, 2005, 3:04am »

copy()... I knew I had seen it somewhere!
« Last Edit: Mar 9th, 2005, 3:05am by lunetta »  
Pages: 1 

« Previous topic | Next topic »