FileDocCategorySizeDatePackage
Camera.javaAPI DocAndroid 5.1 API5028Thu Mar 12 22:22:30 GMT 2015android.graphics

Camera

public class Camera extends Object
A camera instance can be used to compute 3D transformations and generate a matrix that can be applied, for instance, on a {@link Canvas}.

Fields Summary
private Matrix
mMatrix
long
native_instance
Constructors Summary
public Camera()
Creates a new camera, with empty transformations.

        nativeConstructor();
    
Methods Summary
public voidapplyToCanvas(Canvas canvas)
Computes the matrix corresponding to the current transformation and applies it to the specified Canvas.

param
canvas The Canvas to set the transform matrix onto

        if (canvas.isHardwareAccelerated()) {
            if (mMatrix == null) mMatrix = new Matrix();
            getMatrix(mMatrix);
            canvas.concat(mMatrix);
        } else {
            nativeApplyToCanvas(canvas.getNativeCanvasWrapper());
        }
    
public native floatdotWithNormal(float dx, float dy, float dz)

protected voidfinalize()

        try {
            nativeDestructor();
        } finally {
            super.finalize();
        }
    
public native floatgetLocationX()
Gets the x location of the camera.

see
#setLocation(float, float, float)

public native floatgetLocationY()
Gets the y location of the camera.

see
#setLocation(float, float, float)

public native floatgetLocationZ()
Gets the z location of the camera.

see
#setLocation(float, float, float)

public voidgetMatrix(Matrix matrix)
Computes the matrix corresponding to the current transformation and copies it to the supplied matrix object.

param
matrix The matrix to copy the current transforms into

        nativeGetMatrix(matrix.native_instance);
    
private native voidnativeApplyToCanvas(long native_canvas)

private native voidnativeConstructor()

private native voidnativeDestructor()

private native voidnativeGetMatrix(long native_matrix)

public native voidrestore()
Restores the saved state, if any.

see
#restore()

public native voidrotate(float x, float y, float z)
Applies a rotation transform around all three axis.

param
x The angle of rotation around the X axis, in degrees
param
y The angle of rotation around the Y axis, in degrees
param
z The angle of rotation around the Z axis, in degrees
see
#rotateX(float)
see
#rotateY(float)
see
#rotateZ(float)

public native voidrotateX(float deg)
Applies a rotation transform around the X axis.

param
deg The angle of rotation around the X axis, in degrees
see
#rotateY(float)
see
#rotateZ(float)
see
#rotate(float, float, float)

public native voidrotateY(float deg)
Applies a rotation transform around the Y axis.

param
deg The angle of rotation around the Y axis, in degrees
see
#rotateX(float)
see
#rotateZ(float)
see
#rotate(float, float, float)

public native voidrotateZ(float deg)
Applies a rotation transform around the Z axis.

param
deg The angle of rotation around the Z axis, in degrees
see
#rotateX(float)
see
#rotateY(float)
see
#rotate(float, float, float)

public native voidsave()
Saves the camera state. Each save should be balanced with a call to {@link #restore()}.

see
#save()

public native voidsetLocation(float x, float y, float z)
Sets the location of the camera. The default location is set at 0, 0, -8.

param
x The x location of the camera
param
y The y location of the camera
param
z The z location of the camera

public native voidtranslate(float x, float y, float z)
Applies a translation transform on all three axis.

param
x The distance to translate by on the X axis
param
y The distance to translate by on the Y axis
param
z The distance to translate by on the Z axis