Java Code Examples for android.view.Surface#ROTATION_180

The following examples show how to use android.view.Surface#ROTATION_180 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrientationModule.java    From react-native-orientation-locker with MIT License 6 votes vote down vote up
private String getCurrentOrientation() {

        final Display display = ((WindowManager) getReactApplicationContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();

        switch (display.getRotation()) {
            case Surface.ROTATION_0:
                return "PORTRAIT";
            case Surface.ROTATION_90:
                return "LANDSCAPE-LEFT";
            case Surface.ROTATION_180:
                return "PORTRAIT-UPSIDEDOWN";
            case Surface.ROTATION_270:
                return "LANDSCAPE-RIGHT";
        }
        return "UNKNOWN";
    }
 
Example 2
Source File: SurfaceRotation.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Get the int value degree of a rotation from the {@link Surface} constants.
 *
 * <p>Valid values for the relative rotation are {@link Surface#ROTATION_0}, {@link
 *      * Surface#ROTATION_90}, {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
 */
static int rotationDegreesFromSurfaceRotation(int rotationConstant) {
    switch (rotationConstant) {
        case Surface.ROTATION_0:
            return 0;
        case Surface.ROTATION_90:
            return 90;
        case Surface.ROTATION_180:
            return 180;
        case Surface.ROTATION_270:
            return 270;
        default:
            throw new UnsupportedOperationException(
                    "Unsupported surface rotation constant: " + rotationConstant);
    }
}
 
Example 3
Source File: Util.java    From FFmpegRecorder with GNU General Public License v3.0 6 votes vote down vote up
public static int getRotationAngle(int rotation)
{
	int degrees  = 0;
	switch (rotation) {
	case Surface.ROTATION_0:
		degrees = 0;
		break;

	case Surface.ROTATION_90:
		degrees = 90;
		break;

	case Surface.ROTATION_180:
		degrees = 180;
		break;

	case Surface.ROTATION_270:
		degrees = 270;
		break;
	}
	return degrees;
}
 
Example 4
Source File: MainActivity.java    From Camera2App with Apache License 2.0 6 votes vote down vote up
private void configurePreviewTransform(int viewWidth, int viewHeight) {
    if (null == mTextureView || null == mPreviewSize) {
        return;
    }
    int rotation = getWindowManager().getDefaultDisplay().getRotation();
    Matrix matrix = new Matrix();
    RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
    RectF bufferRect = new RectF(0, 0, mPreviewSize.getHeight(), mPreviewSize.getWidth());
    float centerX = viewRect.centerX();
    float centerY = viewRect.centerY();
    if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
        bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
        matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
        float scale = Math.max(
                (float) viewHeight / mPreviewSize.getHeight(),
                (float) viewWidth / mPreviewSize.getWidth());
        matrix.postScale(scale, scale, centerX, centerY);
        matrix.postRotate(90 * (rotation - 2), centerX, centerY);
    } else if (Surface.ROTATION_180 == rotation) {
        matrix.postRotate(180, centerX, centerY);
    }
    mTextureView.setTransform(matrix);
}
 
Example 5
Source File: FaceCapturer.java    From rubik-robot with MIT License 5 votes vote down vote up
public static int getCameraRotation(Activity activity, int cameraId, android.hardware.Camera camera) {
    android.hardware.Camera.CameraInfo info =
            new android.hardware.Camera.CameraInfo();
    android.hardware.Camera.getCameraInfo(cameraId, info);
    int rotation = activity.getWindowManager().getDefaultDisplay()
            .getRotation();
    int degrees = 0;
    switch (rotation) {
        case Surface.ROTATION_0:
            degrees = 0;
            break;
        case Surface.ROTATION_90:
            degrees = 90;
            break;
        case Surface.ROTATION_180:
            degrees = 180;
            break;
        case Surface.ROTATION_270:
            degrees = 270;
            break;
    }

    int result;
    if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
        result = (info.orientation + degrees) % 360;
        result = (360 - result) % 360;  // compensate the mirror
    } else {  // back-facing
        result = (info.orientation - degrees + 360) % 360;
    }

    return result;
}
 
