SETFILLMASK (W*32, W*64)

Graphics Subroutine: Sets the current fill mask to a new pattern.

Module

USE IFQWIN

Syntax

CALL SETFILLMASK (mask)

mask

(Input) INTEGER(1). One-dimensional array of length 8.

There are 8 bytes in mask, and each of the 8 bits in each byte represents a pixel, creating an 8x8 pattern. The first element (byte) of mask becomes the top 8 bits of the pattern, and the eighth element (byte) of mask becomes the bottom 8 bits.

During a fill operation, pixels with a bit value of 1 are set to the current graphics color, while pixels with a bit value of zero are set to the current background color. The current graphics color is set with SETCOLORRGB or SETCOLOR. The 8-byte mask is replicated over the entire fill area. If no fill mask is set (with SETFILLMASK), or if the mask is all ones, solid current color is used in fill operations.

The fill mask controls the fill pattern for graphics routines (FLOODFILLRGB, PIE, ELLIPSE, POLYGON, and RECTANGLE).

To change the current fill mask, determine the array of bytes that corresponds to the desired bit pattern and set the pattern with SETFILLMASK, as in the following example.

Changing the current fill mask

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

Example

This program draws six rectangles, each with a different fill mask, as shown below.

! Build as QuickWin or Standard Graphics Ap.

USE IFQWIN

INTEGER(1), TARGET :: style1(8) &

/Z'18',Z'18',Z'18',Z'18',Z'18',Z'18',Z'18',Z'18'/

INTEGER(1), TARGET :: style2(8) &

/Z'08',Z'08',Z'08',Z'08',Z'08',Z'08',Z'08',Z'08'/

INTEGER(1), TARGET :: style3(8) &

/Z'18',Z'00',Z'18',Z'18',Z'18',Z'00',Z'18',Z'18'/

INTEGER(1), TARGET :: style4(8) &

/Z'00',Z'08',Z'00',Z'08',Z'08',Z'08',Z'08',Z'08'/

INTEGER(1), TARGET :: style5(8) &

/Z'18',Z'18',Z'00',Z'18',Z'18',Z'00',Z'18',Z'18'/

INTEGER(1), TARGET :: style6(8) &

/Z'08',Z'00',Z'08',Z'00',Z'08',Z'00',Z'08',Z'00'/

INTEGER(1) oldstyle(8) ! Placeholder for old style

INTEGER loop

INTEGER(1), POINTER :: ptr(:)

CALL GETFILLMASK( oldstyle )

! Make 6 rectangles, each with a different fill

DO loop = 1, 6

SELECT CASE (loop)

CASE (1)

ptr => style1

CASE (2)

ptr => style2

CASE (3)

ptr => style3

CASE (4)

ptr => style4

CASE (5)

ptr => style5

CASE (6)

ptr => style6

END SELECT

CALL SETFILLMASK( ptr)

status = RECTANGLE($GFILLINTERIOR,INT2(loop*40+5), &

INT2(90),INT2((loop+1)*40), INT2(110))

END DO

CALL SETFILLMASK( oldstyle ) ! Restore old style

READ (*,*) ! Wait for ENTER to be

! pressed

END

The following shows the output of this program.

Program output

See Also