I'm writing an application that needs to draw an arbitrary size image (width and height are random at the input) within another randomly generated rectangle(dimensions given as input) so that the inside image is scaled proportionally and not distorted(but fits within).
- dimensions of parent rectangle
- dimensions of child rectangle
-Child rectangle should always be as big as possible within parent(needs scaled preserving proportions)
-Parent can be horizontal or vertical.
-Child can be horizontal or vertical.
-Parent/child should not be rotated (top stays on top)
What is needed:
-dimensions of resulted child rectangle