===== setwritemode =====
====Syntax of setwritemode ====
#include
void setwritemode(int mode);
==== Description of setwritemode ====
The following constants are defined:
COPY_PUT = 0/* MOV */
XOR_PUT = 1/* XOR */
Each constant corresponds to a binary operation between each byte in the
line and the corresponding bytes onscreen. COPY_PUT uses the assembly
language MOV instruction, overwriting with the line whatever is on the
screen. XOR_PUT uses the XOR command to combine the line with the screen.
Two successive XOR commands will erase the line and restore the screen to
its original appearance.
setwritemode currently works only with line, linerel, lineto, rectangle,
and drawpoly.
==== Example of setwritemode ====
/* setwritemode example */
#include
#include
#include
#include
int main()
{
/* 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(1); /* terminate with an error code */
}
xmax = getmaxx();
ymax = getmaxy();
/* select XOR drawing mode */
setwritemode(XOR_PUT);
/* draw a line */
line(0, 0, xmax, ymax);
getch();
/* erase the line by drawing over it */
line(0, 0, xmax, ymax);
getch();
/* select overwrite drawing mode */
setwritemode(COPY_PUT);
/* draw a line */
line(0, 0, xmax, ymax);
/* clean up */
getch();
closegraph();
return 0;
}
==== See also ====
[[lineto]]
[[putimage]]
===== output of setwritemode example =====
no output of example at the moment
do not hesitate and add it...