_WCRTLINK void _WCI86FAR _CGRAPH _getimage_w( double x1, double y1, double x2, double y2, /*==========================*/ char _WCI86HUGE *image ) /* This routine places the rectangle defined by ( x1, y1 ) and ( x2, y2 ), in window coordinates, into a buffer pointed to by image. */ { if( _GrProlog() ) { _L2getimage( _WtoPhysX( x1 ), _WtoPhysY( y1 ), _WtoPhysX( x2 ), _WtoPhysY( y2 ), image ); _GrEpilog(); } }
_WCRTLINK short _WCI86FAR _CGRAPH _pie_w( short fill, double x1, double y1, /*==================================*/ double x2, double y2, double x3, double y3, double x4, double y4 ) /* This really yecchy function draws or fills a slice of a pie defined as per the documentation, using window coordinates. */ { short success; if( _GrProlog() ) { success = _L2pie( fill, _WtoPhysX( x1 ), _WtoPhysY( y1 ), _WtoPhysX( x2 ), _WtoPhysY( y2 ), _WtoPhysX( x3 ), _WtoPhysY( y3 ), _WtoPhysX( x4 ), _WtoPhysY( y4 ) ); _GrEpilog(); } else { success = 0; } return( success ); }
_WCRTLINK void _WCI86FAR _CGRAPH _putimage_w( double x, double y, char _WCI86HUGE *image, /*==========================*/ short dispmode ) /* This routine retrieves an picture stored at image and places it on the screen starting at ( x, y ), in window coordinates. The mode in which the picture is placed on the screen is specified by dispmode. */ { if( _GrProlog() ) { _L2putimage( _WtoPhysX( x ), _WtoPhysY( y ), image, dispmode ); _GrEpilog(); } }
_WCRTLINK struct xycoord _WCI86FAR _CGRAPH _getviewcoord_w( double x, double y ) /*=============================================================== Map (x,y) from window coordinates to viewport coordinates. */ { struct xycoord pt; if( _GraphMode() ) { pt.xcoord = _GetLogX( _WtoPhysX( x ) ); pt.ycoord = _GetLogY( _WtoPhysY( y ) ); } else { pt.xcoord = 0; pt.ycoord = 0; } return( pt ); }
_WCRTLINK short _WCI86FAR _CGRAPH _polygon_wxy( short fill, short numpts, /*============================*/ struct _wxycoord _WCI86FAR *points ) /* This routine draws or fills a polygon specified by the array points[], in window coordinates. */ { short i; short needed_bytes; short x1, y1, x2, y2; short success; struct xycoord _WCI86FAR * stack; if( numpts <= 2 ) { _ErrorStatus = _GRINVALIDPARAMETER; return( 0 ); } success = 0; /* assume not successful */ if( _GrProlog() ) { if( fill == _GFILLINTERIOR ) { needed_bytes = _RoundUp( numpts * sizeof( struct xycoord ) ); #if defined( _DEFAULT_WINDOWS ) stack = _MyAlloc( needed_bytes ); #else if( _stackavail() - needed_bytes > 0x100 ) { stack = __alloca( needed_bytes ); #endif for( i = 0; i < numpts; i++ ) { stack[i].xcoord = _WtoPhysX( points[i].wx ); stack[i].ycoord = _WtoPhysY( points[i].wy ); } success = _L1FillArea( numpts, stack ); #if defined( _DEFAULT_WINDOWS ) _MyFree( stack ); _GrEpilog(); #else } else { _ErrorStatus = _GRINSUFFICIENTMEMORY; } #endif } else { x1 = _WtoPhysX( points[numpts-1].wx ); y1 = _WtoPhysY( points[numpts-1].wy ); for( i = 0; i < numpts; i++ ) { x2 = _WtoPhysX( points[i].wx ); y2 = _WtoPhysY( points[i].wy ); if( y1 < y2 ) { _L1Line( x2, y2, x1, y1 ); } else { _L1Line( x1, y1, x2, y2 ); } x1 = x2; y1 = y2; } success = 1; } _GrEpilog(); } return( success ); }