SlideShare une entreprise Scribd logo
1  sur  13
Télécharger pour lire hors ligne
Computer Graphics Lab
By Priya Goyal
How to run the graphics program in Turbo C++
• Open turbo C++
• Click on Option => Linker => Library
• Click on Graphics(mark it as ‘X’)
• Click on OK
Now you can run your graphics programs.
Basic functions to draw shapes in graphics
Shape Function syntax
pixel Draw a pixel Putpixel (X1,Y1,Color)
Line Draw a line Line(X1,Y1,X2,Y2)
Rectangle Draw a rectangle Rectangle(Left,Top,Right,Bottom)
Circle Draw a circle Circle(X,Y,Radius)
Ellipse Draw a ellipse Ellipse(X1,Y1,0,360,XaxisRadius,YaxisRadius)
Arc Draw a arc Arc(X1,Y1,StartingAngle,EndingAngle,Radius)
Bar Draw a filled rectangle Bar(Left,Top,Right,Bottom)
Bar3d Draw a filled 3d rectangle Bar3d(Left,Top,Right,Bottom,depth,topflag)
**topflag will be 0 or 1**
Here X1=distance of first point of shape from X axis,
X2=Distance of last point of shape from X axis
Here Y1=distance of first point of shape from Y axis,
Y2=Distance of last point of shape from Y axis
Structure of graphics program
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
……………………
…………………….
getch( );
closegraph( );
}
Location of BGI folder, where
display files are saved. Write the
location of (C:-TC-BGI)
Initialization of
graph
Draw a Pixel
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
Putpixel(100,100,RED)
getch( );
closegraph( );
}
Putpixel(X1,Y1,Color)
Draw a line
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
Line(100,100,200,200)
getch( );
closegraph( );
}
Line(X1,Y1,X2,Y2)
Draw a Rectangle
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
Rectangle(100,100,200,200)
getch( );
closegraph( );
}
rectangle(X1,Y1,X2,Y2)
Draw a circle
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
Circle(100,100,10)
getch( );
closegraph( );
}
circle(X1,Y1,radius)
Draw an ellipse
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
ellipse(100,100,0,360,20,10);
getch( );
closegraph( );
}
ellipse(x1,y1,0,360,xAxisRadius,yAxisRadius)
Draw an Arc
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
arc(100,100,90,280,10);
getch( );
closegraph( );
}
arc(x1,y1,StartingAngle,EndingAngle,Radius)
Draw a Bar
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
bar(100,100,200,200);
getch( );
closegraph( );
}
Bar(Left,Top,Right,Bottom)
Draw a 3D bar
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main( )
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:TCBGI");
bar3d(100,100,200,200,10,1);
getch( );
closegraph( );
}
Bar3d(left,top,right,bottom,depth,topflag)
Assignment
Q.1 Draw a flag using line and circle.
Q.2 Draw a hut using line, rectangle and circle.
Q.3 Draw a smiley face using ellipse, circle and arc.
Q.4 Draw a fish using arc, circle and line.

Contenu connexe

Tendances

Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphicsSHIVANI SONI
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 
GRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONSGRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONSManojit Chakraborty
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary treeKrish_ver2
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceRamla Sheikh
 
Breadth first search and depth first search
Breadth first search and  depth first searchBreadth first search and  depth first search
Breadth first search and depth first searchHossain Md Shakhawat
 
Topological Sorting
Topological SortingTopological Sorting
Topological SortingShahDhruv21
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformationUdayan Gupta
 
Knowledge representation in AI
Knowledge representation in AIKnowledge representation in AI
Knowledge representation in AIVishal Singh
 
Multi dimensional turing machine
Multi dimensional turing machineMulti dimensional turing machine
Multi dimensional turing machineNiteshSingh405
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
Graphics software and standards
Graphics software and standardsGraphics software and standards
Graphics software and standardsMani Kanth
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithmPooja Dixit
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clippingMani Kanth
 

Tendances (20)

Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
strong slot and filler
strong slot and fillerstrong slot and filler
strong slot and filler
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Parse Tree
Parse TreeParse Tree
Parse Tree
 
GRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONSGRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONS
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial Intelligence
 
Splay Tree
Splay TreeSplay Tree
Splay Tree
 
Breadth first search and depth first search
Breadth first search and  depth first searchBreadth first search and  depth first search
Breadth first search and depth first search
 
Topological Sorting
Topological SortingTopological Sorting
Topological Sorting
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
 
Knowledge representation in AI
Knowledge representation in AIKnowledge representation in AI
Knowledge representation in AI
 
Multi dimensional turing machine
Multi dimensional turing machineMulti dimensional turing machine
Multi dimensional turing machine
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Graphics software and standards
Graphics software and standardsGraphics software and standards
Graphics software and standards
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 

En vedette

Computer Graphics Practical
Computer Graphics PracticalComputer Graphics Practical
Computer Graphics PracticalNeha Sharma
 
Computer Graphics Programes
Computer Graphics ProgramesComputer Graphics Programes
Computer Graphics ProgramesAbhishek Sharma
 
SE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneSE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneBhavesh Shah
 
Lecture on graphics
Lecture on graphicsLecture on graphics
Lecture on graphicsRafi_Dar
 
Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)Tushar B Kute
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualAnkit Kumar
 
Graphics in C programming
Graphics in C programmingGraphics in C programming
Graphics in C programmingKamal Acharya
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++thesaqib
 
Course plan computer graphics lab
Course plan computer graphics labCourse plan computer graphics lab
Course plan computer graphics labaa11bb11
 
Computer graphics
Computer graphics Computer graphics
Computer graphics shafiq sangi
 
Gfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manualGfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manualPrabindh Sundareson
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsKetan Jani
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 

