MinnuKaAnae
MinnuKaAnae

Reputation: 1646

XY coordinates on bitmap

I am developing one android application, in that I am getting one bitmap image from server and also getting x and y coordinates from server. Those X and Y coordinates is nothing but user location. Now my problem is if I run that app in mobile it is working fine. But in tabs I need to resize the bitmap size, if I resize that bitmap those x and y coordinates are also changing. This is not map related application. How can I resize bitmap without effect to x and y coordinates ? This is not map related application.

Upvotes: 1

Views: 2232

Answers (1)

MKJParekh
MKJParekh

Reputation: 34301

I think,You can simply calculate it

For Example,

OriginalWidth = 100;
OriginalHeight = 100;
OriginalX = 30;
OriginalY = 30;


NewWidth = 200;
NewHeight = 200;

Then,

NewX = (OriginalX * NewWidth)/OriginalWidth = 60;
NewY = (OriginalY * NewHeight)/OriginalHeight = 60;

Please do google on how to get width and height of image.

Upvotes: 1

Related Questions