SlideShare a Scribd company logo
Introduction to Graphics
Introduction
• There are two modes of output device:
– Text Mode
– Graphics Mode
Graphics Characteristics
• Pixels
• Resolutions
• Colors
• Video Adapters
Initializing Graphics Mode
• We use initgraph() function
• Syntax:
– Intigraph(&graphics_driver,&graphics_mode,Path
_to_driver);
Closing Graphics Mode
• Function closegraph() is used.
• Syntax:
– closegraph();
Sample Program
Error Handling
• graphresult() function is used to check if
certain graphics operation succeeded or not.
• It return 0 for no error.
Graphics in C programming
Some Functions in Graphics
• putpixel() and getpixel()
• setcolor() and setbcolor()
• line()
• circle()
• ellipse
• rectangle()
• settextstyle() and outtext()
• getmaxx() and getmaxy()
putpixel() and getpixel()
• Syntax:
– int getpixel(int x, int y);
– void putpixel(int x, int y, int color);
• getpixel returns the color of pixel present at
point(x, y).
• putpixel plots a pixel at a point(x, y) of
specified color.
setbcolor()
• Syntax :-
– void setbkcolor(int color);
• setbkcolor function changes current
background color e.g. setbkcolor(YELLLOW)
changes the current background color to
YELLOW.
• Remember that default drawing color is
WHITE and background color is BLACK.
setcolor()
• Syntax :-
– void setcolor(int color);
• setcolor function changes current drawing
color e.g. setcolor(YELLLOW) changes the
current drawing color to YELLOW.
line()
• line function is used to draw a line from a
point(x1,y1) to point(x2,y2)
• Syntax :-
– void line(int x1, int y1, int x2, int y2);
circle()
• Syntax :-
– void circle(int x, int y, int radius);
• Circle function is used to draw a circle with
center (x,y) and third parameter specifies the
radius of the circle.
ellipse()
• Syntax :-
– void ellipse(int x, int y, int stangle, int endangle, int
xradius, int yradius);
• Ellipse is used to draw an ellipse (x,y) are
coordinates of center of the ellipse, stangle is
the starting angle, end angle is the ending
angle, and fifth and sixth parameters specifies
the X and Y radius of the ellipse.
rectangle()
• Syntax:-
– void rectangle(int left, int top, int right, int
bottom);
• Coordinates of left top and right bottom
corner are required to draw the rectangle.
settextstyle()
• Syntax :-
– void settextstyle( int font, int direction, int
charsize);
• font argument specifies the font of text,
Direction can be HORIZ_DIR (Left to right) or
VERT_DIR (Bottom to top).
outtext()
• outtext function displays text at current
position.
• Syntax :-
– void outtext(char *string);
getmaxx() and getmaxy()
• getmaxx function returns the maximum X
coordinate for current graphics mode and
driver.
• Declaration :- int getmaxx();
• getmaxy function returns the maximum Y
coordinate for current graphics mode and
driver.
• Declaration :- int getmaxy();
Graphics in C programming
Graphics in C programming
Ad

More Related Content

What's hot (20)

Graphics in C++
Graphics in C++Graphics in C++
Graphics in C++
Ahsan Mughal
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
Mani Kanth
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
SHIVANI SONI
 
2d transformation
2d transformation2d transformation
2d transformation
Sarkunavathi Aribal
 
Bresenham circle
Bresenham circleBresenham circle
Bresenham circle
Taher Barodawala
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
Mani Kanth
 
Function in C program
Function in C programFunction in C program
Function in C program
Nurul Zakiah Zamri Tan
 
Illumination Models & Shading
Illumination Models & ShadingIllumination Models & Shading
Illumination Models & Shading
International Institute of Information Technology (I²IT)
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive
SachiniGunawardana
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
Timbal Mayank
 
