Gets the current logical mode for line drawing.
#include <graph.h>
short __far _getwritemode( void );
The _getwritemode function returns the current logical write mode, which is used when drawing lines with the _lineto, _polygon, and _rectangle functions.
The default value is _GPSET, which causes lines to be drawn in the current graphics color. The other possible return values are _GXOR, _GAND, _GOR, and _GPRESET. See _putimage for more details on these manifest constants.
The _getwritemode function returns the current logical write mode, or –1 if not in graphics mode.
Standards:None
16-Bit:DOS
32-Bit:None
_grstatus, _lineto functions, _putimage functions, _rectangle functions, _setcolor, _setlinestyle, _setwritemode
/* GWRMODE.C: This program illustrates _getwritemode and _setwritemode. */
#include <conio.h>
#include <stdlib.h>
#include <graph.h>
short wmodes[5] = { _GPSET, _GPRESET, _GXOR, _GOR, _GAND };
char *wmstr[5] = { "PSET ", "PRESET", "XOR ", "OR ", "AND " };
void box( short x, short y, short size, short writemode, short fillmode );
void main( void )
{
short i, x, y;
/* Find a valid graphics mode. */
if( !_setvideomode( _MAXCOLORMODE ) )
exit( 1 );
x = y = 70;
box( x, y, 50, _GPSET, _GFILLINTERIOR );
_setcolor( 2 );
box( x, y, 40, _GPSET, _GFILLINTERIOR );
for( i = 0; i < 5; i++ )
{
_settextposition( 1, 1 );
_outtext( wmstr[i] );
box( x += 12, y += 12, 50, wmodes[i], _GBORDER );
_getch();
}
_setvideomode( _DEFAULTMODE );
exit( 0 );
}
void box( short x, short y, short size, short writemode, short fillmode )
{
short wm, side;
wm = _getwritemode(); /* Save write mode and set new. */
_setwritemode( writemode );
_rectangle( fillmode, x - size, y - size, x + size, y + size );
_setwritemode( wm ); /* Restore original write mode. */
}