Set pixels[] once and use it as a background
              in 
             Programming Questions 
              •  
              1 year ago    
            
 
           
             I have a program that draws a fractal using pixels[]. I want to be able to zoom in by clicking and dragging a rect over a section to make that the new boundaries (then redraw the fractal with the new boundaries). It takes a almost a second to calculate the fractal and draw it so I don't want to draw it every frame. Is there a way to set pixels once so I could call it like a background and be able to drag a rect on top of it?
            
             
            
            
             
              
             
           
 
            
           
             This would be the equivalent of what I want but with background:
            
            - int mx, my;
- void setup() {
- size(600, 600);
- noFill();
- stroke(255);
- }
- void draw() {
- background(128); // I want this to be a call to show what is in pixels[]
- if (mousePressed) rect(mx, my, mouseX-mx, mouseY-my);
- }
- void mousePressed() {
- mx = mouseX;
- my = mouseY;
- }
 
              
              2  
            
 
            
 
 
          