_WCRTLINK void _WCI86FAR _CGRAPH _clearscreen( short area ) /*========================================== This routine clears either the entire screen, the current viewport, or the text window depending on the parameter. */ { _InitState(); _CursorOff(); #if defined( _DEFAULT_WINDOWS ) _L2clearscreen( area ); #else if( _GrMode ) { _L2clearscreen( area ); } else { switch( area ) { case _GVIEWPORT: /* do nothing */ _ErrorStatus = _GRNOTINPROPERMODE; break; case _GWINDOW: /* clear current text window */ _TxtClear( _Tx_Row_Min, _Tx_Col_Min, _Tx_Row_Max, _Tx_Col_Max ); _settextposition( 1, 1 ); break; case _GCLEARSCREEN: /* clear entire screen */ default: /* in all other cases */ _TxtClear( 0, 0, _CurrState->vc.numtextrows - 1, _CurrState->vc.numtextcols - 1 ); _settextposition( 1, 1 ); } } #endif _GrEpilog(); }
_WCRTLINK short _WCI86FAR _CGRAPH _arc( short x1, short y1, short x2, short y2, /*====================*/ short x3, short y3, short x4, short y4 ) /* This function draws an elliptical arc. The virtual ellipse is defined by the rectangle whose opposite corners are ( x1, y1 ) and ( x2, y2 ). The intersections of the vectors from the center of the ellipse to the points ( x3, y3 ) and ( x4, y4 ) define the start and end points respectively where the arc is drawn in a counter clockwise direction. */ { short success; if( _GrProlog() ) { success = _L2arc( _VtoPhysX( x1 ), _VtoPhysY( y1 ), _VtoPhysX( x2 ), _VtoPhysY( y2 ), _VtoPhysX( x3 ), _VtoPhysY( y3 ), _VtoPhysX( x4 ), _VtoPhysY( y4 ) ); if( success ) { _moveto( _GetLogX( _ArcInfo.end.xcoord ), _GetLogY( _ArcInfo.end.ycoord ) ); } _GrEpilog(); } else { success = 0; } return( success ); }
_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 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 void _WCI86FAR _CGRAPH _getimage( short x1, short y1, short x2, short y2, /*========================*/ char _WCI86HUGE * image ) /* This routine places the rectangle defined by ( x1, y1 ) and ( x2, y2 ), in viewport coordinates, into a buffer pointed to by image. */ { if( _GrProlog() ) { _L2getimage( _VtoPhysX( x1 ), _VtoPhysY( y1 ), _VtoPhysX( x2 ), _VtoPhysY( y2 ), image ); _GrEpilog(); } }
_WCRTLINK short _WCI86FAR _CGRAPH _ellipse( short fill, short x1, short y1, short x2, short y2 ) /*=============================================================================== This function draws or fills an ellipse defined by the rectangle whose opposite corners are ( x1, y1 ) and ( x2, y2 ) in viewport coordinates. */ { short success; if( _GrProlog() ) { success = _L2ellipse( fill, _VtoPhysX( x1 ), _VtoPhysY( y1 ), _VtoPhysX( x2 ), _VtoPhysY( y2 ) ); _GrEpilog(); } else { success = 0; } return( success ); }
_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 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 ); }