Files
Zivro/Report/uml/polyline-fill-algorithm.puml
2026-03-19 14:54:09 +03:00

30 lines
687 B
Plaintext

@startuml
title Ломаная + заливка: 3-фазный алгоритм
start
:Input points[], closed, filled;
if (points < 2?) then (yes)
stop
endif
:Create temporary buffer + copy context;
if (closed and filled?) then (yes)
:Enable FillCanvas (startFill);
endif
:Draw all segments Pi->Pi+1;
if (closed?) then (yes)
:Draw segment Pn->P0;
endif
if (fill enabled?) then (yes)
:Phase 1:\nBorder pixels already collected in hash-set;
:Phase 2:\nSort border keys by (y,x),\nfind row segments,\nchoose interior seeds;
:Phase 3:\nStack flood fill (4-neighbors),\nskip border/visited,\npaint fill color;
endif
:Composite temporary buffer to target once;
stop
@enduml