Consider the following statements with respect to approaches to fill
2019
Consider the following statements with respect to approaches to fill area on raster systems:
π: To determine the overlap intervals for scan lines that cross the area
π: To start from a given interior position and pain outward from this point until we encounter the specified boundary conditions.
Select the correct answer from the options given below:
- A.
πΒ only
- B.
πΒ only
- C.
BothΒ πΒ andΒ π
- D.
NeitherΒ πΒ norΒ π
Attempted by 60 students.
Show answer & explanation
Correct answer: C
Answer: Both statements are correct β both approaches are used to fill areas on raster systems.
Scan-line fill (determine overlap intervals for scan lines):
For each horizontal scan line, compute intersections with the region boundary, sort the intersection x-coordinates, pair them, and fill the pixel spans between each pair.
Advantages: efficient for polygons with long horizontal spans and requires fewer per-pixel boundary checks.
Flood-fill (start from an interior point and paint outward):
Begin at a known interior pixel and iteratively (using a stack or queue) expand to neighboring pixels (4- or 8-connected) until boundary pixels stop further expansion.
Advantages: simple to implement and works for arbitrary shapes; disadvantages: can be memory- or recursion-intensive for large regions.
Conclusion: Both the scan-line interval method and the flood-fill method are valid approaches for filling areas on raster displays, so the correct choice is the one that states both are true.