User Tools

Site Tools


Programming Reference/Librarys

Question & Answer

Q&A is closed



Syntax of setwritemode

#include <graphics.h>
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 <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
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:");
exit(1);   /* terminate with an error code */
   xmax = getmaxx();
   ymax = getmaxy();
   /* select XOR drawing mode */
   /* draw a line */
   line(0, 0, xmax, ymax);
   /* erase the line by drawing over it */
   line(0, 0, xmax, ymax);
   /* select overwrite drawing mode */
   /* draw a line */
   line(0, 0, xmax, ymax);
   /* clean up */
   return 0;

See also

output of setwritemode example

  no output of example at the moment
  do not hesitate and add it...  
c/graphics.h/setwritemode.txt · Last modified: 2015/05/06 23:06 (external edit)

Impressum Datenschutz