CLIP-GRAPHICS The Clipper (tm) Graphics Library by Maurice J. Halmos Version 1.2 February 1989 Serial #1000300 Copyright (c) VideoSoft/Video-Comp Electr. 1988, 1989 VideoSoft/Video-Comp CLIPGRAF Library Table of Contents 1 INTRODUCTION .................................................... 1 1.1 Purpose & Registration ..................................... 1 1.2 Disclaimer ................................................. 2 2 THE GRAPHICS LIBRARY ............................................ 3 2.1 Usage ...................................................... 3 2.2 Running the Clipdemo ....................................... 3 2.3 What Is in New Version ..................................... 4 2.4 Summary of functions ....................................... 4 2.5 Functions Description ..................................... 7 2.5.1 Notes on Ellipse, Arc, and Pie ........................ 7 2.5.2 Notes on Initializing and Modes ....................... 7 2.5.3 Notes on Color ........................................ 8 2.5.4 Notes in Fill Pattern ................................. 9 2.5.5 Notes on Image Saving and Loading ..................... 10 2.5.6 Notes on Using the Mouse. ............................. 11 2.5.7 Functions ............................................. 12 FUNCTION: g_arc(x1,y1,x2,y2,xb,yb,xe,ye) ................. 12 FUNCTION: g_clear(num) ................................... 12 FUNCTION: g_close() ...................................... 12 FUNCTION: g_dot(x,y) ..................................... 12 FUNCTION: g_draw(x1,y1,IMAGE,action) ..................... 13 FUNCTION: g_ellip(fill,x1,y1,x2,y2) ...................... 13 FUNCTION: g_fill(x,y,bcolor) ............................. 13 FUNCTION: g_getdot(x,y) .................................. 13 FUNCTION: g_imget(x1,y1,x2,y2) ........................... 14 FUNCTION: g_imload(x1,y1,"fname") ........................ 14 FUNCTION: g_imsave(x1,y1,x2,y2,"fname") .................. 14 FUNCTION: g_imsize(x1,y1,x2,y2) .......................... 14 FUNCTION: g_init(num) .................................... 15 FUNCTION: g_lineto(x,y) .................................. 15 FUNCTION: g_mode() ....................................... 15 FUNCTION: g_mouse(num) ................................... 15 FUNCTION: g_moveto(x,y) .................................. 16 FUNCTION: g_msread(num) .................................. 16 FUNCTION: g_ncolors() .................................... 16 FUNCTION: g_pie(fill,x1,y1,x2,y2,xb,yb,xe,ye) ............ 16 FUNCTION: g_rect(fill,x1,y1,x2,y2) ....................... 17 FUNCTION: g_reg(num) ..................................... 17 FUNCTION: g_say(row,col,text) ............................ 17 FUNCTION: g_selpalt(num) ................................. 17 FUNCTION: g_setapage(num) ................................ 17 FUNCTION: g_setbkc(num) .................................. 18 FUNCTION: g_setclr(num) .................................. 18 -ii- VideoSoft/Video-Comp CLIPGRAF Library FUNCTION: g_setfmsk(byte,byte,byte,byte,byte,byte,by- te,byte) .................................................. 18 FUNCTION: g_setline(num) ................................. 18 FUNCTION: g_setorg(x,y) .................................. 18 FUNCTION: g_settxtc(num) ................................. 19 FUNCTION: g_setvpage(num) ................................ 19 FUNCTION: g_twindow(r1,c1,r2,c2) ......................... 19 FUNCTION: g_viewport(x1,y1,x2,y2) ........................ 19 FUNCTION: g_wait() ....................................... 20 FUNCTION: g_wraptxt(flag) ................................ 20 FUNCTION: g_xmax() ....................................... 20 FUNCTION: g_ymax() ....................................... 20 -iii- VideoSoft/Video-Comp CLIPGRAF Library 1 INTRODUCTION 1.1 Purpose & Registration The CLIPGRAF library is intended to be a supplement to your Clipper run time library. It contains a collection of graphic mode routines for doing all the low level and higher level graphic tasks, from determining the graphics adaptor, to animation. The library uses direct video rou- tines, for fast performance, hence, it will only work with IBM (tm) compat- ible desktop computers. The library functions have been tested in a number of 8088, 80286, and 80386 clones. It supports CGA, HERCULES, EGA, and VGA graphics adaptors. This is a shareware program. As such, it may be freely copied and distributed for evaluation. If you would like to use it, you must purchase a license. One license per user is required. The license will be good for all future updates of the library, and will allow you to inhibit the copyright notice that you get the first time you use the CLIPGRAF library. Licenses cost $20. Include your name and address along with the ver- sion and serial number above. Send to: VideoSoft/Video-Comp Electr. Maurice J. Halmos 825 Washington Ave. #15 Santa Monica, CA 90403 Send comments through written mail to the above address or use E-mail to my CompuServe address: 73307,3076 -1- VideoSoft/Video-Comp CLIPGRAF Library 1.2 Disclaimer The author claims no responsibility for any damages caused by the use or misuse of this library. This product is distributed "as is" with no warranty expressed or implied. The author will not be responsible for any losses incurred by the use of this product. The author reserves the right to make modifications at any time. Prices are subject to change without notice. Trademarks. Clipper is a registered trademark of Nantucket. CompuServe is a registered trademark of CompuServe Incorporated. IBM is a registered trademark of International Business Machines. Lotus is a registered trademark of Lotus Development Corporation. Microsoft is a registered trademark of Microsoft Corporation. Turbo C is a registered trademark of Borland International. -2- VideoSoft/Video-Comp CLIPGRAF Library 2 THE GRAPHICS LIBRARY 2.1 Usage Assuming that you have written a program, such as the sample program included in this package, CLIPDEMO, you must compile and link as follows (which is the usual way): (Compile the usual way,) c:\path1\clipper c:\path2\clipdemo (you may use Microsoft Linker - faster) c:\path3\link clipdemo,clipdemo,, c:\path1\clipper c:\path1\clipgraf (or Turbo C Tlink - fastest) c:\path3\tlink clipdemo,clipdemo,, c:\path1\clipper c:\path1\clipgraf (or Clipper's plink86 - slowest) c:\path3\plink86 FI clipdemo,LIB c:\path1\clipper, c:\path1\clipgraf Though Turbo C has the fastest linker, it will complain about unre- solved externals. The compiled programs seemed to run properly in spite of the warnings. Use the linker that is most convenient for you to use. 2.2 Running the Clipdemo The demonstration program along with this package must be compiled and linked as shown in the previous section. In order to run the program you just type its name, "clipdemo". The program will select the highest reso- lution graphics mode, that has more than 2 colors (i.e. for CGA it will choose 320x200 4 colors). You may override to different graphics mode by calling the program with a "number" parameter (i.e. "clipdemo 6") to try to -3- VideoSoft/Video-Comp CLIPGRAF Library force that mode. If your computer supports it, then that will be the active mode. See table in section 2.5.2 Notes on Initializing and Modes, for mode numbers. 2.3 What Is in New Version Version 1.1 added: The ability to save images to CLIPPER Variable The ability to save images to disk Mouse interface Version 1.1 added: HERCULES graphics support The function g_getdot() to read a pixel from the screen 2.4 Summary of functions The following list contains all the functions that may be used with the CLIPGRAF library. Some of the functions return values, while others only perform tasks. Function Name Purpose Returns g_arc(x1,y1,x2,y2,xb,yb, Draws an open elliptic Nothing xe,ye) arc g_clear(num) clears section of the Nothing screen g_close() return screen to start- Nothing ing or default mode g_dot(x,y) sets pixel at x,y coor- Nothing dinates g_draw(x1,y1,IMAGE,action) Displays a rectangular Nothing screen image saved with g_imget(). -4- VideoSoft/Video-Comp CLIPGRAF Library g_ellip(fill,x1,y1,x2,y2) draw ellipse optionally Nothing filled g_fill(x,y,bcolor) Fill an area of the Nothing screen with the current color and fillmask g_getdot(x,y) Reads a pixel from the Integer repre- screen senting the pixel g_imget(x1,y1,x2,y2) Saves rectangular image Up to 64K of in a CLIPPER variable. image data as To be used with TEXT. g_draw(). g_imload(x1,y1,"fname") Displays a rectangular Number of bytes screen image saved with read from disk. g_imsave(). g_imsave(x1,y1,x2,y2,"fname" Saves rectangular image Number of bytes ) to disk. written to disk. g_imsize(x1,y1,x2,y2) Calculates the size in Integer of image bytes of a rectangular size. image. g_init(num) Initializes the graphics False if it routines fails, True if successful g_lineto(x,y) Draw a line in the cur- Nothing rent color and style. g_mode() Returns the mode number g_mouse(num) Sets mouse action Nothing g_moveto(x,y) Moves to x,y position Nothing g_msread(num) Reads mouse status Coordinates, but- tons pressed, and status. -5- VideoSoft/Video-Comp CLIPGRAF Library g_ncolors() Obtains the maxcolors Returns max. num- available in the present ber of colors mode. available. g_pie(fill,x1,y1,x2,y2, Draw a wedge cut from an Nothing xb,yb,xe,ye) ellipse g_rect(fill,x1,y1,x2,y2) Draw a rectangle Nothing g_reg(num) Register to CLIPGRAF Nothing library g_say(row,col,text) Puts text at row,col Nothing g_selpalt(num) Selects color palette Previous palette number g_setapage(num) Select a video page for Previous page current output number. g_setbkc(num) Sets background color Nothing g_setclr(num) Sets the foreground Nothing color. g_setfmsk(byte,byte,byte, Sets the fill mask Nothing byte,byte,byte,byte,byte) g_setline(num) Sets line pattern. Nothing g_setorg(x,y) Changes the coordinate Nothing origin. g_settxtc(num) Set text color. Nothing g_setvpage(num) Select a video page for Previous page viewing number. g_twindow(r1,r1,r2,c2) Defines a scrolling text True or False display window g_viewport(x1,y1,x2,y2) Sets up a rectangular True or False region for display -6- VideoSoft/Video-Comp CLIPGRAF Library g_wait() Waits for a character to The integer cor- be hit. responding to the character. g_wraptxt(flag) Allows text to wrap in Nothing text window. g_xmax() Maximum x pixels g_ymax() Maximum y pixels 2.5 Functions Description 2.5.1 Notes on Ellipse, Arc, and Pie The specification of the ellipse, arc, and the pie involves the con- cept of the "bounding rectangle," which is the smallest rectangle that completely encloses the figure being drawn. Since the arc and pie are both parts of the ellipse, in all cases you have to specify the bounding rectan- gle of an ellipse. Both the bounding rectangle and the basic rectangle are specified by the logical coordinates of their upper left hand and lower right corners. For the arc as well as the pie, the elliptic segment is drawn as follows. A (imaginary) line is drawn from the center of the ellipse (of which the arc or the pie is a part) to a point specified as the beginning point. The g_pie() and the g_arc() functions begin drawing the curved edge at the point where that line intersects the ellipse. The functions trace over the underlying ellipse, using the current color, in a counter- clockwise direction until reaching the point where an imaginary line drawn from the center to a specified end point cuts the ellipse. Curved lines are always drawn in a solid line style. Thus the ellipse and the pie can only have a solid boundary. They can however be filled in the interior with a user defined pattern. 2.5.2 Notes on Initializing and Modes You need to initialize the graphics driver to operate the graphics functions. The g_init() function does this, and sets up the screen to the highest mode supported by the hardware. You may override the mode selec- tion by including an argument to the function, i.e. g_init(mode_number). To use the HERCULES Graphics mode, you must run the utility HERC.COM before your program, in order to set the video vectors. This utility is placed in the public domain by Microsoft and is included in this package. -7- VideoSoft/Video-Comp CLIPGRAF Library The following modes are supported: Mode # Mode Name 19 VGA 320x200 256 colors 18 VGA 640x480 16 colors 17 VGA 649x480 BW 2 colors 16 EGA 640x350 4 or 16 colors 15 EGA 640x350 BW 2 colors 14 EGA 640x200 16 colors 13 EGA 320x200 16 colors 8 HERCULES Graphics BW (Must run HERC.COM before) 7 MDA Text 80x25 BW 6 CGA 640x200 BW 2 colors 5 CGA 320x200 BW 4 grey 4 CGA 320x200 4 colors 3 CGA Text 80x25 16 or 8 colors -1 Default mode for the current hardware configuration The first time you use g_init(), you will get a copyright message, further calls to g_init() (if you want to change the mode for instance) will not re-display this screen. To inhibit the original copyright screen you must use the function g_reg(reg_number), where reg_number is the registration number you get when you become a registered user. 2.5.3 Notes on Color The color number may vary according to the hardware used. The default colors in CGA text mode, EGA text and graphics, or the first 16 VGA text and graphics, are: Color Number Color -8- VideoSoft/Video-Comp CLIPGRAF Library 0 Black 1 Blue 2 Green 3 Cyan 4 Red 5 Magenta 6 Brown 7 White 8 Dark grey 9 Light blue 10 Light green 11 Light cyan 12 Light red 13 Light magenta 14 Yellow 15 Bright white 2.5.4 Notes in Fill Pattern The fill pattern is specified by the argument in g_setfmsk(), which is made up of eight integers corresponding to eight bytes. Since each charac- ter has 8 bits, you can think of this array of bits as a model of an area on the screen, 8 pixels wide and 8 pixels tall, with the first byte representing the first row of the area. When filling an 8x8 area using the mask, those pixels that correspond to 0 bits are left untouched while the rest are filled with the current color. For areas larger than 8x8 pixels, the fill operation uses the mask on successive 8x8 blocks until the entire area is covered. Thus a solid fill is specified when all eight bytes contain the value FFh (255 decimal). This is the default value of the fill style in the graphics package. See demo program for further examples. -9- VideoSoft/Video-Comp CLIPGRAF Library 2.5.5 Notes on Image Saving and Loading There are two basic ways of saving and loading images. 1. To and from a CLIPPER memory variable using the g_imget() and g_draw() function pairs, and g_imsize() to check for size, and 2. To and from a disk file using g_imsave() and g_imload(). Using the first method you must check to make sure you have enough RAM memory, and for the second method, enough disk space. Using the first method has the advantage of being able to "pop" the image on the screen rather quickly. You can also save the CLIPPER variable to disk. The drawback, is that you can only do this in 64K chunks. The disk method allows you to save a full high resolution screen to disk in one command, but is slower. The coding of the image is different for the two methods, and cannot be interchanged. The disk method uses one byte per pixel; for a high res VGA mode, this equals 640x480 = 307K bytes! Using this scheme, allows images saved in one mode to be showed in a different one (i.e. CGA to EGA or vice versa). Using the RAM memory method the minimum amount of bytes is used. For instance, one pixel in high res VGA or EGA (16 colors) requires only half a byte. Images may be switched from one mode to another, only if the pixels use the same number of bits. Otherwise, on gets garbage on the screen. The following table shows some of the full screen sizes in bytes: Mode Res. Colors Size 4 & 5 320x200 4 16,285 6 640x200 2 16,285 13 320x200 16 32,968 14 640x200 16 65,128 15 640x350 2 56,866 16 640x350 16 113,728 17 640x480 2 38,965 -10- VideoSoft/Video-Comp CLIPGRAF Library 18 640x480 16 155,848 19 320x200 256 64,525 This table should give you an idea of the size of screen that can be saved to memory. Pixel action: OR, AND, RESET, SET XOR: When you use g_draw(), you can specify the pixel action. To put a pixel on the screen regardless of what is currently there, you should use SET. To make an image disappear you should XOR it with itself. 2.5.6 Notes on Using the Mouse. The mouse interface is handled by a two function combination, g_mou- se() and g_msread(). The first function, g_mouse() causes an action, and the second function is used to read the status. This is done by reading the 4 registers (AX BX CX DX) using the appropriate argument 1 to 4. The following table shows the actions and results: g_mouse() g_msread() Return Value of Purpose num num g_msread(num) 0 1 1 Mouse installed Reset mouse and return 0 Mouse not installed status and number of but- tons 2 Number of buttons 1 Make mouse cursor visible 2 Hide mouse cursor 3 2 0 no button pressed Return button status and 1 left button pressed mouse position. 2 right button pressed 3 both buttons pressed 3 y coordinate 4 x coordinate The coordinates are in units of "mickeys". These are 0-639 across, and 0-ymax in the vertical, where ymax is the maximum number of pixels in the vertical. The mouse routines use the standard bios interrupt calls related to the mouse driver. I have found that the effects are not always as expected, and they may vary from one screen mode to another. You can test this with the clipdemo program accompanying this package. -11- VideoSoft/Video-Comp CLIPGRAF Library 2.5.7 Functions FUNCTION: g_arc(x1,y1,x2,y2,xb,yb,xe,ye) Purpose: Use g_arc to draw a segment of an ellipse using the current color. Arguments: x1,y1 Coordinates of upper left corner of bounding rectangle of the ellipse to which the arc belongs. x2,y2 Coordinates of lower right corner of bounding rectangle of the ellipse to which the arc belongs. xb,yb Arc begins at the point where a line drawn from the center of the bounding rectangle to (xb,yb) cuts the ellipse. xe,ye Arc ends at the point where a line drawn from the center of the bounding rectangle to (xe,ye) cuts the ellipse. FUNCTION: g_clear(num) Purpose: Clear an area of the screen and fill it with the current background color. Arguments: 0 Entire screen is cleared 1 Only current viewport is cleared 2 Only current text window is cleared FUNCTION: g_close() Purpose: Resets the screen to the mode it was before g_init() was invoked. FUNCTION: g_dot(x,y) Purpose: Set a specific pixel to the current color Arguments: x,y is the current coordinate system -12- VideoSoft/Video-Comp CLIPGRAF Library FUNCTION: g_draw(x1,y1,IMAGE,action) Purpose: The function is used to draw a rectangular image, that was saved to a CLIPPER variable by g_imget(). Arguments: The rectangle coordinates, top left corner is (x1,y1), IMAGE is the CLIPPER text variable created with g_imget(), and action is a number that specifies the pixel action to be used. These may be, 0 - for OR, 1 - for AND, 2 - for RESET, 3 - for SET, and 4 - for XOR. FUNCTION: g_ellip(fill,x1,y1,x2,y2) Purpose: Draw a filled or bordered ellipse that you specify by the corners of the bounding rectangle. Arguments: fill 0 do not fill, i.e. bordered only 1 fill with the current fillmask. x1,y1 Coordinates of upper left corner of bounding rectangle of the ellipse to which the arc belongs. x2,y2 Coordinates of lower right corner of bounding rectangle of the ellipse to which the arc belongs. FUNCTION: g_fill(x,y,bcolor) Purpose: Fill an area of the screen with the current color using the current fillmask. arguments: x,y position of starting point bcolor Color number of the boundary at which filling should stop FUNCTION: g_getdot(x,y) Purpose: Read a specific pixel at the pixel color Arguments: x,y is the current coordinate system Returns: Integer corresponding to the pixel color -13- VideoSoft/Video-Comp CLIPGRAF Library FUNCTION: g_imget(x1,y1,x2,y2) Purpose: The function is used to save a rectangular screen image into a CLIPPER text variable. The CLIPPER variable may then be treated as any other. Arguments: The rectangle coordinates, top left corner is (x1,y1) and lower right corner (x2,y2). Returns: Character string up to 64K long. Size may be checked before operation, using g_imsize(). See "Notes on Image Saving and Loading" section. FUNCTION: g_imload(x1,y1,"fname") Purpose: The function is used to load a rectangular screen image from disk. This image file must have been created with g_imsave(). Arguments: The rectangle coordinates top left corner is (x1,y1). "fname" is the file name to be used. Returns: Integer of the number of bytes loaded. If there was a problem opening file (i.e. not found), then it returns a -1. See "2.5.5" section. FUNCTION: g_imsave(x1,y1,x2,y2,"fname") Purpose: The function is used to save a rectangular screen image to disk. This image may be reloaded with g_imload(). Arguments: The rectangle coordinates, top left corner is (x1,y1) and lower right corner (x2,y2). "fname" is the file name to be used. If the file-name already exist, it is written over. Returns: Integer of the number of bytes written. See "2.5.5" section. FUNCTION: g_imsize(x1,y1,x2,y2) Purpose: The function is used to obtain the size of rectangular screen image. This is used to determine if there is enough RAM memory to hold the image. -14- VideoSoft/Video-Comp CLIPGRAF Library Arguments: The rectangle coordinates, top left corner is (x1,y1) and lower right corner (x2,y2). Returns: Integer value of the number of bytes, that would be require to hold the image. See "2.5.5" section. FUNCTION: g_init(num) Purpose: The g_init() function has two purposes: It sets which video mode to use for the graphics and gets the data for that mode and stores it to a data structure for program access. (i.e. g_mode(), g_xmax(), g_ymax(), g_ncolors()) Arguments: mode Optional mode number. If no argument is used, the highest possible one is selected. If mode number used is not supported by the hardware, then again the high- est possible one is selected. Returns: Logical TRUE if successful, FALSE is no mode was found. FUNCTION: g_lineto(x,y) Purpose: Draw a line from the current position to a new point using the current color and line style Arguments: x,y Coordinate point to which line is drawn FUNCTION: g_mode() Purpose: Retrieves the current video mode Returns: The mode number (see "Notes on Initializing and Modes" section) FUNCTION: g_mouse(num) Purpose: Reset and activate mouse functions Parameters: Number specifying the mouse actions (see "Notes on Using the Mouse." section) Returns: Nothing -15- VideoSoft/Video-Comp CLIPGRAF Library FUNCTION: g_moveto(x,y) Purpose: Change the current position to a new point. Arguments: x,y Coordinate of new position. FUNCTION: g_msread(num) Purpose: Read the results of g_mouse(). This includes mouse status, position, and buttons pressed Parameters: Number specifying the mouse parameter to be read (see "2.5.6" section) Returns: Number corresponding to status, number of buttons, position. FUNCTION: g_ncolors() Purpose: Retrieves the maximum number of colors supported by the current video mode Returns: The color number (see "Notes on Color" section) FUNCTION: g_pie(fill,x1,y1,x2,y2,xb,yb,xe,ye) Purpose: Draws a filled or bordered wedge whose boundary consists of a segment of an ellipse and lines joining the center of the ellipse to the beginning and end points of the segment. Arguments: fill Number that indicates whether to fill (fill=1), or just draw a border (fill=0). x1,y1 Coordinates of upper left corner of bounding rectangle of the ellipse to which the pie belongs. x2,y2 Coordinates of lower right corner of bounding rectangle of the ellipse to which the pie belongs. xb,yb Pie begins at the point where a line drawn from the center of the bounding rectangle to (xb,yb) cuts the ellipse. xe,ye Pie ends at the point where a line drawn from the center of the bounding rectangle to (xe,ye) cuts the ellipse. -16- VideoSoft/Video-Comp CLIPGRAF Library FUNCTION: g_rect(fill,x1,y1,x2,y2) Purpose: Draw a filled or bordered rectangle that you specify by the corners. Arguments: fill 0 do not fill, i.e. bordered only 1 fill with the current fillmask. x1,y1 Coordinates of upper left corner. x2,y2 Coordinates of lower right corner. FUNCTION: g_reg(num) Purpose: To inhibit the copyright screen that is shown the first time that g_init() is used. Arguments: Registration number that is supplied when you register. FUNCTION: g_say(row,col,text) Purpose: Puts text in the screen using the current text color. Similar to the "@row,col say 'TEXT'" command. Arguments: row,col is the text coordinates (i.e. 80x25) text is a string to be output. FUNCTION: g_selpalt(num) Purpose: Use this function to activate one of up to four predefined palettes when using the CGA or the EGA in video mode 4 (320x200 4 color) or video mode 5 (320x200 4 grey). Arguments: num is palette number being selected. Returns: the previous palette number. FUNCTION: g_setapage(num) Purpose: Use this function in EGA or VGA graphics modes and in the text modes to select the current page or portion of display -17- VideoSoft/Video-Comp CLIPGRAF Library memory where graphics and text operations are performed. This function only works when the adapter has enough video memory to support multiple pages. Arguments: num is page number to be used for all further text and graphics operations. Returns: the previous active page number or a negative value if it fails. FUNCTION: g_setbkc(num) Purpose: Selects a new background color Argument: New color value FUNCTION: g_setclr(num) Purpose: Selects a new color to be used by all future calls to drawing functions. Argument: New color value FUNCTION: g_setfmsk(byte,byte,byte,byte,byte,byte,byte,byte) Purpose: Defines a new pattern that will be used as a fill in func- tions like g_rect(), g_pie(), and g_ellip(). Arguments: Eight integer from values 0 to 255 (see section Notes in Fill Pattern). FUNCTION: g_setline(num) Purpose: Selects a line pattern Argument: Number 0 to 15 where 0 is minimum number of dots to 15 a solid line. Numbers larger than 15 will generate a random pattern. FUNCTION: g_setorg(x,y) Purpose: Use to change the origin of the x,y coordinates. The default origin is the upper left corner of the screen. Arguments: x,y coordinate for new origin. -18- VideoSoft/Video-Comp CLIPGRAF Library FUNCTION: g_settxtc(num) Purpose: Selects a new color to be used by all future text output using the g_say() function. Argument: New color value FUNCTION: g_setvpage(num) Purpose: Use this function in EGA or VGA graphics modes and in the text modes to select the current page or portion of display memory that is mapped to the screen. This function only works when the adapter has enough video memory to support multiple pages. Arguments: num is page number to be displayed. Returns: the previous visual page number or a negative value if it fails. FUNCTION: g_twindow(r1,c1,r2,c2) Purpose: Defines a window in terms of row and column coordinate for scrolled text output. You can define a new background color for text and clear the text window to give it a different background color from the rest. Similar windows for graph- ics functions can be defined with g_viewport(). Arguments: r1,c1 Upper left corner of text window in row and column coordinate. r2,c2 Lower right corner of text window in row and column coordinate. Returns: logical TRUE or FALSE FUNCTION: g_viewport(x1,y1,x2,y2) Purpose: Defines a window for graphics output, the coordinate origin is moved to the upper left corner of the viewport. Arguments: x1,y1 Upper left corner of graphics window x2,y2 Lower right corner of graphics window Returns: logical TRUE or FALSE -19- VideoSoft/Video-Comp CLIPGRAF Library FUNCTION: g_wait() Purpose: To wait until a character has been typed. Similar to Clipper's wait command, but Clipper's command disrupts the graphics screen when in CGA mode. Returns: Integer number corresponding to the character pressed. FUNCTION: g_wraptxt(flag) Purpose: Allows text to wrap on text window. Arguments: flag is 0 -> do not wrap, 1 -> do wrap. FUNCTION: g_xmax() Purpose: To obtain the maximum number of horizontal pixels in the current video mode. Returns: Integer corresponding to the horizontal pixel number. FUNCTION: g_ymax() Purpose: To obtain the maximum number of vertical pixels in the current video mode. Returns: Integer corresponding to the vertical pixel number. -20-