Help needed with RGB algorithm
              in 
             Programming Questions 
              •  
              6 months ago    
            
 
           
             Here is the code
            
            
            
             
I want to crate a RGB box where each corner has the highest red,green and blue i.e. 255. I have the two top corner as red and green but the blue corner still has green in it. The fourth corner I want to be 255,255,255
             
Can anyone help ?
             
Here is an image of what I have so far.
              
             
             
This is what I want to achieve
              
             
             
           
 
            
           - int w = 255;
 int h =255;
 PImage ax, bx, cx, dx;
 int rr=255;
 int gg=0;
 int bb=0;
 void setup() {
 size(w, h);
 ax=createImage(w, h, ARGB);
 for (int y=0;y<h;y++) {
 for (int x=0;x<w;x++) {
 if (x==y) {
 bb=x;
 }
 rr--;
 gg++;
 ax.set(x, y, color(rr, gg, bb));
 }
 rr=255;
 gg=0;
 }
 image(ax, 0, 0);
 }
 void draw() {
 color c = ax.get(mouseX, mouseY);
 rr = c>>16&255;
 gg = c>>8&255;
 bb = c&255;
 this.frame.setTitle(str(rr)+ " "+str(gg)+ " "+ str(bb));
 }
I want to crate a RGB box where each corner has the highest red,green and blue i.e. 255. I have the two top corner as red and green but the blue corner still has green in it. The fourth corner I want to be 255,255,255
Can anyone help ?
Here is an image of what I have so far.
 
             This is what I want to achieve
 
              
              1  
            
 
            
 
 
          