Background There are two Camera classes in Android. One is android.hardware.Camera, which is used to operate the device's camera. The other is android.graphics.Camera, which can be used to perform 3D transformations and then apply the transformed matrix Matrix to Canvas, etc. This article will introduce this Camera class. Camera As we mentioned before, Camera is a class that can perform 3D transformations. After performing 3D transformations, we can assign the transformation matrix Matrix through mCamera.getMatrix(Matrix) and then use it on Canvas. Alternatively, you can directly apply the transformation to a Canvas through mCamera.applyToCanvas(Canvas). Three-dimensional coordinate axes in Android The 3D coordinate axes in Android conform to the left-handed coordinate system. The default position of the Camera is (0, 0, -8). Camera transformation operations
Camera does not have many methods, so it is relatively simple and clear to use. Camera usage examples Since the core of using Camera is to obtain a transformed Matrix, you need to have a certain understanding of Matrix. Demo1 3D ViewGroup Demo Camera is used for custom animation Here is a code example. The usage is essentially the same as the previous example. Both use the Camera transformation to obtain the Matrix matrix.
Summarize The use of Camera is not complicated. You just need to remember the methods mentioned above. Since Camera eventually outputs a matrix, you also need to have a certain understanding of the matrix. I have given a quick guide to using the matrix above, and you can refer to it according to your situation. |
<<: Summary of Android methods to avoid memory overflow (Out of Memory)
>>: Technology Post: How to apply AI natively to Android system
Written in front: Did iPhone copy the appearance ...
There are two types of customization for Xiangyan...
What is the price list for renting servers outsid...
[[424470]] Preface In the previous article, we ex...
When you look at the rows of brightly colored fru...
During the spring equinox, the sun is shining and...
When it comes to thin and light notebooks, the &q...
Physics defines "time" as a unit of mea...
Othello is also known as Othello, which is named ...
Among all the factors that affect a company's...
October 16, 2021 00:23 Shenzhou 13 manned spacecr...
First, let's look at the time when several sy...
In recent years , craft beer has become popular i...
Today I have compiled 12 tips for Sogou SEM opera...
In order to better serve different countries and ...