1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| procedure TQxGCore.FloodFill(p: TQxPoint); begin if (p.x < 0) or (p.x >= fsystem.screen.w) or (p.y < 0) or (p.y >= fsystem.screen.h) then exit; if fsystem.status <> stRunning then exit; HlpFloodFill(p.x, p.y, getPixel(p.x, p.y)); end;
procedure TQxGCore.HlpFloodFill(x, y, c: cardinal); begin setPixel(x, y, getR(brush.color), getG(brush.color), getB(brush.color)); if x > 0 then if getPixel(x - 1, y) = c then HlpFloodFill(x - 1, y, c); if x < fsystem.width - 1 then if getPixel(x + 1, y) = c then HlpFloodFill(x + 1, y, c); if y > 0 then if getPixel(x, y - 1) = c then HlpFloodFill(x, y - 1, c); if y < fsystem.height - 1 then if getPixel(x, y + 1) = c then HlpFloodFill(x, y + 1, c); end; |