_setvieworg

Description

Moves the view-coordinate origin to the specified physical point.

#include <graph.h>

struct _xycoord __far _setvieworg( short x, short y );

x, y New origin point  

Remarks

The _setvieworg function moves the view-coordinate origin (0, 0) to the physical point (x, y).

The _xycoord structure, defined in GRAPH.H, contains the following elements:

Element Description

short xcoord x coordinate
short ycoord y coordinate

The _setvieworg function replaces the _setlogorg function of Microsoft C version 5.1.

Return Value

The function returns the physical coordinates of the previous view origin in an _xycoord structure, defined in GRAPH.H.

Compatibility

Standards:None

16-Bit:DOS

32-Bit:None

See Also

_getphyscoord, _getviewcoord, _getwindowcoord, _setcliprgn, _setviewport

Example

/* SVORG.C: This program sets the view origin to the center of

* the screen, then draws a rectangle using the new origin.

*/

#include <stdlib.h>

#include <conio.h>

#include <graph.h>

void main( void )

{

struct _videoconfig config;

/* Find a valid graphics mode. */

if( !_setvideomode( _MAXRESMODE ) )

exit( 1 );

_getvideoconfig( &config );

/* Set view origin to the center of the screen. */

_setvieworg( config.numxpixels / 2, config.numypixels / 2 );

_rectangle( _GBORDER, -80, -50, 80, 50 );

_getch();

_setvideomode( _DEFAULTMODE );

exit( 0 );

}