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
   Syntax
(Moderators: fry, REAS)
   UnLoad image
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: UnLoad image  (Read 806 times)
gaza


UnLoad image
« on: Jan 14th, 2003, 4:55pm »

How could I eventually Unload an image ... lets say with a mousePressed() or something like that..
 
is that possible?  
 
or do I have to draw something on top of it to cover it?
 
REAS


WWW
Re: UnLoad image
« Reply #1 on: Jan 14th, 2003, 7:05pm »

if you are not running with noBackground() you can just stop drawing the image to the screen. for example:
if(!mousePressed) {  
  image(a, 0, 0);  
}  
 
if you are not refreshing the screen, you will need to draw something over it.
 
gaza


Re: UnLoad image
« Reply #2 on: Jan 14th, 2003, 7:47pm »

Thanks reas.
 
I was trying to have the image "UnLoad" once I clicked the screen... si then I did it like this:
 
BImage a;
boolean firstTime=true;
 
void setup(){
size(150,150);
background(255);
}
 
void loop(){
  if(firstTime==true){
  a=loadImage("box.gif");
  image(a,0,0);
  }
  if(mousePressed) {  
  firstTime=false;
}
}
 
 
 
REAS


WWW
Re: UnLoad image
« Reply #3 on: Jan 15th, 2003, 5:19pm »

Here's a slighly nicer way to write that:
 
Code:

BImage a;  
boolean unload=false;  
 
void setup()
{  
  size(150,150);  
  background(255);  
  a=loadImage("box.gif");  
}  
 
void loop()
{  
  if(!unload){  
    image(a,0,0);  
  }  
  if(mousePressed) {    
    unload=true;  
  }  
}  
 
gaza


Re: UnLoad image
« Reply #4 on: Jan 15th, 2003, 5:39pm »

much nicer...    I see. : )   thanks
 
Pages: 1 

« Previous topic | Next topic »