I have an image (i) that's been scaled from its original size (rectLarge) to fit a smaller rectangle (rectSmall). Given a point p in rectSmall, how can I translate this to a point in rectLarge.
To make this concrete, suppose I have a 20x20 image that's been scaled to a 10x10 rect. The point (1, 1) in the smaller rect should be scaled up to a point in the larger rect (i.e. (2,2)).
I'm trying to achieve this with:
result.x = point.x * (destRect.size.width / srcRect.size.width );
result.y = point.y * (destRect.size.height / srcRect.size.height);
However, the points generated by this code are not correct - they do not map to the appropriate point in the original image. What am I doing wrong?