_moveto Functions

Description

Move current graphics positions.

#include <graph.h>

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

struct _wxycoord __far _moveto_w( double wx, double wy );

x, y View-coordinate point  
wx, wy Window-coordinate point  

Remarks

The _moveto functions move the current position to the specified point. The _moveto function uses the view-coordinate point (x, y) as the current position. The _moveto_w function uses the window-coordinate point (wx, wy) as the current position. No drawing takes place.

The _moveto function operates only in graphics video modes (e.g., _MRES4COLOR). Because it is a graphics function, the color of text is set by the _setcolor function, not by the _settextposition function.

Return Value

The function returns the coordinates of the previous position. The _moveto function returns the coordinates in an _xycoord structure. The _xycoord structure, defined in GRAPH.H, contains the following elements:

Element Description

short xcoord x coordinate
short ycoord y coordinate

The _moveto_w function returns the coordinates in an _wxycoord structure, defined in GRAPH.H. The _wxycoord structure contains the following elements:

Element Description

double wx x window coordinate
double wy y window coordinate

Compatibility

Standards:None

16-Bit:DOS

32-Bit:None

See Also

_lineto functions, _outgtext

Example

/* MOVETO.C: This program draws line segments of different colors. */

#include <graph.h>

#include <stdlib.h>

#include <conio.h>

void main( void )

{

short x, y, xinc, yinc, color = 1;

struct _videoconfig v;

/* Find a valid graphics mode. */

if( !_setvideomode( _MAXCOLORMODE ) )

exit( 1 );

_getvideoconfig( &v );

xinc = v.numxpixels / 50;

yinc = v.numypixels / 50;

for( x = 0, y = v.numypixels - 1; x < v.numxpixels; x += xinc, y -= yinc )

{

_setcolor( color++ % 16 );

_moveto( x, 0 );

_lineto( 0, y );

}

_getch();

_setvideomode( _DEFAULTMODE );

exit( 0 );

}