Esempio n. 1
0
_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 );
}
Esempio n. 2
0
_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();
    }
}
Esempio n. 3
0
_WCRTLINK struct _wxycoord _WCI86FAR _CGRAPH _getwindowcoord( short x, short y )
/*===============================================================

   Map (x,y) from viewport coordinates to window coordinates.   */

{
    float               y1;
    struct _wxycoord    pt;

    if( _GraphMode() ) {
        pt.wx = _Window.xleft + ( _Window.xright - _Window.xleft ) *
                ( _VtoPhysX( x ) - _CurrState->clip.xmin ) /
                ( _CurrState->clip.xmax - _CurrState->clip.xmin );
        y1 = (float) ( _VtoPhysY( y ) - _CurrState->clip.ymin ) /
                     ( _CurrState->clip.ymax - _CurrState->clip.ymin );
        if( _Window.invert ) {
            pt.wy = _Window.ytop - y1 * ( _Window.ytop - _Window.ybottom );
        } else {
            pt.wy = y1 * ( _Window.ybottom - _Window.ytop ) + _Window.ytop;
        }
    } else {
        pt.wx = 0;
        pt.wy = 0;
    }
    return( pt );
}
Esempio n. 4
0
_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 );
}