title: How to copy an area from a canvas into an image
body: <p>I am trying to copy an area around the mouse cursor from my <code>Canvas</code> into an <code>Image</code> using the <code>gc.copyarea</code> method. Afterwards I want to paint that image onto a composite which appears after the mouse has been pressed for 1 second.</p>
  
  <p>Below is my code so far:
  In the <code>paintControl</code> Method of my canvas I copy the area to an image:</p>
  
  <pre><code>    img = new Image(display, 40, 40);
      gc.copyArea(img, mousePosition.x-20, mousePosition.y-20);
  </code></pre>
  
  <p>In the <code>paintControl</code> Method of my Composite I paint that image:</p>
  
  <pre><code>    if (img != null) {
          gc.drawImage(img, 0, 0);
      }
  </code></pre>
  
  <p>The problem I am having is that only a very small part of the area is actually copied and painted onto the composite. Of the 40x40 pixel area, only an area of 10x20 pixel area in the bottom left corner is visible in the composite.</p>
  
  <p>Example:<img src="https://i.stack.imgur.com/ymOlj.png" alt=""></p>
  
  <p>The cursor is next to the top left corner of the compisite. Only a small part of the area around the cursor is painted onto the compisite</p>
  
  <p>Question: How can I copy an area from my canvas and paint it onto another composite correctly? What did I do wrong in my Code?</p>