En vedette (20)

Computer Graphics Practical
Computer Graphics PracticalComputer Graphics Practical
Computer Graphics Practical
 
Computer Graphics Programes
Computer Graphics ProgramesComputer Graphics Programes
Computer Graphics Programes
 
Graphics Programming in C
Graphics Programming in CGraphics Programming in C
Graphics Programming in C
 
Introduction to graphics programming in c
Introduction to graphics programming in cIntroduction to graphics programming in c
Introduction to graphics programming in c
 
SE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneSE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of Pune
 
Lecture on graphics
Lecture on graphicsLecture on graphics
Lecture on graphics
 
Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)
 
Graphics in C++
Graphics in C++Graphics in C++
Graphics in C++
 
Unit 11. Graphics
Unit 11. GraphicsUnit 11. Graphics
Unit 11. Graphics
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Graphics in C programming
Graphics in C programmingGraphics in C programming
Graphics in C programming
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Course plan computer graphics lab
Course plan computer graphics labCourse plan computer graphics lab
Course plan computer graphics lab
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
Gfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manualGfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manual
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
 
Graphics point clipping c program
Graphics point clipping c programGraphics point clipping c program
Graphics point clipping c program
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Cg lab cse-v (1) (1)
Cg lab cse-v (1) (1)Cg lab cse-v (1) (1)
Cg lab cse-v (1) (1)
 

Similaire à Basics of Computer graphics lab

Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignmentAbdullah Al Shiam
 
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdfbfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdfshehabhamad_90
 
Computer Graphics in Java and Scala - Part 1b
Computer Graphics in Java and Scala - Part 1bComputer Graphics in Java and Scala - Part 1b
Computer Graphics in Java and Scala - Part 1bPhilip Schwarz
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimediasaranyan75
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivessaranyan75
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++Ankit Kumar
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicalsManoj Chauhan
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graphkinan keshkeh
 
Circles graphic
Circles graphicCircles graphic
Circles graphicalldesign
 
Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3Jay Coskey
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1aravindangc
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4Roziq Bahtiar
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics FunctionsSHAKOOR AB
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programsAmit Kapoor
 

Similaire à Basics of Computer graphics lab (20)

Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdfbfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf
 
Computer Graphics in Java and Scala - Part 1b
Computer Graphics in Java and Scala - Part 1bComputer Graphics in Java and Scala - Part 1b
Computer Graphics in Java and Scala - Part 1b
 
7. chapter vi
7. chapter vi7. chapter vi
7. chapter vi
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimedia
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitives
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicals
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
 
Circles graphic
Circles graphicCircles graphic
Circles graphic
 
Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
Primitives
PrimitivesPrimitives
Primitives
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 

Dernier

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 

Dernier (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 

Basics of Computer graphics lab

  • 2. How to run the graphics program in Turbo C++ • Open turbo C++ • Click on Option => Linker => Library • Click on Graphics(mark it as ‘X’) • Click on OK Now you can run your graphics programs.
  • 3. Basic functions to draw shapes in graphics Shape Function syntax pixel Draw a pixel Putpixel (X1,Y1,Color) Line Draw a line Line(X1,Y1,X2,Y2) Rectangle Draw a rectangle Rectangle(Left,Top,Right,Bottom) Circle Draw a circle Circle(X,Y,Radius) Ellipse Draw a ellipse Ellipse(X1,Y1,0,360,XaxisRadius,YaxisRadius) Arc Draw a arc Arc(X1,Y1,StartingAngle,EndingAngle,Radius) Bar Draw a filled rectangle Bar(Left,Top,Right,Bottom) Bar3d Draw a filled 3d rectangle Bar3d(Left,Top,Right,Bottom,depth,topflag) **topflag will be 0 or 1** Here X1=distance of first point of shape from X axis, X2=Distance of last point of shape from X axis Here Y1=distance of first point of shape from Y axis, Y2=Distance of last point of shape from Y axis
  • 4. Structure of graphics program #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); …………………… ……………………. getch( ); closegraph( ); } Location of BGI folder, where display files are saved. Write the location of (C:-TC-BGI) Initialization of graph
  • 5. Draw a Pixel #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); Putpixel(100,100,RED) getch( ); closegraph( ); } Putpixel(X1,Y1,Color)
  • 6. Draw a line #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); Line(100,100,200,200) getch( ); closegraph( ); } Line(X1,Y1,X2,Y2)
  • 7. Draw a Rectangle #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); Rectangle(100,100,200,200) getch( ); closegraph( ); } rectangle(X1,Y1,X2,Y2)
  • 8. Draw a circle #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); Circle(100,100,10) getch( ); closegraph( ); } circle(X1,Y1,radius)
  • 9. Draw an ellipse #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); ellipse(100,100,0,360,20,10); getch( ); closegraph( ); } ellipse(x1,y1,0,360,xAxisRadius,yAxisRadius)
  • 10. Draw an Arc #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); arc(100,100,90,280,10); getch( ); closegraph( ); } arc(x1,y1,StartingAngle,EndingAngle,Radius)
  • 11. Draw a Bar #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); bar(100,100,200,200); getch( ); closegraph( ); } Bar(Left,Top,Right,Bottom)
  • 12. Draw a 3D bar #include<graphics.h> #include<stdio.h> #include<conio.h> void main( ) { int gd = DETECT, gm; initgraph(&gd, &gm, "C:TCBGI"); bar3d(100,100,200,200,10,1); getch( ); closegraph( ); } Bar3d(left,top,right,bottom,depth,topflag)
  • 13. Assignment Q.1 Draw a flag using line and circle. Q.2 Draw a hut using line, rectangle and circle. Q.3 Draw a smiley face using ellipse, circle and arc. Q.4 Draw a fish using arc, circle and line.