Skip to main content

Graphics


Computer graphics is one of the most powerful and interesting aspects of computers. There is a lot that we can do in graphics apart from drawing figures of various shapes. All video games, animation, multimedia predominantly works with computer graphics. To work with graphics, C has various library functions. Some of built in functions which are defined within header file graphics.h are illustrated in this chapter.
Let us see one example which demonstrates graphics initialization and some built in functions related to graphics.

#include<graphics.h>
void main()
{
int gDriver=DETECT,gMode;
int polyArray[]={200,100,250,150,300,200,350,200,300,150,200,100};
initgraph(&gDriver,&gMode,"c:\\tc\\bgi");
setcolor(GREEN);
line(200,100,300,250); /*line from (200,100) to (300,250) */
circle(300,300,50); /*circle at center (300,300) having radius 50 */
ellipse(150,200,0,360,100,50);           /* ellipse at center (150,200) and angle from 0 to              
                                                             360 and the xradius 100, yradius 50*/
arc(200,300,300,90,80);  /* arc having center at (200,300) and radius 80 from starting
                                           angle 300 to end angle 90 */
rectangle(50,100,350,400);  /* rectangle of diagonal points at (50,100) and (350,400)*/
drawpoly(6,polyArray); /* polygon of 6 corner points*/
getch();
closegraph();

}

Comments

Popular posts from this blog

What is manipulator in C++?

Answer: Manipulators are special functions that can be included in the I/O statement to alter the format parameters of a stream. Table-2 shows some important manipulator functions that are frequently used. To access these manipulators, the file < iomanip.h > should be included in program.                               Table-2               Manipulators                                                    Equivalent ios function               set...

Network Topology

A network topology is the arrangement of the computers cable and other components on a network. The major goal of network topology is to find out the most economical and efficient way to connect all the users to the network resources while providing adequate capacity to handle users demand, maintain system reliability and decrease the delay.    Topology is the map of physical network. The type of topology we use defect the type and capabilities network hardware’s its management and possibilities for future expansion. There are many types of network topology, some of these are:   Bus Topology Star Topology Mesh Topology   Ring Topology Tree Topology

What is Servlet in Java?

A servlet is a small program that executes on a server. Just as applets dynamically extend the functionality of a web browser, servlets dynamically extend the functionality of a web server. It is helpful to understand that as useful as applets can be, they are just one half of the client/server equation. Not long after the initial release of Java, it became obvious that Java would also be useful on the server side. The result was the servlet. Thus, with the advent of the servlet, Java spanned both sides of the client/server connection.