Exemple #1
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 );
}
Exemple #2
0
_WCRTLINK grcolor _WCI86FAR _CGRAPH _setcolor( grcolor pixval )
/*==========================================

   This routine sets the colour for line drawing and object filling. */

{
    if( _GraphMode() ) {
        return( _L2setcolor( pixval ) );
    } else {
        return( -1 );
    }
}
Exemple #3
0
_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 );
}
Exemple #4
0
_WCRTLINK short _WCI86FAR _CGRAPH _setwindow( short invert, double left, double top,
/*==========================*/ double right, double bottom )

/* This function maps the current viewport to the window given by
   the corners ( left, top ) and ( right, bottom ). If the "invert" flag
   is set, the limits "top" and "bottom" are inverted.  */

{
    float               l, r;
    float               t, b;
    float               tmp;

    if( !_GraphMode() ) {
        return( 0 );
    }
    l = left;       // convert to float's
    r = right;
    t = top;
    b = bottom;
    if( l == r || t == b ) {
        _ErrorStatus = _GRINVALIDPARAMETER;
        return( 0 );
    }
    if( t < b ) {        // ensure bottom < top
        tmp = t;
        t = b;
        b = tmp;
    }
    _Window.xleft = l;
    _Window.xright = r;
    _Window.invert = invert;
    if( invert ) {
        _Window.ytop = t;
        _Window.ybottom = b;
    } else {
        _Window.ytop = b;
        _Window.ybottom = t;
    }
    _resetscalefactor();
    _moveto_w( l, _Window.ybottom );
    return( 1 );
}