Sets the fill mask.
#include <graph.h>
void __far _setfillmask( unsigned char __far *mask );
mask | Mask array |
The _setfillmask function sets the current fill mask, which determines the fill pattern. The mask is an 8-by-8 array of bits in which each bit represents a pixel. A 1 bit sets the corresponding pixel to the current color, while a 0 bit leaves the pixel unchanged. The pattern is repeated over the entire fill area.
If no fill mask is set (mask is NULL—the default), a solid (unpatterned) fill is performed using the current color.
None.
Standards:None
16-Bit:DOS
32-Bit:None
_ellipse functions, _floodfill, _getfillmask, _pie functions, _polygon functions, _rectangle functions
/* GFILLMSK.C: This program illustrates _getfillmask and _setfillmask. */
#include <conio.h>
#include <stdlib.h>
#include <graph.h>
void ellipsemask( short x1, short y1, short x2, short y2, char __far *newmask );
unsigned char mask1[8] = { 0x43, 0x23, 0x7c, 0xf7, 0x8a, 0x4d, 0x78, 0x39 };
unsigned char mask2[8] = { 0x18, 0xad, 0xc0, 0x79, 0xf6, 0xc4, 0xa8, 0x23 };
char oldmask[8];
void main( void )
{
int loop;
/* Find a valid graphics mode. */
if( !_setvideomode( _MAXRESMODE ) )
exit( 1 );
/* Set first fill mask and draw rectangle. */
_setfillmask( mask1 );
_rectangle( _GFILLINTERIOR, 20, 20, 100, 100 );
_getch();
/* Call routine that saves and restores mask. */
ellipsemask( 60, 60, 150, 150, mask2 );
_getch();
/* Back to original mask. */
_rectangle( _GFILLINTERIOR, 120, 120, 190, 190 );
_getch();
_setvideomode( _DEFAULTMODE );
exit( 0 );
}
/* Draw an ellipse with a specified fill mask. */
void ellipsemask( short x1, short y1, short x2, short y2, char __far *newmask )
{
unsigned char savemask[8];
_getfillmask( savemask ); /* Save mask */
_setfillmask( newmask ); /* Set new mask */
_ellipse( _GFILLINTERIOR, x1, y1, x2, y2 ); /* Use new mask */
_setfillmask( savemask ); /* Restore original */
}