0% found this document useful (0 votes)
48 views18 pages

Group 8 CGR Micro

The document describes how to design a Taj Mahal using graphics programming in C. It includes functions used to draw different shapes and text, the methodology which divides the drawing into components, and sample code to create a representation of the Taj Mahal by combining basic geometric shapes and lines.

Uploaded by

Samarjeet Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views18 pages

Group 8 CGR Micro

The document describes how to design a Taj Mahal using graphics programming in C. It includes functions used to draw different shapes and text, the methodology which divides the drawing into components, and sample code to create a representation of the Taj Mahal by combining basic geometric shapes and lines.

Uploaded by

Samarjeet Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Dr.D.Y.

Patil Polytechnic Kasaba Bawada Taj Mahal

1.Introduction
 Graphics programming in C used to drawing various geometrical shapes (rectangle,
circle eclipse etc.), use of mathematical function in drawing curves,.

 Coloring an object with different colors and patterns and simple animation programs.

In Turbo C graphics the graphics.h functions are used to draw different shapes(like a
circle, rectangle, etc).

 display text(any message) in different formats (different fonts and colors). By using
graphics.h programs, animations, and also games can be designed. These can be useful
for beginners.

Then two Rectangles are made using the rectangle() function. I Smaller Rectangle a Door
ismadebyusingtheline()function.

 Then the Onion Dome is made by using the arc() function. On that Dome, a finial is
created by using line() functions.

2. Rationale:
Computer graphics is an art of drawing pictures, lines, charts, etc using computer
with the help of programs and software. Transformation is used to modify the current shape
or object in a particular manner. In computer graphics translation is the straight line
movement of an object from one position to another is called as translation

1
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

3. Aim of the project-


To Design a Tajmahal

Benefits:
1. Able to use various functions of computer graphics to design a program.

4. Course Outcomes Addressed:

1. You can Learn how to use graphics function to draw a shape and create visual design.
2. It showcases the creativity and artist side of programming by drawing a represent of The
Taj mahal.

2
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

5. Literature Review-

Sr. Title of book Author Major concept


No
1. Computer John F.Hughes To implement circle and line function.
Graphics
Principles and
practice in C

2. computer Donald Develop program for 2D translation


graphics with Hearn.M.Pauline transformation
open GL. Baker

3
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

6. Actual Methodology Followed:

 Include necessary header files: The program includes several header files, such as
iostream.h, conio.h, dos.h, stdlib.h, and graphics.h, to access various functions and
libraries.

 Initialize the graphics mode: It uses initgraph to initialize the graphics mode and set up
the graphics window.

 Draw the various components of the Taj Mahal:

 Lines: It uses the line function to draw straight lines.

 Rectangle: rectangle is used to draw rectangular shapes.

 Ellipse: ellipse is used to draw ellipses.

 Circles: circle is used to draw circles.

 Text: outtextxy is used to display text on the screen.

 The program divides the drawing into various sections, starting with the lower structures,
the pool, and the upper structures. Each part is drawn by using a combination of lines,
rectangles, ellipses, and circles.

 The text "TAJ MAHAL" is displayed at the top left corner using outtextxy.

 The program uses basic geometric shapes and lines to create a representation of the Taj
Mahal. Keep in mind that this code is quite old and uses a library that might not be
supported in modern compilers. It's essential to use more contemporary graphics libraries
like OpenGL or SDL for modern graphical applications.

4
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

7. To Draw a Taj mahal we used concept Like:-

Function Description

Line It is used to draw a line with co-ordinates (x,y).

Circle It used to draw a circle with radius (r), and with


co-ordinates (x,y).

outtextxy It displays test or string at a specified point (x,y)

setfillstyle It sets the current fill pattern and fill color

rectangle Used to draw rectangle by providing the co-


ordinates.

8. Algorithm:
5
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

Step 1: start

Step 2: Include necessary header files for graphics and input/output.

Step 3: Initialize the graphics mode using the initgraph function.

