Method for Android programming to realize camera copying effect

This paper describes the method of Android programming to realize the copying effect of camera. Share with you for your reference, as follows:

Combined with my development example, this article introduces how to realize the copying effect of the camera, that is, the picture taken by the camera is projected onto the drawing paper as the copied object, and the user can continue to draw on the drawing paper. The effect is shown in Figure 1

It can be divided into four steps. The first step is to add the license for the camera in the androidmanifest.xml file.

The second step is to use FrameLayout in the layout file, which can achieve the effect of overlapping two views, and ensure that the size and position of the two views are the same.

The surface view is used to dynamically display the current picture taken by the camera. In the third step, you need to turn on the camera and configure it, and then turn on the preview.

The fourth step is to change the background transparency of com.example.artist.paintview. Paintview is a view implemented by myself. Touch response and painting functions are carried out in ontouchevent function and OnDraw function respectively to respond to the view drawn by the user. The statement to set the background semi transparent is as follows.

In this way, the camera copy effect is realized, and it's done!

More readers interested in Android related content can view the special topics of this site: summary of Android photography and image processing skills, summary of Android graphics and image processing skills, introduction and advanced tutorial of Android development, summary of Android debugging skills and common problem solving methods, summary of Android basic component usage, summary of Android view skills , Android layout skills summary and Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>