'_setvideomoderows func'에 해당되는 글 1건

  1. 2021.11.04 Watcom C Library : _setvideomode, _setvideomoderows, _setvieworg, _setviewport, _setvisualpage

 

 

Watcom C Library Reference : _setvideomode, _setvideomoderows, _setvieworg, _setviewport, _setvisualpage

 

 

 

 

_setvideomode

 

Synopsis : #include <graph.h> 

              short _FAR _setvideomode( short mode );

 


Description : The _setvideomode function sets the video mode according to the value of the mode argument. The value of mode can be one of the following: (Type M=Mono, C=Color, T=Text, G=Graphic )

 Mode  Type  Size  Colors  Adapter
 _MAXRESMODE  (graphics mode with highest resolution) 
 _MAXCOLORMODE  (graphics mode with most colors)
 _DEFAULTMODE  (restores screen to original mode) 
 _TEXTBW40  M, T  40 x 25  16  MDPA, HGC, VGA, SVGA
 _TEXTC40  C, T  40 x 25  16  CGA, EGA, MCGA, VGA, SVGA 
 _TEXTBW80  M, T  80 x 25  16  MDPA, HGC, VGA, SVGA 
 _TEXTC80  C, T  80 x 25  16  CGA, EGA, MCGA, VGA, SVGA 
 _MRES4COLOR  C, G  320 x 200  4  CGA, EGA, MCGA, VGA, SVGA
 _MRESNOCOLOR  C, G  320 x 200  4  CGA, EGA, MCGA, VGA, SVGA
 _HRESBW  C, G  640 x 200  2  CGA, EGA, MCGA, VGA, SVGA 
 _TEXTMONO  M, T  80 x 25  16  MDPA, HGC, VGA, SVGA 
 _HERCMONO  M, G  720 x 350  2  HGC
 _MRES16COLOR  C, G  320 x 200  16  EGA, VGA, SVGA
 _HRES16COLOR  C, G  640 x 200  16  EGA, VGA, SVGA
 _ERESNOCOLOR  M, G  640 x 350  4  EGA, VGA, SVGA
 _ERESCOLOR  C, G  640 x 350  4/16  EGA, VGA, SVGA
 _VRES2COLOR  C, G  640 X 480  2  MCGA, VGA, SVGA
 _VRES16COLOR  C, G  640 x 480  16  VGA, SVGA
 _MRES256COLOR  C, G  320 x 200   256  MCGA, VGA, SVGA
 _URES256COLOR  C, G  640 x 400  256  SVGA
 _VRES256COLOR  C, G  640 x 480  256  SVGA
 _SVRES16COLOR  C, G  800 x 600  16  SVGA
 _SVRES256COLOR  C, G  800 x 600  256  SVGA
 _XRES16COLOR  C, G  1024 x 768  16  SVGA
 _XRES256COLOR  C, G  1024 x 768  256 SVGA


In the preceding table, the Type column contains the following letters:

 Type  Meaning
 M  indicates monochrome; multiple colors are shades of grey
 C  indicates color
 G  indicates graphics mode; size is in pixels
 T  indicates text mode; size is in columns and rows of characters

 

The Adapter column contains the following codes:

 Adapter Code  Meaning
 MDPA  IBM Monochrome Display/Printer Adapter
 CGA  IBM Color Graphics Adapter
 EGA  IBM Enhanced Graphics Adapter
 VGA  IBM Video Graphics Array
 MCGA  IBM Multi-Color Graphics Array
 HGC  Hercules Graphics Adapter
 SVGA  SuperVGA adapters


The modes _MAXRESMODE and _MAXCOLORMODE will select from among the video modes supported by the current graphics adapter the one that has the highest resolution or the greatest number of colors. The video mode will be selected from the standard modes, not including the SuperVGA modes.


Selecting a new video mode resets the current output positions for graphics and text to be the top left corner of the screen. The background color is reset to black and the default color value is set to be one less than the number of colors in the selected mode.

 