BEC007 -Digital image processing.pdf
BEC007  -Digital image processing.pdfBEC007  -Digital image processing.pdf
BEC007 -Digital image processing.pdf
gopikahari7
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
Mohanlal Sukhadia University (MLSU)
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
Mohd Arif
 
Type conversion
Type conversionType conversion
Type conversion
Frijo Francis
 
Functions in C
Functions in CFunctions in C
Functions in C
Kamal Acharya
 
3 d transformation
3 d transformation3 d transformation
3 d transformation
Mani Kanth
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...
Mani Kanth
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.
Girish Ghate
 
Type conversion
Type  conversionType  conversion
Type conversion
PreethaPreetha5
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
NANDINI SHARMA
 

Viewers also liked (20)

Graphics Programming in C
Graphics Programming in CGraphics Programming in C
Graphics Programming in C
Kasun Ranga Wijeweera
 
Computer Graphics Practical
Computer Graphics PracticalComputer Graphics Practical
Computer Graphics Practical
Neha Sharma
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
SHAKOOR AB
 
Computer Graphics Applications
Computer Graphics ApplicationsComputer Graphics Applications
Computer Graphics Applications
Saravana Priya
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
Deepak Kumar Mohapatra
 
Basics of Computer graphics lab
Basics of Computer graphics labBasics of Computer graphics lab
Basics of Computer graphics lab
Priya Goyal
 
Applications of computer graphics
Applications of computer graphicsApplications of computer graphics
Applications of computer graphics
-jyothish kumar sirigidi
 
Lecture on graphics
Lecture on graphicsLecture on graphics
Lecture on graphics
Rafi_Dar
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
Kamal Acharya
 
computer graphics
computer graphicscomputer graphics
computer graphics
ashpri156
 
Introduction to Computer graphics
Introduction to Computer graphics Introduction to Computer graphics
Introduction to Computer graphics
PrathimaBaliga
 
applications of computer graphics
applications of computer graphicsapplications of computer graphics
applications of computer graphics
Aaina Katyal
 
WordPress for Beginners, the Missing Guide
WordPress for Beginners, the Missing GuideWordPress for Beginners, the Missing Guide
WordPress for Beginners, the Missing Guide
WPBrix.com
 
WordPress A - Z for beginners
WordPress A - Z for beginnersWordPress A - Z for beginners
WordPress A - Z for beginners
Ferdias Ramadoni
 
1 c – graphic designs
1 c – graphic designs1 c – graphic designs
1 c – graphic designs
Haseeb Patel
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
amitsarda3
 
Parm
ParmParm
Parm
parmsidhu
 
Array and string
Array and stringArray and string
Array and string
prashant chelani
 
Bitwise operators
Bitwise operatorsBitwise operators
Bitwise operators
Puneet Rajput
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
gourav kottawar
 
Computer Graphics Practical
Computer Graphics PracticalComputer Graphics Practical
Computer Graphics Practical
Neha Sharma
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
SHAKOOR AB
 
Computer Graphics Applications
Computer Graphics ApplicationsComputer Graphics Applications
Computer Graphics Applications
Saravana Priya
 
Basics of Computer graphics lab
Basics of Computer graphics labBasics of Computer graphics lab
Basics of Computer graphics lab
Priya Goyal
 
Lecture on graphics
Lecture on graphicsLecture on graphics
Lecture on graphics
Rafi_Dar
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
Kamal Acharya
 
computer graphics
computer graphicscomputer graphics
computer graphics
ashpri156
 
Introduction to Computer graphics
Introduction to Computer graphics Introduction to Computer graphics
Introduction to Computer graphics
PrathimaBaliga
 
applications of computer graphics
applications of computer graphicsapplications of computer graphics
applications of computer graphics
Aaina Katyal
 
WordPress for Beginners, the Missing Guide
WordPress for Beginners, the Missing GuideWordPress for Beginners, the Missing Guide
WordPress for Beginners, the Missing Guide
WPBrix.com
 
