  | 
    
 
  
    
    
      
        
          
         Author | 
        
         Topic: BImage alpha: white or black?  (Read 346 times) | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            Sjeiti 
 
        
      
             | 
            
            
            
              
                
                BImage alpha: white or black? 
                «  on: Jul 21st, 2004, 3:13pm » | 
                
                
 
                 | 
               
             
             
            
            hi... got something strange...   This draws a pixel and fades it by drawing an image over it with lots of alpha... only... although the image is white, the screen fades to black.       Code:BImage eImg;      void setup() {     size(200,200);     eImg = new BImage(width,height);     for (int i=0; i<eImg.pixels.length; i++) {       eImg.pixels[i] = color(255,255,255,10);     }     background(0);     strokeWeight(2);     stroke(255);   }      void loop() {     point( noise(millis()*.00011,millis()*.00012)*width, noise(millis()*.00013,millis()*.00014)*height);     image(eImg,0,0);   }     |  
  |         even weirder... logically this code should have the same effect.. but it doesn't...       Code:BImage eImg;      void setup() {     size(200,200);     eImg = new BImage(1,1);     eImg.pixels[0] = color(255,255,255,10);     background(0);     strokeWeight(2);     stroke(255);   }      void loop() {     point( noise(millis()*.00011,millis()*.00012)*width, noise(millis()*.00013,millis()*.00014)*height);     image(eImg,0,0,width,height);   }     |  
  |         ..is this a bug?... 
            
             | 
           
            
            
            
             http://www.sjeiti.com/
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            toxi_ Guest
            
   
      
             | 
            
            
            
              
                
                Re: BImage alpha: white or black? 
                « Reply #1 on: Jul 21st, 2004, 4:21pm » | 
                
                
 
  
                 | 
               
             
             
            
            hey sjeti, you're right, there seems to be some discrepancy in the image() code for images with alpha channel.      btw. you can also use the blend() function to achieve a fade by replacing the line "image(eImg,0,0)" with this one:       Code:| blend(eImg,0,0,width,height,0,0,width,height,BLEND);  |  
  |      in case you're wondering why it never actually fades to 100% white, the answer is in this thread, which is about a related effect. 
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            Sjeiti 
 
        
      
             | 
            
            
            
              
                
                Re: BImage alpha: white or black? 
                « Reply #2 on: Jul 21st, 2004, 8:13pm » | 
                
                
 
                 | 
               
             
             
            
            ah... ok.. thanks...   the thread clears things up a bit   (not that it was a real problem... just stumbled upon it when doing something completely different and needed a fast fade)...      ...Sjeiti 
            
             | 
           
            
            
            
             http://www.sjeiti.com/
             | 
           
         
         | 
       
     
     | 
   
 
 
 |