Step 4: Draw the outline of the Taj Mahal, which includes rectangles and lines to represent the
structure.

Step 5: Use various ellipse and line functions to draw details of the Taj Mahal, like windows and
patterns.

Step 6: Draw the reflection pool on the left and right sides.

Step 7: Set the text style and display the title "TAJ MAHAL" on the screen.

Step 8: Wait for user input with getch () and close the graphics window when a key is pressed.

Step 9: Return 0 to indicate successful execution.

Step 10: Stop.

9. Flowchart:

6
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

7
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

10. Actual resources used:

Sr. Name of Specifications


No. resource

1. Computer Computer System


System 1. storage 2000GB
2. RAM 3GB and onwards

2. Software Turbo c

8
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

11. Program code:

#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\turboc3\\bgi");
rectangle(1,450,620,470);
line(10,450,12,380);
line(40,450,38,380);
line(9,380,41,380);
line(9,375,41,375);
ellipse(10,377,90,270,3,3);
ellipse(41,378,270,90,3,3);
line(12,375,14,320);
line(38,375,36,320);
// ellipse(25,331,0,360,12,2.5);
line(11,320,39,320);
line(11,315,39,315);
ellipse(11,318,90,270,3,2);
ellipse(39,318,270,90,3,2);
line(14,315,16,250);
line(36,315,34,250);
// ellipse(25,268,0,360,10,4);
ellipse(25,244,20,200,11,6);

9
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

ellipse(25,245,200,10,11,6);
line(17,239,17,227);
line(33,239,33,227);
line(14,227,37,227);
ellipse(14,224,90,270,3,3);
ellipse(36,224,270,90,3,3);
ellipse(25,220,0,180,10,13);
line(25,207,25,197);
//right
line(580,450,582,380);
line(610,450,608,380);
line(578,380,612,380);
line(578,375,612,375);
ellipse(579,377,90,270,3,3);
ellipse(612,378,270,90,3,3);
line(582,375,584,320);
line(608,375,606,320);
line(581,320,611,320);
line(581,315,611,315);
ellipse(581,318,90,270,3,2);
ellipse(611,318,270,90,3,2);
line(584,315,586,250);
line(606,315,604,250);
// ellipse(25,268,0,360,10,4);
ellipse(595,245,20,200,11,6);
ellipse(595,246,200,10,11,6);
line(585,242,585,227);
line(603,242,603,227);

10
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

line(583,227,605,227);
ellipse(583,224,90,270,3,3);
ellipse(605,224,270,90,3,3);
ellipse(594,220,0,180,10,13);
line(593,207,593,197);
rectangle(245,340,345,450);
rectangle(235,330,355,450);
line(263,390,263,450);
line(330,390,330,450);
ellipse(297, 390,0,180,34,34);
rectangle(235,325,355,330);
line(235,317,235,325);
line(355,317,355,325);
ellipse(295,316,0,180,60,9);
ellipse(295,270, 320,220,75,75);
line(260,203,290,180);
line(330,203,290,180);
circle(290,178,3);
ellipse(290,168,0,360,2,6);
ellipse(290,158,0,360,1,4);
line(290,148,290,155);
rectangle(355,345,420,450);
line(460,363,460,450);
line(416,345,460,363);
line(397,397,370,397);
line(370,397,370,366);
line(397,397,397,366);
ellipse(383,374,30,150,15,15);

11
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

line(370,424,370,450);
line(397,424,397,450);
ellipse(383,432,30,150,15,15);
line(430,397,450,397);
line(450,397,450,376);
line(430,397,430,376);
ellipse(440,385,30,150,11,15);
line(450,424,450,450);
line(430,424,430,450);
ellipse(440,432,30,150,11,15);
line(401,318,401,344);
ellipse(378,327,40,130,34,12);
line(361,309,406,309);
line(406,309,403,318);
ellipse(383,334,30,89,24,50);
ellipse(381,338,85,120,26,55);
line(383,274,382,282);
line(383,274,385,284);
//left
rectangle(235,345,165,450);
line(125,363,125,450);
line(165,345,125,363);
line(185,397,211,397);
line(185,397,185,366);
line(211,397,211,366);
ellipse(198,374,30,150,15,15);
line(185,424,185,450);
line(211,424,211,450);

