Lightweight Graphics

GDrawMode

Set the drawing mode

Syntax

Signature
int GDrawMode( int mode );

Arguments

mode selects GFX_MODE_SOLID or GFX_MODE_XOR. Pass NIL to read the current mode.

Return value

The drawing mode in use after the call.

Description

In solid mode, drawing replaces the destination color. In XOR mode, drawing combines the destination color with the drawing color using bitwise XOR. Drawing the same line twice restores its original pixels.

The gtglfw and gtxwc drivers support both modes. The gtwvt and gtsdl3 drivers always return GFX_MODE_SOLID.

Example

gdrawmode.c
#include "xdev-wtui.h"

int main( void )
{
   int previous = GDrawMode( NIL );
   int mode = GDrawMode( GFX_MODE_XOR );
   int white = GMakeColor( 255, 255, 255 );

   QOut( mode == GFX_MODE_XOR ? "XOR drawing" : "Solid drawing" );
   GLine( 40, 20, 140, 180, white );
   Inkey( 0, NIL );
   GDrawMode( previous );

   return 0;
}

See also