home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name viatrect -- Change attributes on a rectangle
- *
- * Synopsis num_writ = viatrect(u_row,u_col,l_row,l_col,fore,back);
- *
- * int num_writ Number of character cells actually changed,
- * or 0 if screen is not in a text mode.
- * int u_row Top row to write (0 = top of screen)
- * int u_col Leftmost column to write (0 = left edge)
- * int l_row Bottom row to write
- * int l_col Rightmost column to write
- * int fore,back Foreground and background attributes
- *
- * Description This function fills a rectangular area on the current
- * display page with a given attribute without affecting
- * the characters already displayed there. The cursor is
- * not moved.
- *
- * This function works only for standard text modes (0, 1,
- * 2, 3, and 7).
- *
- * The upper left corner of the region is (u_row,u_col),
- * where (0,0) represents the upper left corner of the
- * entire screen. The lower right corner of the region is
- * (l_row,l_col), where (24,79) is the lower right corner
- * of an 80-by-25 screen.
- *
- * The returned value reports the number of "character
- * cells" written, where "character cells" means the number
- * of physical spaces on the screen.
- *
- * Returns num_writ Number of character cells changed,
- * or 0 if screen is in a graphics mode.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1986,1987,1989
- *
- **/
-
- #include <bscreens.h>
- #include <bvideo.h>
-
- int viatrect(u_row,u_col,l_row,l_col,fore,back)
- int u_row,u_col,l_row,l_col;
- int fore,back;
- {
- int device,mode,act_page,last_row,columns;
- int height,width;
- int command;
- char far *pscreen;
-
- device = scmode(&mode,&columns,&act_page);
- if (mode > 3 && mode != 7)
- return 0;
- last_row = scrows() - 1;
-
- utbound(u_row,0,last_row) /* Force reasonable values */
- utbound(l_row,u_row,last_row)
- utbound(u_col,0,columns - 1)
- utbound(l_col,u_col,columns - 1)
- height = l_row - u_row + 1;
- width = l_col - u_col + 1;
-
- pscreen = viptr(u_row,u_col);
-
- command = 4;
- if ( b_vifast != 0
- || mode == 7
- || scequip() == IBM_CV
- || device == b_ega
- || device == b_vga
- || device == b_mcga)
- command |= 0x8000; /* Need not await retrace */
-
- vidirect(&pscreen,&pscreen,height,width,columns * 2,
- utnybbyt(back,fore),command);
- return height * width;
- }