Professional Documents
Culture Documents
CGR 5
CGR 5
CGR 5
Practical no 5
Aim: Program to fill Polygon.
Course Outcome: Implement standard algorithms to draw various graphics objects using C.
Practical Outcome: Write a program to fill Polygon using Flood fill algorithm.
Theory:
In Flood fill algorithm we start with some seed and examine the neighbouring pixels, however pixels are
checked for a specified interior colour instead of boundary colour and is replaced by a new colour. It can
be done by using 4 connected or 8 connected region method.
Algorithm:
Step 1. Start
Step 4. Call flood fill function by passing coordinate values of polygon. Eg, flood(219,
205).
Step 6: End
Subject: Computer Graphics (22318) Omkar Dorugade
Practical no 5
Flow Chart:
Start
If
True False
(getpixel(x,y)
!=RED)
Stop
Subject: Computer Graphics (22318) Omkar Dorugade
Practical no 5
C Program Code:
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
void main ()
setcolour (RED);
rectangle (200,200,220,220);
getch ();
closegraph();
If (getpixel x,y)!=RED)
*************************************Output******************************************
Subject: Computer Graphics (22318) Omkar Dorugade
Practical no 5