Example 6
Source File: CameraActivity.java    From next18-ai-in-motion with Apache License 2.0 5 votes vote down vote up
protected int getScreenOrientation() {
    switch (getWindowManager().getDefaultDisplay().getRotation()) {
        case Surface.ROTATION_270:
            return 270;
        case Surface.ROTATION_180:
            return 180;
        case Surface.ROTATION_90:
            return 90;
        default:
            return 0;
    }
}
 
Example 7
Source File: CameraTexture.java    From PHONK with GNU General Public License v3.0 5 votes vote down vote up
public void setCameraDisplayOrientation(int cameraId, android.hardware.Camera camera) {
    android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
    android.hardware.Camera.getCameraInfo(cameraId, info);

    WindowManager windowManager = (WindowManager) mAppRunner.getAppContext().getSystemService(Context.WINDOW_SERVICE);
    int rotation = windowManager.getDefaultDisplay().getRotation();

    int degrees = 0;
    switch (rotation) {
        case Surface.ROTATION_0:
            degrees = 0;
            break;
        case Surface.ROTATION_90:
            degrees = 90;
            break;
        case Surface.ROTATION_180:
            degrees = 180;
            break;
        case Surface.ROTATION_270:
            degrees = 270;
            break;
    }

    int result;
    if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
        result = (info.orientation + degrees) % 360;
        result = (360 - result) % 360;  // compensate the mirror
    } else {  // back-facing
        result = (info.orientation - degrees + 360) % 360;
    }

    mCameraRotation = result;
    MLog.d("wewe", "" + mCameraRotation);
    camera.setDisplayOrientation(mCameraRotation);
}
 
