home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * gr_windo.c - graphics window functions.
- *
- * Purpose: This file contains functions to operate in a portion of the
- * screen in graphics mode.
- *
- * Blackstar C Function Library
- * (c) Copyright 1985,1989 Sterling Castle Software
- *
- *******/
-
- #include "blackstr.h"
- #include "sc_head.h"
- #include "gr_head.h"
- #include "primitiv.h"
-
-
- /********
- *
- * gr_windo(minx,miny,maxx,maxy) - set a graphics window
- *
- **/
-
- void gr_windo(int minx, int miny, int maxx, int maxy)
- {
- gr_minx_ = minx;
- gr_miny_ = miny;
- gr_maxx_ = maxx;
- gr_maxy_ = maxy;
- }
-
-
- /********
- *
- * gr_wfull() - set to graphic windo full screen
- *
- **/
-
- void gr_wfull(void)
- {
- gr_windo(0,0,grcols_-1,grrows_-1);
- }
-
-
- /********
- *
- * gr_wpush() - save current graphic window
- *
- **/
-
- void gr_wpush(void)
- {
- ut_push(gr_minx_);
- ut_push(gr_miny_);
- ut_push(gr_maxx_);
- ut_push(gr_maxy_);
- }
-
-
- /********
- *
- * gr_wpop() - restore previous graphic window
- *
- **/
-
- void gr_wpop(void)
- {
- gr_maxy_ = ut_pop();
- gr_maxx_ = ut_pop();
- gr_miny_ = ut_pop();
- gr_minx_ = ut_pop();
- }
-
-
- /********
- *
- * gr_clr() - clear graphics window
- *
- **/
-
- void gr_clr(void)
- {
- if( (sc_adp_&CGA_ADP) || ((sc_adp_&EGA_ADP) && (sc_mode_<7)))
- /* check for CGA mode */
- gr_wfill(NUL); /* fill the window */
- else
- gr_wfill(grbcolr_);
- }
-
-
- /********
- *
- * gr_wfill(color) - fill a graphic window
- *
- **/
-
- void gr_wfill(int color)
- {
- ut_push(grfcolr_);
- gr_pen(NUL,color);
- gr_wfill_();
- grfcolr_ = ut_pop();
- gr_pen(NUL,grfcolr_);
- }
-
-
- /********
- *
- * gr_wgetp(buff) - get graphics picture to buffer
- *
- **/
-
- void gr_wgetp(char *buff)
- {
- int i,j;
-
- for(j=gr_miny_;j<gr_maxy_;++j)
- for(i=gr_minx_;i<gr_maxx_;++i)
- *buff++ = gr_getpt(i,j);
- }
-
-
- /********
- *
- * gr_wputp(buff) - put graphics picture to window
- *
- **/
-
- void gr_wputp(char *buff)
- {
- int i,j;
-
- for(j=gr_miny_;j<gr_maxy_;++j)
- for(i=gr_minx_;i<gr_maxx_;++i)
- gr_putpt(i,j,*buff);
- }
-
-
-
-
-
-