Boundary fill

Boundary fill

In computer graphics, Boundary fill, or Boundary-fill is an algorithm used to fill an area with a specified color. The algorithm works by filling an area with a specified color until the specified boundary color is encoutered. It is similar to the Flood fill algorithm.

The algorithm

The algorithm works by starting in a specified point (x,y), filling that point with the specified fill color if it is not a boundary and recursively continuing with the 4 or eight closest neighbours. The example below uses the 4 closest neighbours.

void boundaryFill(int x, int y, int fill, int boundary) { int current; current = getPixel(x, y); if ((current != boundary) && (current != fill)) { setColor(fill); setPixel(x, y); boundaryFill(x+1, y, fill, boundary); boundaryFill(x-1, y, fill, boundary); boundaryFill(x, y+1, fill, boundary); boundaryFill(x, y-1, fill, boundary); } }

Other Uses

The Boundary fill algorithm can also be used in games like SameGame, in which same color adjacent blocks must be destroyed.

External links

* [http://www.siggraph.org/education/materials/HyperGraph/scanline/outprims/polygn6a.htm Boundary Fill Algorithm]
* [http://www.mtsu.edu/~dhr2c/FillAlg.html Fill Algorithms]


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Flood fill — Flood fill, also called seed fill, is an algorithm that determines the area connected to a given node in a multi dimensional array. It is used in the bucket fill tool of paint programs to determine which parts of a bitmap to fill with color, and… …   Wikipedia

  • Divergent boundary — In plate tectonics, a divergent boundary or divergent plate boundary (also known as a constructive boundary or an extensional boundary) is a linear feature that exists between two tectonic plates that are moving away from each other. Divergent… …   Wikipedia

  • Concentric crater fill — is when the floor of a crater is mostly covered with a large number of parallel ridges.[1] It is common in the mid latitudes of Mars, and is widely believed to be caused by glacial movement. Areas on Mars called Deuteronilus Mensae and Protonilus …   Wikipedia

  • Algoritmo de relleno por difusión — Este artículo es una traducción del equivalente en inglés, y aún no está completo. Algoritmo recursivo de 4 direcciones. El algoritmo de relleno por difusión, también llamado algoritmo de relleno, o directamente del inglés floodfill determina el… …   Wikipedia Español

  • закрашивание замкнутой области — Заполнение замкнутой области изображения определенным цветом или штриховкой. [http://www.morepc.ru/dict/] Тематики информационные технологии в целом EN boundary fill …   Справочник технического переводчика

  • Hayward Fault Zone — The Hayward Fault Zone is a geologic fault zone capable of generating significantly destructive earthquakes. About 60 kilometers long, it lies mainly along the western base of the hills on the east side of San Francisco Bay. It runs through… …   Wikipedia

  • India — /in dee euh/, n. 1. Hindi, Bharat. a republic in S Asia: a union comprising 25 states and 7 union territories; formerly a British colony; gained independence Aug. 15, 1947; became a republic within the Commonwealth of Nations Jan. 26, 1950.… …   Universalium

  • river — river1 riverless, adj. riverlike, adj. /riv euhr/, n. 1. a natural stream of water of fairly large size flowing in a definite course or channel or series of diverging and converging channels. 2. a similar stream of something other than water: a… …   Universalium

  • GEOGRAPHICAL SURVEY — Names The name Ereẓ Israel (the Land of Israel) designates the land which, according to the Bible was promised as an inheritance to the Israelite tribes. In the course of time it came to be regarded first by the Jews and then also by the… …   Encyclopedia of Judaism

  • Geology of Mars — Mars   Mars as seen by the Hubble Space Telescope Designations …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”