Re: Pad Corner coordinates in pixels?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 01 1998 - 09:10:53 MEST


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET