[**πŸ‡¨πŸ‡³ δΈ­ζ–‡ζ–‡ζ‘£**](https://tonychan-hub.github.io/react-native-mask-segment-canvas/zh-CN/) --- # 🎨 react-native-mask-segment-canvas A React Native **0.79** interactive mask segmentation library combining **OpenCV** semantic layout + **Skia** GPU-accelerated texture painting. - 🧠 **OpenCV** (`react-native-fast-opencv`): mask semantic layout, baseboard patching, region extraction - πŸ–ŒοΈ **Skia RuntimeEffect (SkSL)**: single-pass LAB frequency-layer color blending - βœ‚οΈ **Skia Path**: dashed outline highlights per region - 🧲 **Magnetic Lasso**: manual wall partitioning with edge-snapping + Active Contour refinement --- ## πŸ“– Full Documentation **All API references, configuration guides, integration examples, and troubleshooting are maintained on the documentation site:** πŸ‘‰ **[https://tonychan-hub.github.io/react-native-mask-segment-canvas/](https://tonychan-hub.github.io/react-native-mask-segment-canvas/)** | Section | Description | |---|---| | [Overview](https://tonychan-hub.github.io/react-native-mask-segment-canvas/docs/intro) | Architecture & pipeline overview | | [Installation](https://tonychan-hub.github.io/react-native-mask-segment-canvas/docs/installation) | Peer deps, postinstall, Metro config | | [Basic Usage](https://tonychan-hub.github.io/react-native-mask-segment-canvas/docs/basic-usage) | Minimal example, state variables, watchState | | [API Reference](https://tonychan-hub.github.io/react-native-mask-segment-canvas/docs/api) | Props, ref methods, types, storage convention | | [Performance](https://tonychan-hub.github.io/react-native-mask-segment-canvas/docs/performance) | Benchmarks, optimization tips, pipeline config tuning | | [Troubleshooting](https://tonychan-hub.github.io/react-native-mask-segment-canvas/docs/troubleshooting) | Common issues & fixes | --- ## πŸ“¦ Quick Install ```bash npm install react-native-mask-segment-canvas ``` **Required peer dependencies:** ```bash npm install @shopify/react-native-skia react-native-reanimated \ react-native-fast-opencv react-native-fs buffer upng-js ``` Your host `package.json` must include `patch-package` in `postinstall`: ```json { "scripts": { "postinstall": "patch-package" }, "devDependencies": { "patch-package": "^8.0.1" } } ``` See the [Installation Guide](https://tonychan-hub.github.io/react-native-mask-segment-canvas/docs/installation) for full Metro configuration and troubleshooting duplicate module errors. --- ## πŸ§ͺ Example Project The [`example/`](example/) directory contains a complete consumer-side integration demo using only the public API β€” ideal as a template for your own project. ```bash cd example npm install cd ios && pod install && cd .. npm start ``` --- ## πŸ—οΈ Dev Demo The root `App.tsx` is a self-test demo that imports directly from `./src`: ```bash npm install cd ios && pod install && cd .. npm run ios # or `npm run android` ``` --- ## πŸ“ Project Structure ``` MaskSegmentApp/ β”œβ”€β”€ src/ # Library source β†’ published to npm β”‚ β”œβ”€β”€ index.ts β”‚ └── components/ / utils/ β”œβ”€β”€ docs/ # Docusaurus documentation site β”œβ”€β”€ example/ # Consumer-side integration demo β”œβ”€β”€ App.tsx # Dev self-test (imports from ./src) └── patches/ # patch-package patches for react-native-fast-opencv ```