title: Java mirror image diagonal method not working
body: <p>I'm having trouble getting my method to work. The method should mirror any image I choose on its diagonal to produce a mirror effect, but at the moment it just produces the same image unedited and I don't what I'm doing wrong. Any help would be greatly appreciated. Thank you.</p>
  
  <pre><code>public Picture mirrorImageDiagonal() {
    int size = this.getWidth();
    Pixel rightPixel = null;
    Pixel leftTargetPixel = null;
    Pixel rightTargetPixel = null;
    Picture target = new Picture(size, size);
    for (double x = 0; x &lt; size; x ++) {
        for (double y = 0; y &lt;= x; y ++) {
            int yIndex = Math.min((int) y, this.getHeight() - 1);
            int xIndex = Math.min((int) x, this.getWidth() - 1);
            leftTargetPixel = target.getPixel(yIndex, xIndex);
            rightTargetPixel = target.getPixel(xIndex, yIndex);
            rightPixel = this.getPixel(xIndex, yIndex);
            rightTargetPixel.setColor(rightPixel.getColor());
            leftTargetPixel.setColor(rightPixel.getColor());
            }
      }
    return target;
    }
  </code></pre>