# Brush Tool ## Description Manual brush selection for fallback when automatic detection fails. ## Acceptance Criteria - [ ] Brush tool available in toolbar - [ ] Brush size adjustable: 1-100px via slider - [ ] Brush size also adjustable via stepper (accessibility) - [ ] Touch draws on mask layer in real-time - [ ] Smooth stroke rendering (interpolate between touch points) - [ ] Brush preview circle follows finger - [ ] Erase mode toggle to remove from mask - [ ] Clear mask button to start over - [ ] Edge refinement optional: snap brush strokes to nearby edges - [ ] Mask preview shown in real-time as user paints - [ ] When done painting, user taps "Done" to proceed to inpaint - [ ] Pinch-to-zoom still works while brush active - [ ] Brush works with Apple Pencil (pressure sensitivity optional) - [ ] Performance: 60fps stroke rendering ## Technical Notes - Use Core Graphics or Metal for stroke rendering - Interpolate touch points with quadratic curves for smoothness - Edge refinement uses gradient magnitude from `EdgeRefinement.swift` - Consider separate gesture recognizer for drawing vs zoom/pan ## Edge Cases - Very fast strokes: ensure no gaps between points - Stroke at image edge: clamp to image bounds - Accidental touch: undo single stroke or clear all - Zoom while drawing: complete current stroke, then zoom