WordPress A - Z for beginners
WordPress A - Z for beginnersWordPress A - Z for beginners
WordPress A - Z for beginners
Ferdias Ramadoni
 
1 c – graphic designs
1 c – graphic designs1 c – graphic designs
1 c – graphic designs
Haseeb Patel
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
amitsarda3
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
gourav kottawar
 
Ad

Similar to Graphics in C programming (20)

Powerpointpresentation.c
Powerpointpresentation.cPowerpointpresentation.c
Powerpointpresentation.c
Maqbool Ur Khan
 
Cg lab cse-v (1) (1)
Cg lab cse-v (1) (1)Cg lab cse-v (1) (1)
Cg lab cse-v (1) (1)
Surya Sukumaran
 
Unit 11. Graphics
Unit 11. GraphicsUnit 11. Graphics
Unit 11. Graphics
Ashim Lamichhane
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
aravindangc
 
Matlab intro
Matlab introMatlab intro
Matlab intro
fvijayami
 
Lecture 02 visualization and programming
Lecture 02   visualization and programmingLecture 02   visualization and programming
Lecture 02 visualization and programming
Smee Kaem Chann
 
10 linescan
10 linescan10 linescan
10 linescan
Praveen Kumar
 
Primitives
PrimitivesPrimitives
Primitives
Nageswara Rao Gottipati
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
Fabio506452
 
Efficient realization for geometric transformation of digital images in run l...
Efficient realization for geometric transformation of digital images in run l...Efficient realization for geometric transformation of digital images in run l...
Efficient realization for geometric transformation of digital images in run l...
Shlomo Pongratz
 
Lec2
Lec2Lec2
Lec2
Amba Research
 
Presentation: Plotting Systems in R
Presentation: Plotting Systems in RPresentation: Plotting Systems in R
Presentation: Plotting Systems in R
Ilya Zhbannikov
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
Mohammed Romi
 
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptxDIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
MdMojnuMiah3
 
CG-Lecture3.pptx
CG-Lecture3.pptxCG-Lecture3.pptx
CG-Lecture3.pptx
lakshitasarika2014
 
september11.ppt
september11.pptseptember11.ppt
september11.ppt
CharlesMatu2
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
AvinashJain66
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
snelkoli
 
MATLAB & Image Processing
MATLAB & Image ProcessingMATLAB & Image Processing
MATLAB & Image Processing
Techbuddy Consulting Pvt. Ltd.
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
Mattupallipardhu
 
Powerpointpresentation.c
Powerpointpresentation.cPowerpointpresentation.c
Powerpointpresentation.c
Maqbool Ur Khan
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
aravindangc
 
Matlab intro
Matlab introMatlab intro
Matlab intro
fvijayami
 
Lecture 02 visualization and programming
Lecture 02   visualization and programmingLecture 02   visualization and programming
Lecture 02 visualization and programming
Smee Kaem Chann
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
Fabio506452
 
Efficient realization for geometric transformation of digital images in run l...
Efficient realization for geometric transformation of digital images in run l...Efficient realization for geometric transformation of digital images in run l...
Efficient realization for geometric transformation of digital images in run l...
Shlomo Pongratz
 
Presentation: Plotting Systems in R
Presentation: Plotting Systems in RPresentation: Plotting Systems in R
Presentation: Plotting Systems in R
Ilya Zhbannikov
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
Mohammed Romi
 
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptxDIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
MdMojnuMiah3
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
AvinashJain66
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
snelkoli
 
Ad

More from Kamal Acharya (20)

Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
Kamal Acharya
 
Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
Kamal Acharya
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer Security
Kamal Acharya
 
Session and Cookies
Session and CookiesSession and Cookies
Session and Cookies
Kamal Acharya
 
Functions in php
Functions in phpFunctions in php
Functions in php
Kamal Acharya
 