Example 8
Source File: EBrowserActivity.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
private int getOrientationForRotation() {
    int ori = ActivityInfo.SCREEN_ORIENTATION_USER;
    int rotation = this.getWindowManager().getDefaultDisplay().getRotation();
    if (rotation == Surface.ROTATION_0) {
        ori = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else if (rotation == Surface.ROTATION_90) {
        ori = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (rotation == Surface.ROTATION_180) {
        ori = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    } else if (rotation == Surface.ROTATION_270) {
        ori = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    }
    return ori;
}
 
Example 9
Source File: Launcher.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
private int mapConfigurationOriActivityInfoOri(int configOri) {
	final Display d = getWindowManager().getDefaultDisplay();
	int naturalOri = Configuration.ORIENTATION_LANDSCAPE;
	switch (d.getRotation()) {
	case Surface.ROTATION_0:
	case Surface.ROTATION_180:
		// We are currently in the same basic orientation as the natural
		// orientation
		naturalOri = configOri;
		break;
	case Surface.ROTATION_90:
	case Surface.ROTATION_270:
		// We are currently in the other basic orientation to the natural
		// orientation
		naturalOri = (configOri == Configuration.ORIENTATION_LANDSCAPE) ? Configuration.ORIENTATION_PORTRAIT
				: Configuration.ORIENTATION_LANDSCAPE;
		break;
	}

	int[] oriMap = { ActivityInfo.SCREEN_ORIENTATION_PORTRAIT,
			ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE,
			ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT,
			ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE };
	// Since the map starts at portrait, we need to offset if this device's
	// natural orientation
	// is landscape.
	int indexOffset = 0;
	if (naturalOri == Configuration.ORIENTATION_LANDSCAPE) {
		indexOffset = 1;
	}
	return oriMap[(d.getRotation() + indexOffset) % 4];
}
 
Example 10
Source File: AutomatonThread.java    From GameOfLife with MIT License 5 votes vote down vote up
private Point reverseTranslate(Point p) {
    switch (screenOrientation) {
        case Surface.ROTATION_0: return p;
        case Surface.ROTATION_90: return new Point(automatonSizeX - p.y, p.x);
        case Surface.ROTATION_180: return new Point(automatonSizeY - p.x, automatonSizeX - p.y);
        case Surface.ROTATION_270: return new Point(p.y, automatonSizeY - p.x);

        default:
            throw new AssertionError();
    }
}
 
Example 11
Source File: CameraPreview.java    From Self-Driving-Car with MIT License 5 votes vote down vote up
/**
 * Calculate the correct orientation for a {@link Camera} preview that is displayed on screen.
 * <p>
 * Implementation is based on the sample code provided in
 * {@link Camera#setDisplayOrientation(int)}.
 */
public static int calculatePreviewOrientation(Camera.CameraInfo info, int rotation) {
    int degrees = 0;

    switch (rotation) {
        case Surface.ROTATION_0:
            degrees = 0;
            break;
        case Surface.ROTATION_90:
            degrees = 90;
            break;
        case Surface.ROTATION_180:
            degrees = 180;
            break;
        case Surface.ROTATION_270:
            degrees = 270;
            break;
    }

    int result;
    if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
        result = (info.orientation + degrees) % 360;
        result = (360 - result) % 360;  // compensate the mirror
    } else {  // back-facing
        result = (info.orientation - degrees + 360) % 360;
    }

    return result;
}
 
Example 12
Source File: CameraPreview.java    From meatspace-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void configureCameraParameters(Camera.Parameters cameraParams, boolean portrait) {

        Display display = ((Activity) context).getWindowManager().getDefaultDisplay();
        switch (display.getRotation()) {
            case Surface.ROTATION_0: // This is display orientation
                angle = 90; // This is camera orientation
                break;
            case Surface.ROTATION_90:
                angle = 0;
                break;
            case Surface.ROTATION_180:
                angle = 270;
                break;
            case Surface.ROTATION_270:
                angle = 180;
                break;
            default:
                angle = 90;
                break;
        }
        camera.setDisplayOrientation(angle);

        cameraParams.setPreviewSize(previewSize.width, previewSize.height);
        cameraParams.setPictureSize(pictureSize.width, pictureSize.height);

        camera.setParameters(cameraParams);
    }
 
Example 13
Source File: Camera1Controller.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private int convertRotationToDegrees(int screenRotation) {
  switch (screenRotation) {
    case Surface.ROTATION_0:   return 0;
    case Surface.ROTATION_90:  return 90;
    case Surface.ROTATION_180: return 180;
    case Surface.ROTATION_270: return 270;
  }
  return 0;
}
 
Example 14
Source File: CameraSource.java    From quickstart-android with Apache License 2.0 4 votes vote down vote up
/**
 * Calculates the correct rotation for the given camera id and sets the rotation in the
 * parameters. It also sets the camera's display orientation and rotation.
 *
 * @param parameters the camera parameters for which to set the rotation
 * @param cameraId the camera id to set rotation based on
 */
private void setRotation(Camera camera, Camera.Parameters parameters, int cameraId) {
  WindowManager windowManager = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
  int degrees = 0;
  int rotation = windowManager.getDefaultDisplay().getRotation();
  switch (rotation) {
    case Surface.ROTATION_0:
      degrees = 0;
      break;
    case Surface.ROTATION_90:
      degrees = 90;
      break;
    case Surface.ROTATION_180:
      degrees = 180;
      break;
    case Surface.ROTATION_270:
      degrees = 270;
      break;
    default:
      Log.e(TAG, "Bad rotation value: " + rotation);
  }

  CameraInfo cameraInfo = new CameraInfo();
  Camera.getCameraInfo(cameraId, cameraInfo);

  int angle;
  int displayAngle;
  if (cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
    angle = (cameraInfo.orientation + degrees) % 360;
    displayAngle = (360 - angle) % 360; // compensate for it being mirrored
  } else { // back-facing
    angle = (cameraInfo.orientation - degrees + 360) % 360;
    displayAngle = angle;
  }

  // This corresponds to the rotation constants.
  this.rotation = angle / 90;
  Log.d(TAG, "Display rotation is: " + rotation);
  Log.d(TAG, "Camera face is: " + cameraInfo.facing);
  Log.d(TAG, "Camera rotation is: " + cameraInfo.orientation);
  Log.d(TAG, "Rotation is: " + this.rotation);

  camera.setDisplayOrientation(displayAngle);
  parameters.setRotation(angle);
}
 
Example 15
Source File: AdvCamera.java    From adv_camera with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private int setCameraDisplayOrientation(int cameraId) {
    Camera.CameraInfo info = new Camera.CameraInfo();
    Camera.getCameraInfo(cameraId, info);

    int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();

    if (Build.MODEL.equalsIgnoreCase("Nexus 6") && cameraFacing == 1) {
        rotation = Surface.ROTATION_180;
    }

    int degrees = 0;
    switch (rotation) {

        case Surface.ROTATION_0:
            degrees = 0;
            break;
        case Surface.ROTATION_90:
            degrees = 90;
            break;
        case Surface.ROTATION_180:
            degrees = 180;
            break;
        case Surface.ROTATION_270:
            degrees = 270;
            break;
    }

    int result;

    if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {

        result = (info.orientation + degrees) % 360;
        result = (360 - result) % 360; // compensate the mirror

    } else {
        result = (info.orientation - degrees + 360) % 360;

    }

    camera.setDisplayOrientation(result);

    return result;

}
 
Example 16
Source File: CameraSource.java    From VehicleInfoOCR with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Calculates the correct rotation for the given camera id and sets the rotation in the
 * parameters. It also sets the camera's display orientation and rotation.
 *
 * @param parameters the camera parameters for which to set the rotation
 * @param cameraId the camera id to set rotation based on
 */
private void setRotation(Camera camera, Camera.Parameters parameters, int cameraId) {
    // Does better job than firebase's rotation compensation : https://firebase.google.com/docs/ml-kit/android/recognize-text
    // as it also caters to front camera later
    // Note: Rotation anyway resets the activity!! So we can set it fine from onCreate

    WindowManager windowManager = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
    int degrees = 0;
    int rotation = windowManager.getDefaultDisplay().getRotation();
    switch (rotation) {
        case Surface.ROTATION_0:
            degrees = 0;
            break;
        case Surface.ROTATION_90:
            degrees = 90;
            break;
        case Surface.ROTATION_180:
            degrees = 180;
            break;
        case Surface.ROTATION_270:
            degrees = 270;
            break;
        default:
            Log.e(TAG, "Bad rotation value: " + rotation);
    }

    CameraInfo cameraInfo = new CameraInfo();
    Camera.getCameraInfo(cameraId, cameraInfo);

    int angle;
    int displayAngle;
    if (cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
        angle = (cameraInfo.orientation + degrees) % 360;
        displayAngle = (360 - angle) % 360; // compensate for it being mirrored
    } else { // back-facing
        angle = (cameraInfo.orientation - degrees + 360) % 360;
        displayAngle = angle;
    }

    // This corresponds to the rotation constants.
    this.rotation = angle / 90;

    camera.setDisplayOrientation(displayAngle);
    parameters.setRotation(angle);
}
 
Example 17
Source File: GiraffePlayer.java    From IjkPlayerDemo with Apache License 2.0 4 votes vote down vote up
private int getScreenOrientation() {
    int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int width = dm.widthPixels;
    int height = dm.heightPixels;
    int orientation;
    // if the device's natural orientation is portrait:
    if ((rotation == Surface.ROTATION_0
            || rotation == Surface.ROTATION_180) && height > width ||
            (rotation == Surface.ROTATION_90
                    || rotation == Surface.ROTATION_270) && width > height) {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
        }
    }
    // if the device's natural orientation is landscape or if the device
    // is square:
    else {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
        }
    }

    return orientation;
}
 
