Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

SETWRITEMODE

Graphics Function: Sets the current logical write mode, which is used when drawing lines with the LINETO, POLYGON, and RECTANGLE functions. This routine is only available for Windows.

Module

USE IFQWIN

result = SETWRITEMODE (wmode)

wmode

(Input) INTEGER(2). Write mode to be set. One of the following symbolic constants (defined in IFQWIN.F90):

  • $GPSET - Causes lines to be drawn in the current graphics color. (Default)

  • $GAND - Causes lines to be drawn in the color that is the logical AND of the current graphics color and the current background color.

  • $GOR - Causes lines to be drawn in the color that is the logical OR of the current graphics color and the current background color.

  • $GPRESET - Causes lines to be drawn in the color that is the logical NOT of the current graphics color.

  • $GXOR - Causes lines to be drawn in the color that is the logical exclusive OR (XOR) of the current graphics color and the current background color.

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

  • $GR2_BLACK

  • $GR2_NOTMERGEPEN

  • $GR2_MASKNOTPEN

  • $GR2_NOTCOPYPEN (same as $GPRESET)

  • $GR2_MASKPENNOT

  • $GR2_NOT

  • $GR2_XORPEN (same as $GXOR)

  • $GR2_NOTMASKPEN

  • $GR2_MASKPEN (same as $GAND)

  • $GR2_NOTXORPEN

  • $GR2_NOP

  • $GR2_MERGENOTPEN

  • $GR2_COPYPEN (same as $GPSET)

  • $GR2_MERGEPENNOT

  • $GR2_MERGEPEN (same as $GOR)

  • $GR2_WHITE

Results

The result type is 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 (Z'00FFFF') and the graphics color to purple (Z'FF00FF') with the following commands:

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

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

Example

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

 oldcolor = SETBKCOLORRGB(Z'00FFFF')
 CALL CLEARSCREEN ($GCLEARSCREEN)
 oldcolor = SETCOLORRGB(Z'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