CGR Microproject PDF
CGR Microproject PDF
CGR Microproject PDF
A
MICRO PROJECT REPORT
ON
“BOUNDARY FILL
ALGORITHM”
PROGRAM-CGR
COURSE CODE-313014
Submitted by,
MSBTE, Mumbai.
414 005(M.S)
3
CERTIFICATE
This is to certify that the micro project report
entitled
“BOUNDARY FILL
ALGORITHM”
Submitted by,
ACKNOWLEDGEMENT
1)Shaikh Samiya
2)Jindam Kalyani
3)Tanushri Gudur
4)ravija nagare
6
TITLE OF MICRO-PROJECT:-
INDEX
1 INTRODUCTION 4-5
5 OUTPUT 12
6 CONCLUSION 13
7 PROJECT OUTCOMES 14
1.INTRODUCTION
7
The Boundary Fill algorithm is a popular computer graphics technique used for filling
closed areas with colors or patterns. It’s often employed for tasks like coloring regions
in a drawing or rendering, such as filling the interior of polygons.
1. Objective: The primary goal of the Boundary Fill algorithm is to determine a set of
boundary pixels that enclose a closed region and fill the interior of that region with a
specified color.
2. How It Works:
- It begins at a seed point (a known point inside the region) and checks the
neighboring pixels.
- If the neighboring pixel is not already filled and lies within the boundary (i.e., its
color matches the boundary color), it fills that pixel with the desired color and adds its
unprocessed neighbors to a stack.
- The process continues until there are no more unprocessed pixels in the stack.
3. Use Cases: Boundary Fill is often used in applications like graphic design software,
where users can fill the interior of a shape with a specific color, or in paint programs
for “bucket fill” operations.
4. Boundary Conditions: The algorithm may need careful handling for issues like
recursive filling and preventing “spillover” into neighboring regions. One common
approach is to use a 4-connected or 8-connected approach to define what constitutes a
neighboring pixel.
A5. Seed Point Selection: The accuracy of the fill depends on selecting a suitable
seed point inside the region. The choice of the seed point can affect the efficiency and
correctness of the algorithm.
6. Limitations: The Boundary Fill algorithm may not work well for concave shapes or
regions with holes, as it can fill the entire space connected to the seed point.
7. Variants: Variants of this algorithm include the Flood Fill algorithm, which is
similar but fills an area with a boundary based on a different criterion, and the
Scanline Fill algorithm, which fills an area by scanning lines.
ALGORITHM
1. Start at a seed pixel (x, y) inside the area you want to fill.
6. Continue this process until the stack is empty, and all connected pixels of the same
color are filled with the new color.
7. The algorithm is complete when the entire region has been filled.
It’s important to note that this algorithm might not handle complex cases, such as
regions with holes, and may not be efficient for large areas. To improve efficiency and
handle more complex scenarios, you may need to consider more advanced algorithms
like the scanline fill or flood fill algorithms.
9
ALGORITHM:-
ALGORITHM
The boundary fill algorithm is used to fill a closed region in computer graphics. To fill
an 8-connected pixel region using this algorithm, you can follow these steps:
It’s important to ensure that you have proper termination conditions to stop the
recursion to avoid infinite loops. Also, you might want to implement some form of
boundary checking to avoid going outside the image boundaries.
Algorithm :
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
void boundfill(int xc, int yc, int r, int b)
{
int cur;
cur = getpixel(xc, yc);
if (cur != b && cur != r)
{
putpixel(xc, yc, r);
delay(1);
boundfill(xc + 1, yc, r, b);
boundfill(xc - 1, yc, r, b);
boundfill(xc, yc + 1, r, b);
boundfill(xc, yc - 1, r, b);
}
}
void main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, “..\\bgi”);
rectangle(100, 100, 300, 300);
boundfill(105, 105, 4, WHITE);
getch();
closegraph();
}
5.OUTPUT
12
13
6.CONCLUSION
IN computer graphichs when we use boundry fill algorithm , decding fill algorithm
decinding which oixels are considered neighbors is crucial . the concept of 8-
connected pixels allow the algorithm to connect and fill more and more
comprehensively across the graphics canvas
ANNEXURE II
Evolution Sheet for the Micro Project
Academic Year: 2024-25 Name of Faculty: Prof.Padir Mam
1. Computer system
2. Create, edit and save document.
3. Document Page Layout.
(b) Unit outcomes in Cognitive domain:
Roll
Student Name Marks out Marks out of 4 for Total out
No.
of 6 for performace in oral
performace presentation Of 10
in group
activity
1 Samiya Shaikh
2 Jindam Kalyani
3 Tanushri Gudur
4 Ravija nagare