how can i get mouse position in a image

Discussion forum for contributors and developers who are using the QCAD ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Active Member
Posts: 33
Joined: Thu Jan 14, 2016 4:17 am

how can i get mouse position in a image

Postby liguosheng » Sun Jul 30, 2017 9:39 am

when a image is loaded,like that:
image = new RImageEntity(doc, RImageData(strImageFile, RVector(0,0),RVector(1,0), RVector(0,1), 50, 50, 0));
double pWid = image->getPixelWidth() * xRes;
double pHei = image->getPixelHeight() * xRes;

when a mouse position is got, how can i get postion in the image?

xRes,yRes are pixel resolution

User avatar
Site Admin
Posts: 5318
Joined: Fri Mar 30, 2007 6:07 am

Re: how can i get mouse position in a image

Postby andrew » Tue Aug 08, 2017 11:34 am

You'd have to calculate it using the image position, angle and width / height. There is no function to translate coordinates to image coordinates and vice versa.

Return to “QCAD Developers and Contributors”

Who is online

Users browsing this forum: No registered users and 1 guest