title: Getting the pixel under the mouse in TImage with Stretch. Proportional and Center all set to true
body: <p>I have got a form with a TImage on it. That TImage is set to Align=alClient, Stretch=True, Proportional=True and Center=True.</p>
  <p>At runtime I load a bitmap into that TImage. It gets displayed a bit smaller than the original size but without distortion, as I expect it.</p>
  <p>Now I want to get the coordinates of the pixel under the mouse when I press the Mouse button. This is the code assigned to im_Input.OnMouseDown:</p>
  <pre><code>procedure Tf_ColorAdjustment.im_InputMouseUp(Sender: TObject; Button: TMouseButton;
    Shift: TShiftState; X, Y: Integer);
  begin
    im_Input.Picture.Bitmap.Canvas.Pixels[X - 1, Y - 1] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X - 1, Y] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X - 1, Y + 1] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X, Y - 1] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X, Y] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X, Y + 1] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X + 1, Y - 1] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X + 1, Y] := clYellow;
    im_Input.Picture.Bitmap.Canvas.Pixels[X + 1, Y + 1] := clYellow;
  end;
  </code></pre>
  <p>(This is just testing code to see where the mouse click ends up. I know that using the Pixels property is very slow but it was the easiest way to make the affected pixels visible.)</p>
  <p>This would work fine if all of these flags were set to false, but because the bitmap is shrunk to match the window, the pixels appear moved to the left and up.</p>
  <p>I know that I need to adjust the coordinates, but how do I do it? Is there RTL/VCL support for that? Something like a CalcStretched method of the TImage (I couldn't find it but maybe I just overlooked it). Or do I really have to program the calculation myself?</p>
  <p>(I can't believe that Google didn't find a ready made solution for this. This must have been a commonly encountered problem for decades.)</p>