Example 18
Source File: CustomMediaContoller.java    From MD with Apache License 2.0 4 votes vote down vote up
public int getScreenOrientation(Activity activity) {
    int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int width = dm.widthPixels;
    int height = dm.heightPixels;
    int orientation;
    // if the device's natural orientation is portrait:
    if ((rotation == Surface.ROTATION_0
            || rotation == Surface.ROTATION_180) && height > width ||
            (rotation == Surface.ROTATION_90
                    || rotation == Surface.ROTATION_270) && width > height) {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
        }
    }
    // if the device's natural orientation is landscape or if the device
    // is square:
    else {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
        }
    }

    return orientation;
}
 
Example 19
Source File: CameraSource.java    From fast_qr_reader_view with MIT License 4 votes vote down vote up
/**
 * Calculates the correct rotation for the given camera id and sets the rotation in the
 * parameters. It also sets the camera's display orientation and rotation.
 *
 * @param parameters the camera parameters for which to set the rotation
 * @param cameraId the camera id to set rotation based on
 */
private void setRotation(Camera camera, Camera.Parameters parameters, int cameraId) {
  WindowManager windowManager = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
  int degrees = 0;
  int rotation = windowManager.getDefaultDisplay().getRotation();
  switch (rotation) {
    case Surface.ROTATION_0:
      degrees = 0;
      break;
    case Surface.ROTATION_90:
      degrees = 90;
      break;
    case Surface.ROTATION_180:
      degrees = 180;
      break;
    case Surface.ROTATION_270:
      degrees = 270;
      break;
    default:
      Log.e(TAG, "Bad rotation value: " + rotation);
  }

  CameraInfo cameraInfo = new CameraInfo();
  Camera.getCameraInfo(cameraId, cameraInfo);

  int angle;
  int displayAngle;
  if (cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
    angle = (cameraInfo.orientation + degrees) % 360;
    displayAngle = (360 - angle) % 360; // compensate for it being mirrored
  } else { // back-facing
    angle = (cameraInfo.orientation - degrees + 360) % 360;
    displayAngle = angle;
  }

  // This corresponds to the rotation constants.
  this.rotation = angle / 90;

  camera.setDisplayOrientation(displayAngle);
  parameters.setRotation(angle);
}
 
