Android Camera - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Camera class.

This code example shows how to use the following methods:getMatrix, restore, rotateX, rotateY, rotateZ
        final float rX = mRotationX;
        final float rY = mRotationY;
        final float rZ = mRotationZ;
        if ((rX != 0) || (rY != 0) || (rZ != 0)) {
            final Camera camera = mCamera;
            camera.save();
            camera.rotateX(rX);
            camera.rotateY(rY);
            camera.rotateZ(-rZ);
            camera.getMatrix(m);
            camera.restore();
            m.preTranslate(-pX, -pY);
            m.postTranslate(pX, pY);
        } 
 
        final float sX = mScaleX;
        final float sY = mScaleY;
        if ((sX != 1.0f) || (sY != 1.0f)) {
            m.postScale(sX, sY);
            final float sPX = -(pX / w) * ((sX * w) - w);
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMatrix, restore, rotateY, save, translate
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMatrix, restore, rotateY, save
This code example shows how to use the following methods:getMatrix, restore, rotateY, save, translate
This code example shows how to use the following methods:getMatrix, restore, rotateZ, save, translate
    protected void applyTransformation(float t, Transformation xf) {
        Matrix xform = xf.getMatrix();
 
        float z = ((dir > 0) ? 0.0f : -Z_MAX) - (dir * t * Z_MAX);
 
        camera.save();
        camera.rotateZ(t * 360);
        camera.translate(0.0F, 0.0F, z);
        camera.getMatrix(xform);
        camera.restore();
 
        xform.preTranslate(-xCenter, -yCenter);
        xform.postTranslate(xCenter, yCenter);
    } 
 
    /** 
     * @see android.view.animation.Animation.AnimationListener 
     *      #onAnimationEnd(android.view.animation.Animation) 
     */ 
    @Override 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMatrix, restore, rotateY, save, translate
		mCoveflowCenter = getCenterOfCoverflow();
		super.onSizeChanged(w, h, oldw, oldh);
	} 
 
	private void transformImageBitmap(RelativeLayout child, Transformation t, int rotationAngle) {
		mCamera.save();
		final Matrix imageMatrix = t.getMatrix();
		final int imageHeight = child.getLayoutParams().height;
		final int imageWidth = child.getLayoutParams().width;
		final int rotation = Math.abs(rotationAngle);
		mCamera.translate(0.0f, 0.0f, 100.0f);
		if (rotation < mMaxRotationAngle) {
			float zoomAmount = (float) (mMaxZoom + (rotation * 1.5));
			mCamera.translate(0.0f, 0.0f, zoomAmount);
		} 
		mCamera.rotateY(rotationAngle);
		mCamera.getMatrix(imageMatrix);
		imageMatrix.preTranslate(-(imageWidth / 2), -(imageHeight / 2));
		imageMatrix.postTranslate((imageWidth / 2), (imageHeight / 2));
		mCamera.restore();

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMatrix, restore, save, translate
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMatrix, restore, rotateY, save, translate
This code example shows how to use the following methods:getMatrix, restore, rotateY, save, translate
		mCoveflowCenter = getCenterOfCoverflow();
		super.onSizeChanged(w, h, oldw, oldh);
	} 
 
	private void transformImageBitmap(RelativeLayout child, Transformation t, int rotationAngle) {
		mCamera.save();
		final Matrix imageMatrix = t.getMatrix();
		final int imageHeight = child.getLayoutParams().height;
		final int imageWidth = child.getLayoutParams().width;
		final int rotation = Math.abs(rotationAngle);
		mCamera.translate(0.0f, 0.0f, 100.0f);
		if (rotation < mMaxRotationAngle) {
			float zoomAmount = (float) (mMaxZoom + (rotation * 1.5));
			mCamera.translate(0.0f, 0.0f, zoomAmount);
		} 
		mCamera.rotateY(rotationAngle);
		mCamera.getMatrix(imageMatrix);
		imageMatrix.preTranslate(-(imageWidth / 2), -(imageHeight / 2));
		imageMatrix.postTranslate((imageWidth / 2), (imageHeight / 2));
		mCamera.restore();

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMatrix, restore, rotateX, rotateY, save
 
		//solve for t: d = r*cos(t) 
		double radians = Math.acos((float) d / r);
		double degree = 90 - (180 / Math.PI) * radians;
 
		mCamera.save();
		mCamera.translate(0, 0, r-translateZ);
		mCamera.rotateX((float) degree); 
		if (distanceY < 0) {
			degree = 360 - degree;
		} 
		mCamera.rotateY((float) degree);
		mCamera.getMatrix(outMatrix);
		mCamera.restore();
		 
		// highlight elements in the middle 
		mPaint.setColorFilter(calculateLight((float) degree));
	} 
 
	private Bitmap getChildDrawingCache(final View child){
7
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android Camera Questions & Answers:

See Code Examples for Android Camera Methods: