2 #include <Xw_Extension.h>
4 /* ifdef then trace on */
6 #define TRACE_GET_PIXEL_SCREENCOORD
10 STATUS Xw_get_screen_pixelcoord (adisplay,sx,sy,px,py):
11 XW_EXT_DISPLAY *adisplay
12 float sx,sy Screen Coordinates defined in DSU Space
13 int px,py Returns Screen Coordinates defined in Pixels
15 Get screen coordinate from Screen in DSU Space
17 returns ERROR if resulting Pixel Coordinate is outside the screen
18 or the if Extended Window address is not defined
19 returns SUCCESS if successful
24 XW_STATUS Xw_get_pixel_screencoord(void* adisplay,float sx,float sy,int* px,int* py)
26 XW_STATUS Xw_get_pixel_screencoord(adisplay,sx,sy,px,py)
30 #endif /*XW_PROTOTYPE*/
32 XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay;
36 if( !Xw_isdefine_display(pdisplay) ) {
37 /*ERROR*Bad EXT_DISPLAY Address*/
38 Xw_set_error(96,"Xw_get_pixel_screencoord",pdisplay) ;
42 displaywidth = WidthOfScreen(_DSCREEN) ;
43 displayheight = HeightOfScreen(_DSCREEN) ;
45 *px = (int)(sx*(float)displaywidth) ;
46 *py = (int)((1.-sy)*(float)displayheight) ;
48 if( *px < 0 || *px >= displaywidth || *py < 0 || *py >= displayheight )
51 #ifdef TRACE_GET_PIXEL_SCREENCOORD
52 if( Xw_get_trace() > 1 ) {
53 printf (" Xw_get_pixel_screencoord(%lx,%f,%f,%d,%d)\n",(long ) pdisplay,sx,sy,*px,*py) ;