 Everyone, Myself, Darshan Pandit, Assistant Professor, Department of Computer Science and Engineering from Walton Institute of Technology, Solapur. Today we are going to discuss about basic drawing function in computer graphics. So here at the end of this session student will be able to draw different graphical object using C functions. So in this lecture we are going to see how to draw polygon, bar, pie slice, sector. So here function to draw polygon, so the polygon is any two dimensional shape formed with straight lines, rectangle, quadrilateral, pentagon and hexagon are examples of polygon. So here with a given set of points we need to draw the polygon. So in this way we need to declare an array which includes all set of points. So int x1, y1 will give you one point, int x2, y2 will give you one another point, int x3, y3 will give you a third point and int again x1, y1. So in polygon one thing you have to remember starting point and the end point should be same. So that will form a closed object. So here we are using these functions drawPoly which has parameter int number of points int array name. So number of points is nothing but so in above array how many points we have used. So we need to specify that number of points and name of array that is point that we have to specify here in array name. So just we will see the example. So here we need to include the set of files that is graphics.h, conio.h after that we need to declare graphics driver and graphics mode and here we are declaring array in which we are specifying number of points that to be used to draw the polygon. So here we have used 500, 200, 400, 600, 200 and again 1500. So this is the, so here first and last point are same. So after that we are initializing the graphics driver and graphics mode and we are specifying the path of BGI. So after that drawPoly function in which we are specifying number of points. So here number of points are 4, 1, 2nd, 3rd and 4th. So these are the 4 points and name of array is point. So that we have declared in drawPoly function. So after that gets here and close graph. So this will give you output in this way. So by using drawPoly function the polygon will be drawn. So here we are having another way to draw polygon with a given set of points. So that is instead of using drawPoly we may use fillPoly function that draws the polygon and fills the polygon. The parameters are same, we need to specify point array that is array after that. In array we need to declare set of points so that we have declared after that instead of using drawPoly we have to use fillPoly functions. And parameters are same like drawPoly that is int number of points and int array name. Just we will see the example. So here we have used fillPoly instead of drawPoly. So this fillPoly function will fill the polygon and also it will draw the polygon with a given points 320, 150, 440, 340, 230, 340, 320 and 140, 150. So this is first and last point are same. So here in this way you will get the polygon which is a solid filled polygon. So how many points are required to draw polygon? So you can answer, so how many points we need to pass in a drawPoly function or how many points required to draw a polygon? So here n plus 1 points are required for n number of vertices of polygon. So the polygon should have at least three sides and angle and if polygon suppose if polygon is having three vertices then four points are required to draw a polygon as start and end points are same that is start and end point are repeated. So the next function is how to draw bar? So bar is used for drawing bar charts. So here we need to pass x1, y1, so here bar int left, int top, int right and int bottom. So here left is nothing but x1, top is y1, right is x2, bottom is y2. So here you can see, so this is x1, y1 and here x2, y2. So let us see example. So here bar, so in this we have passed x1, y1 and x2, y2 that is 50, 100, 200, 400. Again second bar it will be drawn using this coordinate 250, 100, 400, 300. So third bar will be drawn using this coordinate 450, 100, 600, 200. So in this way you will get the output. So three different bars you will get based on the specified coordinates. So next function is to draw a pie slice. So this will be helpful when you are drawing pie charts. So it requires a parameter int x, int y, int st angle that is int starting angle, int end angle, int radius. So here you are having x and y that is from where you need to draw the pie slice. So here you are having starting angle, this is the end angle and this is the radius. So when you specify this parameter pie slice will be drawn. So let us see the example. So here we have drawn pie slice with x200, y200. Starting angle is 90, end angle is 0 degree with the radius 100. And another pie slice with coordinate x coordinate 400, y coordinate 300, starting angle 90, end angle 360 and 100. So this will give you the output in this way. So this is 90 and this is 0 degree and here starting angle is 90 and end angle is 360. So function to draw sector. So in sector same like we need to pass int x, int y, int starting angle, int end angle and with this we need to pass int x radius, int y radius. So this will draw a sector and it will fill the sector from center. So an example we have drawn sector with the point 300, 300 and starting angle is 180, end angle is 0, x radius is 100, y radius is 200. So this will draw a field sector in this way. So these are the references used to prepare this PPT. Thank you.