title: Reflecting pixels on a line
body: <p>The aim is to 'move' (some of) the pixels in a square sub-area (square(x,y)), of an image.</p>
  
  <p>I do this by going through each horizontal line in that square and working out which will be moved. So moving them in an inverse way.</p>
  
  <p>Given I have a horizontal line of pixels in my square (x,y)</p>
  
  <p>A..............B.........C</p>
  
  <p>After applying a transformation, the pixels after B till C will turn black. The pixel at C 'moves' to A, and the pixels in between B and P are moved and scaled linearly from A to B.</p>
  
  <p>This means that A to B pixels are a stretched reflection of B to C. But the pixel at B stays the same.</p>
  
  <p>My problem is working out the positions of A and C, which would be the right hand side and left hand side of the square (x,y). </p>
  
  <p>So far, I have this:  size is half of length or width of square </p>
  
  <pre><code>// check if square(x,y) lies within image
  if ( (x&lt;image.getWidth()) &amp;&amp; (y&lt;image.getHeight()) ){   
     if (( y&lt;=0) &amp;&amp; (y &gt;= image.getHeight())){ //not sure whether these if's are right
        for (int i=0; i&lt;x-size; i++) {// visiting each pixel in square(x,y) at coordinate (i,j) 
           for(int j=0; j&lt; y-size; j++){ 
             // set values for A(left hand side), C(right hand side), B(x +n)
              int A= 
              int B= 
              int B= x+n;
  </code></pre>