Example
Fill a triangle one horizontal scanline at a time.
highlighted = computed this step
Step 1 — Set up
Use scanlines across this triangle.
△ABC: (2,1), (6,5), (1,5)
Step 2 — Scanline A
Fill the integer pixels on this scanline.
y=1, xL=2, xR=2, fill (1,2)
Step 3 — Scanline B
Fill the integer pixels on this scanline.
y=2, xL=47, xR=3, fill (2,2), (2,3)
Step 4 — Scanline C
Fill the integer pixels on this scanline.
y=3, xL=23, xR=4, fill (3,2), (3,3), (3,4)
Step 5 — Scanline D
Fill the integer pixels on this scanline.
y=4, xL=45, xR=5, fill (4,2), (4,3), (4,4), (4,5)
Step 6 — Scanline E
Fill the integer pixels on this scanline.
y=5, xL=1, xR=6, fill (5,1), (5,2), (5,3), (5,4), (5,5), (5,6)
Step 7 — Result
The filled triangle pixel set is complete.
triangle pixels complete
scanline-fill-triangle
A scanline fill finds the left and right edge intersections for a row, then fills the integer pixels between them.