ice_cool 0 Newbie Poster

Hello,

I have to cycle an image colors (specifically RGB) and i would like to know if Im on the right track here. Im also using 2-dimensional arrays.

public void cycleColors() 
   { 
       
    Color red[][] = new Color[height][width];
    Color blue[][] = new Color[height][width];
    Color green[][] = new Color[height][width];  
   
    for (int row = 0; row < height; row++) 
    {
      for (int col = 0; col < width; col++) 
      {             
           red[row][col] = new Color(col, row, picture[row][col].getRed());
           blue[row][col] = new Color(col, row, picture[row][col].getBlue());
           green[row][col] = new Color(col, row, picture[row][col].getGreen());
              
           blue[row][col] = red[row][col];
           green[row][col] = blue[row][col];
           red[row][col] = green[row][col];
      }
    } 
    picture = red;
  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.