Introduction To Computer Graphics
Introduction To Computer Graphics
Computer Graphics is the creation of pictures with the help of a computer. The end product of the
computer graphics is a picture it may be a business graph, drawing, and engineering.
In computer graphics, two or three-dimensional pictures can be created that are used for research.
Many hardware devices algorithm has been developing for improving the speed of picture
generation with the passes of time. It includes the creation storage of models and image of objects.
These models for various fields like engineering, mathematical and so on.
Today computer graphics is entirely different from the earlier one. It is not possible. It is an
interactive user can control the structure of an object of various input devices.
Text mode graphics functions: The text mode graphics functions place the text in certain
area of the screen. Those functions are included in the header file <conio.h>. Some of those text
mode graphics functions are:
clrscr(): It is used to clear the screen and locates the curser at the beginning of the screen.
gotoxy(x,y): it moves the curser at specified co-ordinates (x,y) position.
cputs(string): it writes a string given to function to the user defined window screen.
putch(char) : it writes a character given to function to the user defined area of window.
There are so many graphical functions in C graphics library. All the graphics mode functions are
in <graphics.h> file. So we must include the graphics.h file to use those functions. To run a c
program in graphical mode the most important functions are as below.
initgraph(): it is one of the function that is used to initialize the computer in graphics mode.
Its syntax is as
closegraph(): It is the graphical function that is used to close the graphics mode initialized
by the initgraph() function.
graphresult(): it is a graphical function that returns the value 0 if the graphics is detected
correctly and the driver is correctly initialized to correct graphics mode other wise it returns
some error code than 0.
grapherrormsg(errorcode): This function returns the message string corresponding to the
errorcode returned by the graphresult() function.
cleardevice(): This function is used to clear the screen in graphical mode as clrscr() in text
mode.
setcolor(color): It is a function that is used to set the color of the drawing object with given
color. The color is indicated by the integer from 0 to 15 ( 16 color
moveto(x, y): it is used to move the cursor in display screen at specified co-ordinates by the
value (x,y).
outtext(" text string "): prints the text string in the current position of screen.
outtextxy(x, y, "string"): prints the string from the co-ordinate (x,y) position.
lineto(x, y): draws the line from current position to (x,y) position.
putpixel(x, y, color): displays a pixel(point) at (x,y) with given color.
line(a, b, c, d): draws line from (a,b) to (c,d).
circle(x, y, r): prints circle with center (x,y) and radius r.
rectangle(a, b, c, d): prints rectangle where (a,b) is upper left coordinate and (c,d) is lower
right co-ordinates of rectangle.
Applications
1. Computer Art:
Using computer graphics we can create fine and commercial art which include
animation packages, paint packages. These packages provide facilities for designing
object shapes and specifying object motion.Cartoon drawing, paintings, logo design
can also be done.
3. Presentation Graphics:
For the preparation of reports or summarising the financial, statistical,
mathematical, scientific, economic data for research reports, managerial reports,
moreover creation of bar graphs, pie charts, time chart, can be done using the tools
present in computer graphics.
4. Entertainment:
Computer graphics finds a major part of its utility in the movie industry and game
industry. Used for creating motion pictures , music video, television shows, cartoon
animation films. In the game industry where focus and interactivity are the key
players, computer graphics helps in providing such features in the efficient way.
5. Education:
Computer generated models are extremely useful for teaching huge number of
concepts and fundamentals in an easy to understand and learn manner. Using
computer graphics many educational models can be created through which more
interest can be generated among the students regarding the subject.
6. Training:
Specialised system for training like simulators can be used for training the
candidates in a way that can be grasped in a short span of time with better
7. Visualisation:
Today the need of visualise things have increased drastically, the need of
visualisation can be seen in many advance technologies , data visualisation helps in
finding insights of the data , to check and study the behaviour of processes around
us we need appropriate visualisation which can be achieved through proper usage of
computer graphics
8. Image Processing:
Various kinds of photographs or images require editing in order to be used in
different places. Processing of existing images into refined ones for better
interpretation is one of the many applications of computer graphics.
9. Machine Drawing:
Computer graphics is very frequently used for designing, modifying and creation of
various parts of machine and the whole machine itself, the main reason behind
using computer graphics for this purpose is the precision and clarity we get from
such drawing is ultimate and extremely desired for the safe manufacturing of
machine using these drawings.