---
title: "Boundary fill vs flood fill"
subject: "Computer Graphics"
chapter: 2
key: "semester_5/computer_graphics:boundary-fill-vs-flood-fill"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/boundary-fill-vs-flood-fill
site: BCT Engineering
---

# Boundary fill vs flood fill

Computer Graphics · Chapter 2: Scan-Conversion

- Asked in: 2081 Chaitra (new course), 3 marks
- Video: [Boundary Fill and Flood Fill Algorithm](https://www.youtube.com/watch?v=OQr8jxnU_eo) — compedu
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/boundary-fill-vs-flood-fill
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-2

## Question

Differentiate between boundary fill and flood fill algorithm.

## Short answer

Boundary fill fills until a specified boundary color is reached, requiring a uniformly colored border. Flood fill replaces all pixels of an old interior color with a new color, stopping at any boundary color regardless of its uniformity.

## Answer

Both are area-filling algorithms that start from a seed pixel and spread to neighbouring pixels (4-connected or 8-connected).

| Point | Boundary fill | Flood fill |
|---|---|---|
| Region defined by | A closed boundary of a single colour | An interior area of one colour (any boundary colours) |
| Stop condition | Stops when boundary colour is reached | Stops when a pixel is not of the old (interior) colour |
| Use | Region has a uniformly coloured boundary | Region has multi-coloured boundary or irregular interior |
| Test | pixel ≠ boundary colour and ≠ fill colour | pixel = old interior colour |
| Result | Fills interior up to the boundary | Replaces the old colour by the new colour |
| Example | Colouring inside a drawn polygon outline | Paint-bucket tool of image editors |

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Boundary fill stops spreading when:
   A. it reaches pixels of the boundary colour
   B. it meets a pixel not equal to the old interior colour
   C. it has filled 4 pixels
   D. the seed colour changes
   Answer: A. Flood fill is the one that tests for the old interior colour. (Key point: Stop condition)

2. Flood fill replaces a pixel only if:
   A. it differs from the boundary colour and the fill colour
   B. it is on the boundary
   C. it has the old interior colour
   D. it is a seed pixel only
   Answer: C. Flood fill recolours the connected region of one old colour. (Key point: Flood fill test)

3. Which region suits flood fill rather than boundary fill?
   A. A polygon outline drawn in a single colour
   B. A region with a multi-coloured boundary, like the paint-bucket tool
   C. Any rectangular area
   D. A filled circle
   Answer: B. Boundary fill needs a uniformly coloured boundary. (Key point: When to use)

## Related in Computer Graphics

- [DDA versus Bresenham line algorithm](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Adda-vs-bresenham-line) — Computer Graphics, chapter 2, asked 6×
- [Cohen-Sutherland: two lines vs window A-D](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acohen-sutherland-two-lines-window-a) — Computer Graphics, chapter 3

## Related in other subjects

- [Centralized vs Ricart-Agrawala algorithm](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Acentral-vs-ra-compare) — Distributed System, chapter 6
- [Bully algorithm vs ring algorithm](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aelection-bully-ring) — Distributed System, chapter 6
- [Constructive and destructive boundary; Himalaya formation](https://www.bctengineer.com/question.md?key=semester_3%2Fengineering_geology_i%3Aconstructive-and-destructive-boundary-himalaya) — Engineering Geology I, chapter 2
- [Transform versus divergent plate boundary](https://www.bctengineer.com/question.md?key=semester_3%2Fengineering_geology_i%3Atransform-versus-divergent-plate-boundary) — Engineering Geology I, chapter 2
