  | 
    
 
  
    
    
      
        
          
         Author | 
        
         Topic: copy() vs background()  (Read 316 times) | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            sanguinarium 
 
        
      
             | 
            
            
            
              
                
                copy() vs background() 
                «  on: Jul 26th, 2004, 4:48pm » | 
                
                
 
                 | 
               
             
             
            
            probably not a bug, but seen from the outside, it's hard to understand why copy() and background() are not compatible.      why can't a copy() be assigned as background as in:      BImage bg = copy();      background(bg);      the following error is triggered:       "background images should be RGB or RGBA"      1. shouldn't they be compatible?   2. could they be compatible?      ---------------------------------- proper example:   [error is thrown on mouse press]      BImage bg;      void setup()   {     size(500, 500);     bg = loadImage("someimage.jpg");     background(bg);   }      void loop()   {     if(mousePressed && pmouseX != 0 && pmouseY != 0) {        line(mouseX, mouseY, pmouseX, pmouseY);        bg=copy();     }     background(bg);   }   
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            fry 
 
 
        
      
             | 
            
            
            
              
                
                Re: copy() vs background() 
                « Reply #1 on: Jul 27th, 2004, 12:27am » | 
                
                
 
                 | 
               
             
             
            
            hm, i'm guessing it's a bug, though the image functions have been reworked in megabucket, so it won't be a problem.      i think if you just modify your code to say "bg.kind = RGB" (or RGBA if it's rgba data) that oughta work for the background() call. i think the 'kind' field on BImage may not have been copied in copy(). whups.      background() will, however, require that the image is the same size as your applet. 
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            sanguinarium 
 
        
      
             | 
            
            
            
              
                
                Re: copy() vs background() 
                « Reply #2 on: Aug 2nd, 2004, 12:45pm » | 
                
                
 
                 | 
               
             
             
            
            ok. waiting for MB. no big deal. Just wanted to make sure it's noted.      sidekick: .kind on BImage throws a sematic error in both 68 and 69 for me:         bg=copy();      bg.kind = RGB;      background(bg);         Semantic Error: No field named "kind" was found in type "BImage"         -- this just so people won't run for this.   
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
 
 |