empty

computer graphics programming in c



Computer graphics:

Computer graphics are pictures and movies created using computers – usually referring to image data created by a computer specifically with help from specialized graphical hardware and software. It is a vast and recent area in computer science.The phrase was coined by computer graphics researchers Verne Hudson and William Fetter of Boeing in 1960. Another name for the field is computer-generated imagery, or simply CGI.

Important topics in computer graphics include user interface design, sprite graphics, vector graphics, 3D modeling, shaders, GPU design, and computer vision, among others. The overall methodology depends heavily on the underlying sciences of geometry, optics, and physics. Computer graphics is responsible for displaying art and image data effectively and beautifully to the user, and processing image data received from the physical world. The interaction and understanding of computers and interpretation of data has been made easier because of computer graphics. Computer graphic development has had a significant impact on many types of media and has revolutionized animation, movies, advertising, video games, and graphic design generally.

for more details:

https://en.wikipedia.org/wiki/Computer_graphics

Link to computer graphics pdf:

download links to turbo c:

https://sourceforge.net/projects/turbocforwindows-9/

https://turbocpp.codeplex.com/

https://www.softpedia.com/get/Programming/Coding-languages-Compilers/TurboCplusplus-for-Windows-7.shtml

https://indiaexam.in/turbo-c-download-windows-7-64-bit-full-screen.html

download link to 7-Zip 15.06 Beta (64-bit) :

https://filehippo.com/download_7-zip_64/

https://www.winzipdownload.org/

INITGRAPH FUBCTION :

initgraph(&gd, &gm, “C:\TC\BGI”);

1- In C graphics programming you have to use standard library functions ( need not worry if you don’t know functions ) to get your task done. Just you pass arguments to the functions and it’s done.

2- Firstly you should know the function initgraph which is used to initialize the graphics mode .

3- To initialize graphics mode we use initgraph function in our program.

4- initgraph function is present in “graphics.h” header file, so your every graphics program should include “graphics.h” header file.

5- Firstly let me tell you what is the output of this program, this program initializes graphics mode and then closes it after a key is pressed.

6- To begin with we have declared two variables of int type gd and gm for graphics driver and graphics mode respectively, you can choose any other variable name as you wish.

7- DETECT is a macro defined in “graphics.h” header file, then we have passed three arguments to initgraph function first is the address of gd, second is the address of gm and third is the path where your BGI files are present ( you have to adjust this accordingly where you turbo compiler is installed).

8- Initgraph function automatically decides an appropriate graphics driver and mode such that maximum screen resolution is set, getch helps us to wait until a key is pressed, closegraph function closes the graphics mode and finally return statement returns a value 0 to main indicating successful execution of your program.

9- After you have understood initgraph function then you can use functions to draw shapes such as circle, line , rectangle etc, then you can learn how to change colors and fonts using suitable functions, then you can go for functions such as getimage, putimage etc for doing animation.

CLOSEGRAPH FUNCTION :

closegraph();

closegraph function closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph.

Declaration :- void closegraph();

GRAPHICS.H FUNCTIONS :

arc
bar
bar3d
circle
cleardevice
closegraph
drawpoly
ellipse
fillellipse
fillpoly
floodfill
getarccords
getbkcolor
getcolor
getdrivername
getimage
getmaxcolor
getmaxx
getmaxy
getpixel
getx
gety
graphdefaults
grapherrormsg
imagesize
line
lineto
linerel
moveto
moverel
outtext
outtextxy
pieslice
putimage
putpixel
rectangle
sector
setbkcolor
setcolor
setfillstyle
setlinestyle
settextstyle
setviewport
textheight
textwidth

There are 16 colors declared in graphics.h as listed bellow.

BLACK: 0
BLUE: 1
GREEN: 2
CYAN: 3
RED: 4
MAGENTA: 5
BROWN: 6
LIGHTGRAY: 7
DARKGRAY: 8
LIGHTBLUE: 9
LIGHTGREEN: 10
LIGHTCYAN: 11
LIGHTRED: 12
LIGHTMAGENTA: 13
YELLOW: 14
WHITE: 15

FOR MORE DETAILS FEEL FREE TO VIST :

https://www.programmingsimplified.com/c/graphics.h

https://electrosofts.com/cgraphics/

SPECIAL THANKS TO THE ABOVE MENTIONED SITES.

Thanks for your great time and patience to read till the end of the description.

Thanks to YouTube and Google.


Post time: Feb-26-2017
INQUIRY NOW
  • * CAPTCHA: Please select the Tree