Example 20
Source File: CameraSource.java    From ETHWallet with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Calculates the correct rotation for the given camera id and sets the rotation in the
 * parameters.  It also sets the camera's display orientation and rotation.
 *
 * @param parameters the camera parameters for which to set the rotation
 * @param cameraId   the camera id to set rotation based on
 */
private void setRotation(Camera camera, Camera.Parameters parameters, int cameraId) {
    WindowManager windowManager =
            (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    int degrees = 0;
    int rotation = windowManager.getDefaultDisplay().getRotation();
    switch (rotation) {
        case Surface.ROTATION_0:
            degrees = 0;
            break;
        case Surface.ROTATION_90:
            degrees = 90;
            break;
        case Surface.ROTATION_180:
            degrees = 180;
            break;
        case Surface.ROTATION_270:
            degrees = 270;
            break;
        default:
            Log.e(TAG, "Bad rotation value: " + rotation);
    }

    CameraInfo cameraInfo = new CameraInfo();
    Camera.getCameraInfo(cameraId, cameraInfo);

    int angle;
    int displayAngle;
    if (cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
        angle = (cameraInfo.orientation + degrees) % 360;
        displayAngle = (360 - angle); // compensate for it being mirrored
    } else {  // back-facing
        angle = (cameraInfo.orientation - degrees + 360) % 360;
        displayAngle = angle;
    }

    // This corresponds to the rotation constants in {@link Frame}.
    mRotation = angle / 90;

    camera.setDisplayOrientation(displayAngle);
    parameters.setRotation(angle);
}