0

ok so this is a hard one (in my head).

mframe, sframe1, sphoto1, sframe2, sphoto2 has its own scales and dimensions:

a width and a height is the dimensions that these objects have.

The plan:

Sframe2 gets dragged on to sframe1. When I let go of the mouse sphoto2's dimensions (which are scaled within the boundaries of sframe2) need to be dropped in the scaled location of sphoto1 (which resides scaled within sframe1).

to be able to drop sframe2 within sframe1 on the location I let go I need to be able to correlate the location it was dropped on to the scaled image as I want to merge sphoto2 with sphoto1.

sframe1 and sframe2 have coordinates on mframe. sphoto1 and sphoto2 only have private coordinates (such as I can merge the images to and x and y position on them.).

The problem is that because the photos inside are scaled differently to these frames I have figure out the scaling factors to be able to correctly merge sphoto2 with sphoto1 with photo2 at the correct size and position on sphoto1.

so the question is... How can I do that?

Below is a diagram to assist in visually representing the problem.

enter image description here

Here is also a video to show you what it should not do. The image inside the frame needs to scale and merge on the other image correctly.

http://www.youtube.com/watch?v=N17Rrs1dSz0&feature=youtu.be

My mind is fried. Can you figure out what needs to scale what?

jimbob
  • 3,288
  • 11
  • 45
  • 70
  • i dont really know what you plan to do but maybe this will be helpful http://stackoverflow.com/questions/16729169/how-to-maintain-multi-layers-of-imageviews-and-keep-their-aspect-ratio-based-on – pskink Jun 28 '13 at 07:08

1 Answers1

0

You can set layout params for that image and multiply with screen ratio, example:

imageview.setLayoutParams(new LinearLayout.LayoutParams(
                    (int) (250 * config.ratio), (int) (280 * config.ratio)));

But if you use this solution, you must calculate sceen ratio before scaling your image

Quoc Truong
  • 545
  • 4
  • 9