SETWRITEMODE

Graphics Function: Sets the current logical write mode, which is used when drawing lines with the LINETO, POLYGON, and RECTANGLE functions.

Module: USE DFLIB

Syntax

result = SETWRITEMODE (wmode)

wmode
(Input) INTEGER(2). Write mode to be set. One of the following symbolic constants (defined in DFLIB.F90 in the \DF98\INCLUDE subdirectory):


In addition, one of the following binary raster operation constants can be used (described in the online documentation for the Win32 API SetROP2):

Results:

The result is of type INTEGER(2). The result is the previous write mode if successful; otherwise, -1.

The current graphics color is set with SETCOLORRGB (or SETCOLOR) and the current background color is set with SETBKCOLORRGB (or SETBKCOLOR). As an example, suppose you set the background color to yellow (#00FFFF) and the graphics color to purple (#FF00FF) with the following commands:

  oldcolor = SETBKCOLORRGB(#00FFFF)
  CALL CLEARSCREEN($GCLEARSCREEN)
  oldcolor = SETCOLORRGB(#FF00FF) 

If you then set the write mode with the $GAND option, lines are drawn in red (#0000FF); with the $GOR option, lines are drawn in white (#FFFFFF); with the $GXOR option, lines are drawn in turquoise (#FFFF00); and with the $GPRESET option, lines are drawn in green (#00FF00). Setting the write mode to $GPSET causes lines to be drawn in the graphics color.

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

See Also: GETWRITEMODE, GRSTATUS, LINETO, POLYGON, PUTIMAGE, RECTANGLE, SETCOLOR, SETLINESTYLE

Example

 ! Build as a Graphics ap.
 USE DFLIB
 INTEGER(2) result, oldmode
 INTEGER(4) oldcolor
 TYPE (xycoord) xy

 oldcolor = SETBKCOLORRGB(#00FFFF)
 CALL CLEARSCREEN ($GCLEARSCREEN)
 oldcolor = SETCOLORRGB(#FF00FF)
 CALL MOVETO(INT2(0), INT2(0), xy)
 result = LINETO(INT2(200), INT2(200)) ! purple

 oldmode = SETWRITEMODE( $GAND)
 CALL MOVETO(INT2(50), INT2(0), xy)
 result = LINETO(INT2(250), INT2(200)) ! red
 END