setwritemode
raw OCR
Sets the writing mode for line drawing in graphics mode.
Defined in header <graphics.h>
Syntax
#include <graphics.h>
void far setwritemode(int mode);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
The following constants are defined:
| COPY_PUT = 0 | MOV |
| XOR PUT = 1 Each constant corresponds to a binary operation between each byte in the | XOR |
| line and the corresponding bytes onscreen. COPY_PUT language MOV instruction, overwriting with the line whatever is on the | uses the assembly |
| screen. XORPUT screen. Two successive XOR commands will erase the line and restore the screen to its original appearance. | uses the XOR command to combine the line with the |
b^
setwritemode currently works only with line, linerel, lineto, rectangle, and drawpoly.
Return value
None.
See also
Example
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int mainO
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult ();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg (errorcode));
printf("Press any key to halt:");
getch();
exit(l); /* terminate with an error code */
xmax = getmaxx ();
ymax = getmaxy ();
/* select XOR drawing mode */
setwritemode (XOR_PUT);
/* draw a line */
line(0, 0, xmax, ymax) ;
getchO ;
/* erase the line by drawing over it */
line(0, 0, xmax, ymax) ;
getchO;
/* select overwrite drawing mode */
setwritemode (COPY_PUT);
/* draw a line */
line(0, 0, xmax, ymax) ;
/* clean up */
getchO ;
closegraphO ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/graphics.h/setwritemode/
· short form /3.1/setwritemode/