BASICS OF COMPUTER GRAPHICS
Computer graphics
are any image media, usually movies and pictures, which are created through the
use of hardware and software. They are often referred to as computer-generated
imagery; more commonly known as CGI.
An example of a computer graphic is the Computer Hope Guy (shown right), one of
our various logos.
In general, a the term graphic
refers to a design or visual image displayed on a variety of surfaces,
including canvas, paper, a wall, a sign, or a computer monitor. They are
created for the purposes of entertainment, branding or to inform.
Graphic
may also be used to describe a phrase, gesture, or image that is considered
obscene or offensive.
HEADER FILE:-
#include<stdio.h>
:- Stdio.h is a header file which contains
the declarations (not the definitions) of standard I/O functions like print(),
scanf(), etc.,. The header file just tells the compiler what types external
functions and variables are, defines macros, types etc. Any functions and
variables that get referenced in your source file will be linked in during the
linker phase. If you include stdio.h and use print in your program, the
compiler adds print as an "unresolved" symbol in the object file, and
then the linker will try to find a function called printf either in the object
files you explicitly link, or in the libraries it is configured to search.
#include<graphics.h>
:- graphics.h. This interface provides access to a
simple graphics library that makes it possible to draw lines,
rectangles, ovals, arcs, polygons, images, and strings on a graphical window.
Functions. ... Creates the graphics window on the screen.
drawArc(bounds, start, sweep). There
is a modern port for this Turbo C graphics interface, it's called WinBGIM, which emulates BGI graphics under MinGW/GCC.
#include<conio.h>
:-
Conio.h is a C header
file used mostly by MS-DOS compilers to provide console input/output. It is not
part of the C standard library or ISO C, nor is it defined by POSIX. This
header declares several useful library functions for performing "console
input and output" from a Program.
This header declares several
useful library functions for performing "console input and output"
from a program. Most C compilers that target DOS, Windows 3.x, Phar Lap
(company)|Phar Lap, DOSX, OS/2, or Win32 have this header and supply the associated library
functions in the default C library. Most C compilers that target UNIX and Linux
do not have this header and do not supply the library functions. Some embedded
systems are using a conio-compatible library
The library functions declared
by conio.h vary somewhat from compiler to compiler. As originally
implemented in Lattice C, the various functions mapped directly to the first
few DOS int 21h functions. But the library supplied with Borland's Turbo C
did not use the DOS API but instead accessed video RAM directly for output and
used BIOS interrupt calls; they also have additional functions inspired on the
successful Turbo Pascal library.
#include<Iostream.h>
:- In the C++ programming language, Input/output
library refers to a family of class templates and supporting functions in the C++ Standard Library that implement
stream-based input/output capabilities. It is an object-oriented alternative to
C's FILE-based streams from the C standard library. iostream - header is
used to access the input output built in functions of the language as it is the
the “Standard input/output streams library”. Here input-output refers to the
fact of taking input command and showing output result in the program.
“cin>>” , “cout<<” - these are the member objects of the
<iostream> header. The iostream library is an object-oriented
library that provides input and output functionality using streams. A stream is an abstraction that
represents a device in which input and ouput operations are performed.
#include<dos.h> :- Dos.h is
one among the header files . It contains functions for handling interrupts,
producing sound, date and time functions etc. It is a Borland specific and
works in turbo c compiler. Dos is a header file of C language. this header file will helps you createor delete
a directory or subdirectory and exit from the application etc it is more and
more important header file for the developers. DOS.h is a header file used to handle DOS commands (DISK
Operating system) in C/C++ programming environment.
#incule<math.h> math.h is a
header file in the standard library of the C programming language designed for
basic mathematical operations. Most of the functions involve the use of
floating point number. “math.h” header file supports all the mathematical related
functions in C language. math.h (
cmath header in C++). The functions that operate on integers, such as abs ,
labs , div , and ldiv , are instead defined in the stdlib.h header ( cstdlib header in C++). Any
functions that operate on angles use radians as the unit of angle.
#include<snap.h> :- SNAP stands for Stanford Network Analysis Platform which is
totally written in C++ and it can be embedded in your programs. If you looking
for a toolbox or library in C++ , which allows you to perform general network
analysis like calculating the shortest path or cluster coefficient then you can
use snap.h.
Basic Structure of Computer Graphics
Program
#Include<stdio.h>
#include<graphics.h>
// must be included for every graphic program
#include<conio.h>
#include<dos.h> // For
including delay function
Void main()
{
Int gd=DETECT,gm; // detect
best available graphics driver,,,gm=graphics mode
Initgraph(&gd ,
&gm,”C\\TC\\BGI”); // For initializing graph mode
//above 2 steps are must for
every graph program,
//declaration of any
variable must be done before calling initgraph() function.
//next write code for
producing requiring design or drawing object
Line(100,100,200,200); //
draw a line segment
getch();
}

No comments:
Post a Comment