title: What units does canvas.drawImage() use when specifying position and dimensions?
body: <p>I have a canvas with a percentage width and height, and I am drawing an image in there.</p>
  
  <p>I would like to draw the image with 50% width, and 100% height of the canvas. How do I accomplish this?</p>
  
  <p>Here's some code:</p>
  
  <pre><code>#canvas {
       width: 100%;
       height: 33%;
  }
  
  var cv = document.getElementById('canvas');
  var cx = cv.getContext('2d');
  
  var bg = document.createElement('img');
  bg.src = bg_url;
  
  cx.drawImage(bg, ?, ?, ?, ?);
  // cx.drawImage(bg, 0, 0, 50%, 100%); essentially
  
  // now let's draw that second image at 50% of the canvas (tiling)
  
  cx.drawImage(bg, ?, ?, ?, ?);
  // cx.drawImage(bg, 50%, 0, 50%, 100%); essentially
  </code></pre>