home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name viatrect -- Change attributes on a rectangle via BIOS
- *
- * 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). Use SCATRECT for other modes.
- *
- * 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.
- *
- * Use SCATRECT if BIOS compatibility is desired.
- *
- * Returns num_writ Number of character cells changed,
- * or 0 if screen is in a graphics mode.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bquery.h>
- #include <bscreen.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,last_row,columns,act_page;
- int height,width;
- int command;
- ADS scn_ads;
-
- 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;
-
- viads(u_row,u_col,&scn_ads);
-
- command = 4;
- if ( mode == 7
- || scequip() == IBM_CV
- || device == b_ega)
- command |= 0x8000; /* Need not await retrace */
-
- vidirect(&scn_ads,&scn_ads,height,width,columns * 2,
- utnybbyt(back,fore),command);
- return height * width;
- }