12
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

ellipse(198,432,30,150,15,15);
line(135,397,155,397);
line(135,397,135,376);
line(155,397,155,376);
ellipse(145,385,30,150,11,15);
line(135,424,135,450);
line(155,424,155,450);
ellipse(145,432,30,150,11,15);
line(189,318,189,344);
ellipse(212,327,45,130,34,12);
line(187,309,230,309);
line(187,309,190,318);
ellipse(217,310,100,180,26,32);
ellipse(210,319,70,85,26,40);
line(212,270,209,280);
line(212,270,215,280);
//pool left
line(112,450,110,415);
line(84,450,86,415);
line(83,415,113,415);
line(83,410,113,410);
ellipse(82,412,90,270,3,2);
ellipse(113,412,270,90,3,2);
line(86,410,88,370);
line(110,410,108,370);
// ellipse(25,331,0,360,12,2.5);
line(86,370,110,370);
line(86,365,110,365);

13
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

ellipse(86,368,90,270,3,2);
ellipse(110,368,270,90,3,2);
line(88,365,90,335);
line(108,365,106,335);
// ellipse(25,268,0,360,10,4);
ellipse(98,330,20,200,11,6);
ellipse(98,330,200,10,11,6);
line(90,327,90,314);
line(106,327,106,314);
line(87,314,109,314);
ellipse(87,311,90,270,3,3);
ellipse(109,311,270,90,3,3);
ellipse(98,307,0,180,10,13);
line(98,295,98,284);
// right
line(474,450,475,420);
line(500,450,498,420);
line(472,415,500,415);
line(472,420,500,420);
ellipse(472,418,90,270,3,2);
ellipse(500,418,270,90,3,2);
line(475,415,477,375);
line(498,415,496,375);
// ellipse(25,331,0,360,12,2.5);
line(474,374,499,374);
line(474,370,499,370);
ellipse(473,372,90,270,3,2);
ellipse(499,372,270,90,3,2);

14
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

line(495,369,493,340);
line(476,369,478,340);
// ellipse(25,268,0,360,10,4);
ellipse(485,334,20,200,11,6);
ellipse(485,334,200,10,11,6);
line(478,329,478,317);
line(492,329,492,317);
line(496,316,474,316);
ellipse(473,312,90,270,3,3);
ellipse(495,312,270,90,3,3);
ellipse(484,309,0,180,10,13);
line(484,295,484,284);
settextstyle(6,0,3);
//draw by samarjeet patil
outtextxy(1,1,"Group No 8");
getch();
closegraph();
getch();
}

15
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

12.Output Of Program

16
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

13.Skill Devolopment/Lerning Outcome of This Micro-Project

1. Graphics Programming: This program introduces you to basic graphics programming in


C/C++. It uses functions like initgraph, line, ellipse, and rectangle to draw shapes and
patterns. This is a valuable skill if you're interested in graphical user interface (GUI)
development or game development.

2. Text Handling: Although the primary focus is on graphics, the program also demonstrates
how to display text on the screen using outtextxy. This is useful for creating user interfaces
and providing textual information in graphical applications.

134 Application of this micro project :


Historical and Cultural Representation: The code specifically draws the Taj Mahal, which is
an iconic historical monument. It can be used as part of an educational presentation or
application that provides information about this monument.

17
Dr.D.Y.Patil Polytechnic Kasaba Bawada Taj Mahal

15. References:
1.E-book-Computer Graphics Principal and practice in C –john F.Hughes.

2. https://youtu.be/N6dnTnJsayM

3.https://www.geeksforgeeks.org/translation-objects-computer-graphics-reference-added-
pleasereview/.

18

You might also like