Page 1 of 1

how can i get mouse position in a image

Posted: Sun Jul 30, 2017 9:39 am
by liguosheng
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));
image->setInsertionPoint(drawSect->ptDemInsert);
double pWid = image->getPixelWidth() * xRes;
double pHei = image->getPixelHeight() * xRes;
image->setWidth(pWid);
image->setHeight(pHei);
image->setAngle(0);

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

xRes,yRes are pixel resolution

Re: how can i get mouse position in a image

Posted: Tue Aug 08, 2017 11:34 am
by andrew
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.