How to draw square to tag an object. (React Native)

后端 未结 2 1857
广开言路
广开言路 2021-01-01 03:34

I see many mobile apps having a feature that user can draw a square to indicate something to tag on the image.

I\'m building Face Tagging app and basical

2条回答
  •  萌比男神i
    2021-01-01 03:56

    You can use React Native ART library to draw shapes on top of image. It is a standard library that ships with React Native (although not linked to the binary by default).

    Regarding the algorithm:

    • Render an image
    • Overlay image with React Native's ART.Surface
    • Detect taps to get coordinates + overlay the rest of the image
    • Once you have coordinates of the tap, you can draw a shape you want
    • Stop drawing shape when user removes his finger (onPressOut event)

    Where to go from here:

    • Basic tutorial, explaining how to wire up React Native and ART
    • Unofficial(there no official one) documentation

提交回复
热议问题