I'm using Delphi RAD Studio 11.3 with Firemonkey. When I place a TImage component on a form and load a picture into it, the bitmap is automatically resized to fit the TImage component. That's perfectly fine. What I'm trying to find out is how to obtain the width and height of the currently displayed image. I don't want the width and height of the TImage component itself (e.g., Image1.Width or Image1.Height), nor do I need the dimensions of the original image (e.g., Image1.Bitmap.Width or Image1.Bitmap.Height).
What I'm looking for is the width and height of the image as it's currently displayed on the TImage component. Having this information will allow me to calculate the X and Y coordinates based on a MouseMove event on the displayed image, and from there, I can derive the corresponding points on the underlying bitmap.
Any suggestions?
You need to calculate the extents of the visual area based on several properties. In addition to
Position
andRotation
(if applicable) of theTImage
component, consider at least the following:TImage
(might get stretched/shrunken to fit)WrapMode
setting (default isFit
, which stretches/shrinks proprtionally)Size
(orWidth
andHeight
seprately) of theTImage
Scale
(horizontally and vertcally separately) of theTImage