Implementing flood fill - Implementing flood fill Paint...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Implementing flood fill Paint programs often offer a flood fill function. When you click a point, the entire region around the point is painted with your selected color. How does this work? Bitmaps A bitmap is a two-dimensional array, where each entry corresponds to the color of one pixel . A pixel (“picture element”) is a little square on the screen. There are different ways to specify color (a typical way is to use 8 bits each for red, green, and blue intensity information, so 24 bits in total). We will assume that the color is an int . To compute the region containing the clicked pixel, we need to define which pixels are “neighbors”. We use the convention that pixels have four neighbors: up, down, left, and right. We do not consider the diagonally adjacent pixels as neighbors. The first algorithm - using recursion The first thing to perform flood filling is remembering the old color of the pixel to be painted. Pixels with the old color would be filled, and other pixels take a role of a boundary. Then we color the pixel, and we seethe old color would be filled, and other pixels take a role of a boundary....
View Full Document

This note was uploaded on 04/20/2010 for the course CS CS206 taught by Professor Lee during the Fall '09 term at 카이스트, 한국과학기술원.

Page1 / 2

Implementing flood fill - Implementing flood fill Paint...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online