Dec 142017
 
Turbo C graphic primitives.
File TCGRAP.ZIP from The Programmer’s Corner in
Category C Source Code
Turbo C graphic primitives.
File Name File Size Zip Size Zip Type
GRAPH.H 845 362 deflated
GRAPH.LIB 3584 1894 deflated
GRAPHIC.DOC 10389 2051 deflated

Download File TCGRAP.ZIP Here

Contents of the GRAPHIC.DOC file


Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------












GRAPH.C

Version 1.0

Basic Graphic Functions for Turbo C

By: Chuck G. Smith
6/27/87








































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------


Introduction



This set of functions are the basic graphic
primitives for any graphic functions. Each one is described
in sufficient detail as to be able to use them in your
programs. This package uses bios int 10H calls, and all of
the graphic modes supported by bios are supported here,
except mode 7 (monochrome only). You will find that a bios
listing for the functions of int 10H would be useful in the
use of this package, although not necessary.
I spent 48+ hours in the implementation of this
package and it is 99.99% free of any known errors, but, like
everything else in the world this package could have flaws
that were undetected during development. Please let me know
what they are so I can correct them. This package is the first
version I have put out if you desire any additional features , I
will implement them on the priority of request and popularity
of request.
I developed this package using 640K, MSDOS 3.2 and a CGA driving
a green screen, and a whole lot of coffee. I do value my health
that is why the source code is not with the package only the .LIB
and .H files necessary to link it to your program.
If you feel
that this package is a decent start and you find it useful,
please send an amount you think is fair (enough to by some
more coffee). I may even consider releasing the source under
some type of agreement similar to Borland's run-time source
license. ( not quite as steep though.)


Comments, suggestions , complaints (or coffee money) to:


Chuck G. Smith
CompuServe: 75036,2663
GEnie : Chuck.Smith
Or:
P.O. Box 2250
Corrales, New Mexico
87048
















--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : checkcolor(int color)




Syntax : color = checkcolor(color)



Returns : corrected color.


Description: checkcolor checks the color passed to it
against the current video mode's color selection. If the
color is invalid for the video mode it sets color to 0.
This is mainly an internal checking function for the rest of
the package, it has nothing to do with the palette.











































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : circle(int x, int y, int radius, int color)




Syntax : circle(x,y,r,color)



Returns : void.


Description: Draws the mathematically accurate circle of origin
(x,y) and radius r.














































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : endgraphics(void)




Syntax : endgraphics()



Returns :void.


Description: Returns screen to 80x25 color.















































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : getextcord(int *x, int *y)




Syntax : getextcord(&x,&y)



Returns : void. Alters x and y to current TEXT position.


Description: Works in any mode for TEXT.















































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : graphwatch(int x, int y)




Syntax : graphwatch(x,y)



Returns :void.


Description:Internal use - a watchdog. All Errors are handled
with this function.














































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : hires(void)




Syntax : hires()



Returns :void.


Description: sets screen to mode 6 (640x200 b&w)















































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : line(int x, int y, int x1,int y1, int col)




Syntax : line(x,y,x1,y1,col)



Returns :void.


Description: line(x,y,x1,y1) - draws a line from (x,y) to
(x1,y1) in color 'col'.














































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : point(int x, int y, int col)




Syntax : point(x,y,col)



Returns :void.


Description: Turns on point (x,y) with color col.















































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : setbackgnd(int color)




Syntax : setbackgnd(color)



Returns :void.


Description: sets background palette, does not work on mode
6. (hires).














































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : setforegnd(int color)




Syntax : setforegnd(color)



Returns : void.


Description: sets foreground palette, does work on mode 6.















































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : setgramode(int mode)




Syntax : setgramode(modenum)



Returns : void.


Description: setgramode(modenum) where modenum equals :



Modenumber Description Type
-----------------------------------------------------------
0 - 40x25 black & white Alphanumeric
1 - 40x25 color Alphanumeric
2 - 80x25 black & white Alphanumeric
3 - 80x25 color Alphanumeric
4 - 320x200 4 color Graphic
5 - 320x200 black & white Graphic
6 - 640x200 black & white Graphic
7 ---------------- NOT IMPLEMENTED -------------
8 - 160x200 16 colors Extended Graphics
9 - 320x200 16 colors Extended Graphics
10 - 640x200 4 colors Extended Graphics































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : unpoint(int x,int y)




Syntax : unpoint(x,y)



Returns : void.


Description: unpoint is a macro for point(x,y,0)















































--------------------------------------------------------------------------------


By : Chuck G. Smith
Graphic Primitives for Turbo C (r) July 14, 1987
--------------------------------------------------------------------------------
Function : int getmode(void)




Syntax : mode = getmode()



Returns : video mode.


Description: getmode returns the current video mode according to
bios. Please see setgramode() for mode numbers.














































--------------------------------------------------------------------------------


By : Chuck G. Smith


 December 14, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)