Watcom C Library Reference : _gettextwindow, _getvideoconfig, _getviewcoord, _getviewcoord_w, _getviewcoord_wxy, _getvisualpage

 

 

 

 

_gettextwindow

 

Synopsis : #include <graph.h> 

              void _FAR _gettextwindow( short _FAR *row1, short _FAR *col1, 

                                            short _FAR *row2, short _FAR *col2 );

 

Description : The _gettextwindow function returns the location of the current text window. A text window is defined with the _settextwindow function. By default, the text window is the entire screen.


The current text window is a rectangular area of the screen. Text display is restricted to be within this window. The top left corner of the text window is placed in the arguments (row1, col1). The bottom right corner of the text window is placed in (row2, col2).

 

 

Returns : The _gettextwindow function returns the location of the current text window.

 

 

See Also : _settextwindow, _outtext, _outmem, _settextposition, _scrolltextwindow

 


Example :

#include <conio.h> 

#include <graph.h> 

#include <stdio.h>


main( )

{
    int     i;

    short   r1, c1, r2, c2;

    char   buf[80];


    _setvideomode( _TEXTC80 );

    _gettextwindow( &r1, &c1, &r2, &c2 );

    _settextwindow( 5, 20, 20, 40 );

   

    for ( i = 1; i <= 20; ++i ) {
        sprintf( buf, "Line %d\n", i );

        _outtext ( buf );

    }


    getch( );

    _settextwindow( r1, c1, r2, c2 );

    setvideomode( DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

_getvideoconfig

 

Synopsis : #include <graph.h> 

              struct videoconfig _FAR * _FAR _getvideoconfig( struct videoconfig _FAR *config );


Description : The _getvideoconfig function returns information about the current video mode and the hardware configuration. The information is returned in the videoconfig structure indicated by the argument config.

 

The structure contains the following fields (all are short fields):

 Fields  Meaning
 numxpirels  number of pixels in x-axis
 numypixels  number of pixels in y-axis
 numtextcols  number of text columns
 numtextrows  number of text rows
 numcolors  number of actual colors
 bitsperpixel  number of bits in a pixel value
 numvideopages  number of video pages
 mode  current video mode
 adapter  adapter type
 monitor   monitor type
 memory  number of kilobytes (1024 characters) of video memory

 

 

The adapter field will contain one of the following values:

 Values  Meaning
 _NODISPLAY  no display adapter attached
 _UNKNOWN  unknown adapter/monitor type
 _MDPA   Monochrome Display/Printer Adapter
 _CGA  Color Graphics Adapter
 _HERCULES  Hercules Monochrome Adapter
 _MCGA  Multi-Color Graphics Array
 _EGA  Enhanced Graphics Adapter
 _VGA  Video Graphics Array
 _SVGA  SuperVGA Adapter

 


The monitor field will contain one of the following values:

 Values  Meaning
 _MONO  regular monochrome
 _COLOR  regular color
 _ENHANCED  enhanced color
 _ANALOGMONO  analog monochrome
 _ANALOGCOLOR  analog color


The amount of memory reported by _getvideoconfig will not always be correct for SuperVGA adapters. Since it is not always possible to determine the amount of memory, _getvideoconfig will always report 256K, the minimum amount.

 


Returns : The _getvideoconfig function returns information about the current video mode and the hardware configuration.

 

 

See Also : _setvideomode, _setvideomoderows

 


Example :

#include <conio.h> 

#include <graph.h> 

#include <stdio.h> 

#include <stdlib.h>


main( )

{
    int     mode;

    struct  videoconfig vc;

    char   buf[80];


    _getvideoconfig ( &vc );

 

    /* select "best" video mode */

    switch( vc.adapter ) {

        case _VGA :

        case _SVGA :
            mode = _VRES16COLOR;
            break;

 

        case _MCGA :
            mode = _MRES256COLOR;
            break;

 

        case _EGA :

            if( vc.monitor == _MONO ) {
                mode = _ERESNOCOLOR;

            } else {
                mode = _ERESCOLOR;

            }
            break;

 

        case _CGA :
            mode = _MRES4COLOR;
            break;

 

        case _HERCULES :
            mode = _HERCMONO;
            break;

 

        default :
            puts ( "No graphics adapter" );

            exit( 1 );

    }


    if( setvideomode ( mode ) ) {
        _getvideoconfig( &vc );

        sprintf( buf, "%d x %d x %d\n", vc.numxpixels, vc.numypixels, vc.numcolors ); 

        _outtext( buf );

        getch( );

        setvideomode( DEFAULTMODE );

    }

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

_getviewcoord, _getviewcoord_w, _getviewcoord_wxy

 

Synopsis : #include <graph.h> 

              struct xycoord _FAR _getviewcoord( short x, short y );
              struct xycoord _FAR _getviewcoord_w( double x, double y );
              struct xycoord _FAR _getviewcoord_wxy (struct _wxycoord _FAR *p );

 


Description : The _getviewcoord functions translate a point from one coordinate system to viewport coordinates. The _getviewcoord function translates the point (x, y) from physical coordinates. The _getviewcoord_w and _getviewcoord_wxy functions translate the point from the window coordinate system.


Viewport coordinates are defined by the _setvieworg and _setviewport functions. Window coordinates are defined by the _setwindow function.


Note: In previous versions of the software, the _getviewcoord function was called _getlogcoord.

 

 

Returns : The _getviewcoord functions return the viewport coordinates, as an xycoord structure, of the given point.

 

 

See Also : _getphyscoord, -setvieworg, _setviewport, _setwindow

 


Example :

#include <conio.h> 

#include <graph.h> 

#include <stdlib.h>


main( )

{
    struct xycoord pos1, pos2;


    _setvideomode( _VRES16COLOR );

    _setvieworg( rand( ) % 640, rand( ) % 480 );

    pos1 = _getviewcoord( 0, 0 );

    pos2 = _getviewcoord( 639, 479 );

    _rectangle( _GBORDER, posl.xcoord, posl.ycoord, pos2.xcoord, pos2.ycoord ); 

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : _getviewcoord - DOS, QNX 

             _getviewcoord_w - DOS, QNX 

             _getviewcoord_wxy - DOS, QNX

 

 

 

 

 

_getvisualpage

 

Synopsis : #include <graph.h> 

              short _FAR _getvisualpage( void );

 


Description : The _getvisualpage function returns the number of the currently selected visual graphics page.


Only some combinations of video modes and hardware allow multiple pages of graphics to exist. When multiple pages are supported, the active page may differ from the visual page. The graphics information in the visual page determines what is displayed upon the screen. Animation may be accomplished by alternating the visual page. A graphics page can be constructed without affecting the screen by setting the active page to be different than the visual page.

 

The number of available video pages can be determined by using the _getvideoconfig function. The default video page is 0.

 

 

Returns : The _getvisualpage function returns the number of the currently selected visual graphics page.

 

 

See Also : _setvisualpage, _setactivepage, _getactivepage, _getvideoconfig

 


Example :

#include <conio.h> 

#include <graph.h>


main( )

{
    int     old_apage;

    int     old_vpage;


    _setvideomode( _HRES16COLOR );

    old_apage = _getactivepage( );

    old_vpage = _getvisualpage( );

 

    /* draw an ellipse on page 0 */

    _setactivepage( 0 );

    _setvisualpage( 0 );

    _ellipse ( _GFILLINTERIOR, 100, 50, 540, 150 );

 

    /* draw a rectangle on page 1 */

    _setactivepage( 1 );

    _rectangle( _GFILLINTERIOR, 100, 50, 540, 150 );

    getch( );

 

    /* display page 1 */

    _setvisualpage( 1 );

    getch( );

    _setactivepage( old_apage );

    _setvisualpage( old_vpage );

    _setvideomode ( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

 

728x90
반응형
Posted by 전화카드
,