title: Resize Image to fit in bounding box
body: <p>An easy problem, but for some reason I just can't figure this out today.</p>
  
  <p>I need to resize an image to the maximum possible size that will fit in a bounding box while maintaining the aspect ratio.</p>
  
  <p>Basicly I'm looking for the code to fill in this function:</p>
  
  <pre><code>void CalcNewDimensions(ref int w, ref int h, int MaxWidth, int MaxHeight);
  </code></pre>
  
  <p>Where w &amp; h are the original height and width (in) and the new height and width (out) and MaxWidth and MaxHeight define the bounding box that the image must fit in.</p>