![]() ![]()  | 
 | |||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()  | 
   public void vertical_stripes()
  {
    Pixel[] pixels = this.getPixels();
    Pixel pixel = null;
    int index = 0;
    
    for (int x=0; x<this.getWidth(); x+=5){
      for (int y=0; y<this.getHeight(); y++){
        for (int i=0; i<2; i++){
          if (i == 0){
            pixel = pixels[index];
            pixel.setColor(Color.red);
            index++;
            x=x+5;}
          if (i == 1){
            pixel = pixels[index];
            pixel.setColor(Color.green);
            index++;}        
        }
      }    
    }
  } 
  something isn't right about this. it only does one row of pixels. and the spacing is off too. could you give me an idea of what needs to happen? | 
public void vertical_stripes()
  {
    
    // get the array of pixels from the current picture
    Pixel[] pixels = this.getPixels();
    
    //  declare the variable that will refer to the current pixel
    Pixel pixel = null;
    
    
    for(int i = 0; i < pixels.length; i++){
    
    
    
      // get the current pixel
      pixel = pixels[i];
      
    
      pixel.setBlue(0);
      pixel.setRed(255);
      pixel.setGreen(0);
      
      i = i+3;
    }
    for(int j = 2; j < pixels.length; j++){
   
    
    
      // get the current pixel
      pixel = pixels[j];
      
      
      pixel.setBlue(0);
      pixel.setRed(0);
      pixel.setGreen(255);
      
      j = j+3;
    }
  } This one worked for me... but i'm worried that it just happened to work because the pic had just the right amount of pixels in its width, is that right? | 
public void addVert(){ 
Pixel[] pixels = this.getPixels();
Pixel pix = null;
int srcy=0; int srcx=0;
   while (int y < getHeight()){
     while (int x < getWidth()){
       pix= this.getPixel(srcx,srcy); pix.setColor(Color.red);srcx+3;
       pix= this.getPixel(srcx,srcy); pix.setColor(Color.green);srcx+3;
     }srcy++;}this.show;return this;}This one only does the first line.... please help | 
public void vertical_stripes()
{
for (int y = 0; y < getHeight(); y++){
   for (int x = 0; x < getWidth(); x+=10){
       this.getPixel(x,y).setColor(Color.red)}
   for (int x = 5; x <getWidth(); x+=10){
       this.getPixel(x,y).setColor(Color.green)}
}| | 
This worked for me with several pictures!public void vertical_stripes(){
  int stripe = 0;
  Pixel pixelA;
  Pixel pixelB;
  for (int y=0; y < this.getHeight(); y++){
    pixelA = this.getPixel(stripe, y);
    pixelA.setRed(255); pixelA.setBlue(0); pixelA.setGreen(0);
    pixelB = this.getPixel((stripe+2),y);
    pixelB.setRed(0); pixelB.setBlue(0); pixelB.setGreen(255);
    stripe = stripe + 4;
  }
}| |