0% found this document useful (0 votes)
5 views21 pages

CGMM

The document is a practical file for the Computer Science and Engineering department at Shri Vaishnav Vidyapeeth Vishwavidyalaya, submitted by Chetan Bargal for the CGMM subject. It includes explanations of various graphics functions in C programming, such as drawing shapes, lines, and circles, along with their syntax. Additionally, it outlines tasks such as using graphic functions creatively and implementing line and circle drawing algorithms.

Uploaded by

Disha Dhamdhere
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)
5 views21 pages

CGMM

The document is a practical file for the Computer Science and Engineering department at Shri Vaishnav Vidyapeeth Vishwavidyalaya, submitted by Chetan Bargal for the CGMM subject. It includes explanations of various graphics functions in C programming, such as drawing shapes, lines, and circles, along with their syntax. Additionally, it outlines tasks such as using graphic functions creatively and implementing line and circle drawing algorithms.

Uploaded by

Disha Dhamdhere
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/ 21

SHRI VAISHNAV VIDYAPEETH

VISHWAVIDHYALAYA

DEPARTMENT OF COMPUTER SCIENCE & ENGG.


SESSION: 2022-2023

CGMM Practical File

Submitted By: Chetan Bargal


Enrolment No.: 20100BTCSDSI07267
Section: CSE-M
Sem/Year: 5th Sem / 3rd Year
Branch: DS

Subject: CGMM
Subject Code: BTCS503
Submitted to: Prof. Manorama Chouhan
CGMM LAB FILE
Q1. What is Graphic.h?
Graphics programming in C used to drawing various geometrical shapes (rectangle, circle
eclipse etc), use of mathematical function in drawing curves, colouring an object with different
colours and patterns and simple animation programs like jumping ball and moving cars. There
are the following functions: -

1. ARC- "arc" function is used to draw an arc with centre (x, y) and ‘strangle’ specifies
starting angle, ‘endangle’ specifies the end angle and last parameter specifies the
radius of the arc. arc function can also be used to draw a circle but for that starting
angle and end angle should be 0 and 360 respectively.
2. BAR- Bar function is used to draw a 2-dimensional, rectangular filled in bar.
Coordinates of left top and right bottom corner are required to draw the bar. Left
specifies the X- coordinate of top left corner, top specifies the Y-coordinate of top left
corner, right specifies the X-coordinate of right bottom corner, bottom specifies the Y-
coordinate of right bottom corner. Current fill pattern and fill colour is used to fill the
bar.
3. CIRCLE - Circle function is used to draw a circle with centre (x, y) and third
parameter specifies the radius of the circle.

Syntax: void circle (int x, int y, int radius);


4. CLEARDEVICE- cleardevice function clears the screen in graphics mode and sets the
current position to (0,0). Clearing the screen consists of filling the screen with
current background colour.

Syntax: void cleardevice ();


5. CLOSEGRAPH- ‘closegraph’ function closes the graphics mode, deallocates all memory
allocated by graphics system and restores the screen to the mode it was in before
you called ‘initgraph’.
SYNTAX: void closegraph ();

6. LINE - line function is used to draw a line from a point (x1, y1) to point (x2, y2) i.e. (x1,
y1) and (x2, y2) are end points of the line.
Syntax: void line (int x1, int y1, int x2, int y2);
7. ELLIPSE- Ellipse is used to draw an ellipse (x, y) are coordinates of centre 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. To draw a complete ellipse
strangles and end angle should be 0 and 360 respectively.
Syntax: void ellipse (int x, int y, int stangle, int endangle, int x-radius, int y-radius);
8. FILLELLIPSE- x and y are coordinates of centre of the ellipse, x-radius and y-radius are x
and y radius of ellipse respectively.
Syntax: void fillellipse (int x, int y, int x-radius, int y-radius);
Q2. PutPixel Function
Putpixel function plots a pixel at location (x, y) of specified colour. For example, if we want to
draw a GREEN coloured pixel at (35, 45) then we will write putpixel (35, 35, GREEN). In c
programs, putpixel function can be used to draw circles, lines and ellipses using various
algorithms.
Q3. Graphic Image using PutPixel.
Q4. Use minimum 10 graphic functions to create something creative.
Q5. Implementation of DDA line drawing algorithm.
Q6. Implementation of Bresenham’s Line Drawing Algorithms.
Q7. Mid-Point circle drawing theorem.
Q8. Bresenhams Circle drawing algorithm

You might also like