Gets the current fill mask for some graphics routines.
#include <graph.h>
unsigned char __far * __far _getfillmask( unsigned char __far *mask );
mask | Mask array |
Some graphics routines (_ellipse, _floodfill, _pie, _polygon, and _rectangle) can fill part or all of the screen with the current color. The fill mask controls the pattern used for filling.
The _getfillmask function returns the current fill mask. The mask is an 8-by-8-bit array, in which each bit represents a pixel. If the bit is 1, the corresponding pixel is set to the current color; if the bit is 0, the pixel is left unchanged. The mask is repeated over the entire fill area. If no fill mask is set, or if mask is NULL, a solid (unpatterned) fill is performed using the current color.
If no mask is set, the function returns NULL. Otherwise, it returns the current fill mask.
Standards:None
16-Bit:DOS
32-Bit:None
_ellipse functions, _floodfill, _pie functions, _polygon functions, _rectangle functions, _setfillmask
/* 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 */
}