Skip to content

feat: add draw.progress_bar overlay primitive#209

Draft
wkentaro wants to merge 3 commits into
mainfrom
feat/draw-progress-bar
Draft

feat: add draw.progress_bar overlay primitive#209
wkentaro wants to merge 3 commits into
mainfrom
feat/draw-progress-bar

Conversation

@wkentaro

Copy link
Copy Markdown
Owner

Summary

  • Add imgviz.draw.progress_bar(image, yx1, yx2, value, fill, background, outline=None) and its in-place pair progress_bar_, for inline horizontal progress bars (confidence indicators, quality scores, tile-sheet strips).
  • value is clamped to [0, 1]: 0 draws the track only, 1 fills it fully. Composes draw.rectangle_ (track + filled portion + optional outline); the fill rect is skipped at value 0 to avoid a zero-width rectangle.
  • Named outline (not border) and requires fill/background with no defaults, matching the rest of the draw module.

progress_bar

Test plan

  • tests added: tests/unit/draw/_progress_bar_test.py — value 0 (track only), value 1 (fully filled), half-fill pixel check, clamping (1.5 and -1.0), outline drawn at every fill level, outline does not overpaint the interior, and in-place mutation
  • example added: uv run python examples/progress_bar.py --save; README table refreshed via generate_readme.py
  • uv run pytest tests/unit/draw/_progress_bar_test.py — 11 passed
  • uv run ruff check / uv run ruff format --check / uv run ty check clean on touched files (incl. test + example)

Closes #132

@wkentaro wkentaro self-assigned this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add draw.progress_bar overlay primitive

1 participant