 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can use fill poly function using foreground and background colors in graphics in C. Before starting, you can subscribe my YouTube channel by clicking on the link which is available at bottom right corner of this video. You can download my app Techimus that is available on Google Play. You can connect with me by following these details which are available in front of you. Now for demonstration purpose, I have included two header files, graphics and corner dot h. Then inside main function, gd and gm variables are declared. gd is initialized with detect. It will automatically detect the required graphics drivers. Then points arrays declared which is having certain points which are required to draw a polygon. An init graph function is used which will initialize graphics using graphics driver, graphics mode and graphics library. Graphics library is available at C, T, C and BGA. So this path is available. Now I have to use a function fill poly to draw a polygon. You can see I have passed two arguments inside fill poly function. First one is number of points and second is points array which is containing the coordinates. So you can see in points array, this is first point pair that are x, y coordinate. So polygon will start from 3, 20, 2, 150 coordinates. Then it will move to 4, 40, 3, 40 coordinates. Then from 4, 40, 3, 40 coordinates to 2, 30, 3, 40 coordinates. Then 2, 30, 3, 40, 0.2, 1, 1, 0, 2, 2, 0 point and from 1, 1, 0, 2, 2, 0, 0.2, 3, 20 and 150. So you can see first and last points coordinates are same. So it has total five points and four lines will be drawn for the polygon. So I have passed five and points array in fill poly. Now I am first executing this code. You can see four lines are drawn using five points. So this polygon starts from a particular point, then move to second point, then third point, then fourth point. From fourth point, polygon will move to first point again so that it can close its cycle. Now I will be applying colors on it. So first I am setting background color. That is blue using set BK color function. So you can see blue color has been set at background. Now I am applying foreground color that is red. So you can see its border is in red color. Now I am applying some fill style. So I am using set fill style function for that purpose. So first we have to check which fill styles are available. You can see this list. These fill styles are predefined. You can use any of the fill style from this list. So I am using line underscore fill and in green color. You can see the output. Background is blue. Foreground is red. So border of this polygon is in red color and it is filled with green color. So right now I have five points. That's why this polygon is drawn like this. If you want to add some more points, then you can also do that like you can apply some more points and you can change this five to six. Sorry, I have added an extra comma variable. Sorry comma. You can see the design now. It has total five lines and total six points. But two points beginning and ending points are same so that we can close this polygon. So friends, I hope with the help of this demonstration you have understood how you can draw a polygon that is filled with a style. It is having a background color. It is having a border color using foreground color and you can draw any number of points for polygon that I have demonstrated to you. If you want to watch more programming related videos, you can subscribe my YouTube channel. Thank you for watching this video.