DrawMode Property

Purpose

Returns or sets a value that determines the appearance of output.

Syntax

[object.]DrawMode [= n]

object: Form or Printer object
n: iexp

Description

Use this property to produce visual effects with the graphic output commands (Line, Circle, etc). Each pixel in the draw pattern is compared to the corresponding pixel in the existing background and then applies bit-wise operations.

R2_BLACK points are always black.
R2_WHITE sets white points.
R2_NOP points are not changed.
R2_NOT point corresponds to the inverse of the screen color.
R2_COPYPEN color set with Color.
R2_NOTCOPYPEN inverse of color in Color
R2_MERGEPENNOT set point corresponds to the pen color "or-ed" with the inverse screen color.
R2_MASKPENNOT set points corresponds to pen color "and-ed" with inverse pen color.
R2_MERGENOTPEN set point corresponds to screen color "and-ed" with the inverse pen color.
R2_MERGEPEN point color corresponds to the pen color "or-ed" with the screen color.
R2_NOTMERGEPEN inverse R2-MERGEPEN color.
R2_MASKPEN point corresponds to colors in screen and pen (logical And).
R2_NOTMASKPEN point corresponds to inverse R2-MASKPEN color.

Using DrawMode without an object will affect the current active output object, usually Me (unless Output = Printer is used).

DrawMode is a get/put property and can be read as well.

Example

OpenW 1

Local a%

RGBColor RGB(125, 125, 125), RGB(150, 100, 150)

DefFill 8

// Graphmode set to 1 as Default

PBox 10, 10, 100, 200

PBox 15, 15, 105, 205

KeyGet a%       // Waiting for a key press

Cls

// OR operation

DrawMode = R2_MERGEPENNOT

PBox 10, 10, 100, 200

PBox 15, 15, 105, 205

KeyGet a%       // Waiting for a key press

Cls

// XOR operation

DrawMode = R2_XORPEN

PBox 10, 10, 100, 200

PBox 15, 15, 105, 205

KeyGet a%       // Waiting for a key press

Cls

// AND operation

DrawMode = R2_MASKPEN

PBox 10, 10, 100, 200

PBox 15, 15, 105, 205

KeyGet a%       // Waiting for a key press

CloseW 1

Draws two rectangules, one over the other, in four different draw modes.

Remarks

DrawMode is the VB compatible implementation of the GFA-BASIC GraphMode command. In addition, DrawMode is a property.

See Also

GraphMode

{Created by Sjouke Hamstra; Last updated: 13/09/2021 by James Gaite; Other Contributors: Jean-Marie Melanson}