Re: Pad Corner coordinates in pixels?

Rene Brun (Rene.Brun@cern.ch)
Thu, 01 Oct 1998 09:10:53 +0200


Paul Nord wrote:
>
> When the ExecuteEvent function is called it gets coordinates in pixels relative
> to the canvas. How can I find the coordinates for the corners of a TPad in
> those same units?
>
> Sorry if this is a silly question, but I'm not able to find the answer quickly
> through my own investigation.
>
> Paul Nord

Paul,
The class TPad has several functions to perform conversions from/to
pixel coordinates and pad coordinates.
See PixeltoX, PixeltoY, XtoPixel,etc.
For example, to convert the right bottom corner of the current pad:
Int_t px = gPad->XtoAbsPixel(gPad->GetX2());
Int_t py = gPad->YtoAbsPixel(gPad->GetY1());

There are many examples of these transformations in the
Root ExecuteEvent or DistancetoPrimitive functions.

See also, the Root HOWTOs;
http://root.cern.ch/root/HowtoDraw.html
http://root.cern.ch/root/HowtoPick.html

Rene Brun