Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all
i have an image of the desktop,the image size is smaller than the desktop size
how can i find a point on the desktop corresponding to the a point in the image
Posted
Comments
Sergey Alexandrovich Kryukov 24-Oct-11 14:01pm    
How corresponding? 1) coordinate transform from bitmap to screen coordinates, 2) image is a reduced image of the desktop and you need to find a point on desktop mapped to a point on the image?
--SA
Sergey Alexandrovich Kryukov 24-Oct-11 14:10pm    
What, no platform, language, UI library specified? Does not matter much though...
--SA

Please see my comment to the question. In both cases, this is not a problem for gradate students. It means the solution of linear equations which is a work for middle school or early high school student (it depends on your school system, but it requires level well below the required entry level of a college, university or a technical school student). It's reduced to the ability to solve equations like

<br />
X<sub>1</sub> = X<sub>0</sub> + K × X<sub>2</sub><br />
Y<sub>1</sub> = Y<sub>0</sub> + K × Y<sub>2</sub><br />


Wake up and solve them.

—SA
 
Share this answer
 
Assuming you have a point on the image relative to the top left hand corner of the image in terms of image coordinates, then it is a simple matter of scaling:

Xdesktop = Ximage * (Widthdesktop / Widthimage)

Ydesktop = Yimage * (Heightdesktop / Heightimage)

Obviously, you won't necessarily get to exactly that point - there will be an error of a pixel or two depending on the relative sizes.
 
Share this answer
 
Let the coordinates of point on image be x,y. Then your corresponding point on desktop will be like this.

new point = new point(x* Desktopwidth/imagewidth,y*Desktopheight/imageheight)

This is in theory, but i hope you get my point. If you don't then reply.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900