Creates a viewport.
#include <graph.h>
void __far _setviewport( short x1, short y1, short x2, short y2);
x1, y1 | Upper-left corner of viewport | |
x2, y2 | Lower-right corner of viewport |
The _setviewport function redefines the graphics viewport. The _setviewport function defines a clipping region in exactly the same manner as _setcliprgn, and then sets the view-coordinate origin to the upper-left corner of the region. The physical points (x1, y1) and (x2, y2) are the diagonally opposed corners of the rectangular clipping region. Any window transformation done with the _setwindow function applies only to the viewport and not to the entire screen. The default viewport is the entire screen.
None. Use the _grstatus function to check for conditions of success or failure.
Standards:None
16-Bit:DOS
32-Bit:None
_grstatus, _setcliprgn, _setvieworg, _setwindow
/* SVIEWPRT.C: This program sets a viewport and then draws a rectangle
* around it and an ellipse in it.
*/
#include <conio.h>
#include <stdlib.h>
#include <graph.h>
void main( void )
{
/* Find a valid graphics mode. */
if( !_setvideomode( _MAXRESMODE ) )
exit( 1 );
_setviewport( 100, 100, 200, 200 );
_rectangle( _GBORDER, 0, 0, 100, 100 );
_ellipse( _GFILLINTERIOR, 10, 10, 90, 90 );
_getch();
_setvideomode( _DEFAULTMODE );
exit( 0 );
}