Web forms in php
Web forms in phpWeb forms in php
Web forms in php
Kamal Acharya
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHP
Kamal Acharya
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
Kamal Acharya
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
Kamal Acharya
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Kamal Acharya
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data Warehousing
Kamal Acharya
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
Kamal Acharya
 
Search Engines
Search EnginesSearch Engines
Search Engines
Kamal Acharya
 
Web Mining
Web MiningWeb Mining
Web Mining
Kamal Acharya
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data Mining
Kamal Acharya
 
Cluster Analysis
Cluster AnalysisCluster Analysis
Cluster Analysis
Kamal Acharya
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data Mining
Kamal Acharya
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
Kamal Acharya
 
Data Preprocessing
Data PreprocessingData Preprocessing
Data Preprocessing
Kamal Acharya
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data Warehousing
Kamal Acharya
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
Kamal Acharya
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer Security
Kamal Acharya
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHP
Kamal Acharya
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
Kamal Acharya
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
Kamal Acharya
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data Warehousing
Kamal Acharya
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data Mining
Kamal Acharya
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data Mining
Kamal Acharya
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
Kamal Acharya
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data Warehousing
Kamal Acharya
 

Recently uploaded (20)

World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 

Graphics in C programming

  • 2. Introduction • There are two modes of output device: – Text Mode – Graphics Mode
  • 3. Graphics Characteristics • Pixels • Resolutions • Colors • Video Adapters
  • 4. Initializing Graphics Mode • We use initgraph() function • Syntax: – Intigraph(&graphics_driver,&graphics_mode,Path _to_driver);
  • 5. Closing Graphics Mode • Function closegraph() is used. • Syntax: – closegraph();
  • 7. Error Handling • graphresult() function is used to check if certain graphics operation succeeded or not. • It return 0 for no error.
  • 9. Some Functions in Graphics • putpixel() and getpixel() • setcolor() and setbcolor() • line() • circle() • ellipse • rectangle() • settextstyle() and outtext() • getmaxx() and getmaxy()
  • 10. putpixel() and getpixel() • Syntax: – int getpixel(int x, int y); – void putpixel(int x, int y, int color); • getpixel returns the color of pixel present at point(x, y). • putpixel plots a pixel at a point(x, y) of specified color.
  • 11. setbcolor() • Syntax :- – void setbkcolor(int color); • setbkcolor function changes current background color e.g. setbkcolor(YELLLOW) changes the current background color to YELLOW. • Remember that default drawing color is WHITE and background color is BLACK.
  • 12. setcolor() • Syntax :- – void setcolor(int color); • setcolor function changes current drawing color e.g. setcolor(YELLLOW) changes the current drawing color to YELLOW.
  • 13. line() • line function is used to draw a line from a point(x1,y1) to point(x2,y2) • Syntax :- – void line(int x1, int y1, int x2, int y2);
  • 14. circle() • Syntax :- – void circle(int x, int y, int radius); • Circle function is used to draw a circle with center (x,y) and third parameter specifies the radius of the circle.
  • 15. ellipse() • Syntax :- – void ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius); • Ellipse is used to draw an ellipse (x,y) are coordinates of center of the ellipse, stangle is the starting angle, end angle is the ending angle, and fifth and sixth parameters specifies the X and Y radius of the ellipse.
  • 16. rectangle() • Syntax:- – void rectangle(int left, int top, int right, int bottom); • Coordinates of left top and right bottom corner are required to draw the rectangle.
  • 17. settextstyle() • Syntax :- – void settextstyle( int font, int direction, int charsize); • font argument specifies the font of text, Direction can be HORIZ_DIR (Left to right) or VERT_DIR (Bottom to top).
  • 18. outtext() • outtext function displays text at current position. • Syntax :- – void outtext(char *string);
  • 19. getmaxx() and getmaxy() • getmaxx function returns the maximum X coordinate for current graphics mode and driver. • Declaration :- int getmaxx(); • getmaxy function returns the maximum Y coordinate for current graphics mode and driver. • Declaration :- int getmaxy();