Returns : The _setvideomode function returns the number of text rows when the new mode is successfully selected; otherwise, zero is returned.

 

 

See Also :  _getvideoconfig, _settextrows, _setvideomoderows

 


Example :

#include <conio.h> 

#include <graph.h> 

#include <stdio.h> 

#include <stdlib.h>


void main( )

{
    int     mode;

   char    buf[80];

    struct  videoconfig vc;

 

    _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 Grphics
Systems : DOS, QNX

 

 

 

 

 

 

 

_setvideomoderows

 

Synopsis : #include <graph.h> 

              short _FAR _setvideomoderows( short mode, short rows );

 


Description : The _setvideomoderows function selects a video mode and the number of rows of text displayed on the screen. The video mode is specified by the argument mode and is selected with the _setvideomode function. The number of rows is specified by the argument rows and is selected with the _settextrows function.


Computers equipped with EGAMCGA and VGA adapters can support different numbers of text rows. The number of rows that can be selected depends on the video mode and the type of monitor attached.

 

 

Returns : The _setvideomoderows function returns the number of screen rows when the mode and number of rows are set successfully; otherwise, zero is returned.

 

 

See Also : _getvideoconfig, _setvideomode, _settextrows

 


Example :

#include <conio.h> 

#include <graph.h> 

#include <stdio.h>


void main( )

{
    int     rows;

    char   buf[80];


    rows = _setvideomoderows( _TEXTC80, _MAXTEXTROWS );

    if( rows != 0 ) (
        sprintf( buf, "Number of rows is %d\n", rows );

        _outtext( buf );

        getch( );

        _setvideomode( _DEFAULTMODE );

    }

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

_setvieworg

 

Synopsis : #include <graph.h> 

              struct xycoord _FAR _setvieworg( short x, short y );

 


Description : The _setvieworg function sets the origin of the view coordinate system, (0, 0), to be located at the physical point (x, y). This causes subsequently drawn images to be translated by the amount (x, y).


Note: In previous versions of the software, the _setvieworg function was called _setlogorg.

 

 

Returns : The _setvieworg function returns, as an xycoord structure, the physical coordinates of the previous origin.

 

 

See Also : _getviewcoord, _getphyscoord, _setcliprgn, _setviewport

 


Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    _setvideomode( _VRES16COLOR );

    _setvieworg( 320, 240 );
    ellipse( _GBORDER, -200, -150, 200, 150 );

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

_setviewport

 

Synopsis : #include <graph.h> 

              void _FAR _setviewport( short x1, short y1, short x2, short y2 );

 


Description : The _setviewport function restricts the display of graphics output to the clipping region and then sets the origin of the view coordinate system to be the top left corner of the region. This region is a rectangle whose opposite corners are established by the physical points (x1, y1) and (x2, y2).


The _setviewport function does not affect text output using the _outtext and _outmem functions. To control the location of text output, see the _settextwindow function.

 

 

Returns : The _setviewport function does not return a value.

 

 

See Also : _setcliprgn, _setvieworg, _settextwindow, _setwindow

 


Example :

#include <conio.h> 

#include <graph.h>


#define XSIZE     380 

#define YSIZE     280


void main( )

{
    _setvideomode( _VRES16COLOR );

    _setviewport( 130, 100, 130 + XSIZE, 100 + YSIZE );

    _ellipse( _GBORDER, 0, 0, XSIZE, YSIZE );

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

_setvisualpage

 

Synopsis : #include <graph.h> 

              short _FAR _setvisualpage( short pagenum );

 


Description : The _setvisualpage function selects the page (in memory) from which graphics output is displayed. The page to be selected is given by the pagenum argument.


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 _setvisualpage function returns the number of the previous page when the visual page is set successfully; otherwise, a negative number is returned.

 

 

See Also : _getvisualpage, _setactivepage, _getactivepage, _getvideoconfig


Example :

#include <conio.h> 

#include <graph.h>


void 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 전화카드
,