Skip to content

feat(mosaic): support multiple mosaic styles (pixel, blur, frosted, solid) - #6

Merged
idoubi merged 1 commit into
thinkany-ai:devfrom
xysamuel:feat/mosaic-styles
Oct 13, 2026
Merged

idoubi merged 1 commit into
thinkany-ai:devfrom
xysamuel:feat/mosaic-styles

Conversation

@xysamuel

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for 5 distinct mosaic styles:

  • Box · Pixelate (框选 · 像素马赛克): Drag a rectangular region with crisp pixelation blocks.
  • Box · Blur (框选 · 高斯模糊): Drag a rectangular region with smooth Gaussian blur.
  • Box · Frosted Glass (框选 · 毛玻璃): Drag a rectangular region with a milky veil and hairline border.
  • Box · Solid Color (框选 · 色块遮挡): Drag a solid color block matching the chosen palette color.
  • Brush · Pixelate (涂抹 · 像素马赛克): Classic freehand pixelate brush stroke.

Highlights

  1. Style Selection:
    • Added style popup selector in the capture overlay toolbar when mosaic is active.
    • Added style dropdown in the background image editor toolbar.
    • Preserves user choice across sessions via editor.mosaicStyle.
  2. Restyling:
    • Selecting an existing mosaic annotation and changing the style dropdown seamlessly restyles it while preserving coverage bounds.
  3. History Compatibility:
    • Adds mosaicStyle to Annotation coding keys.
    • Backwards compatible: older entries without mosaicStyle automatically fall back to .brush. Unknown future styles safely fallback without failing decoding.
  4. Testing:
    • Includes full unit test suite MosaicStyleTests.swift covering rendering distinction, solid coloring, blur contrast, history serialization/fallback, restyle conversions, and editor undo/drag behavior.
    • All tests pass via ./scripts/test-mosaic.sh.

@idoubi
idoubi merged commit 944f23a into thinkany-ai:dev Oct 13, 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.

2 participants