1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.camera.one.v2.photo;
18
19import com.android.camera.app.OrientationManager;
20
21import com.google.common.base.Supplier;
22
23/**
24 * Based on the current device orientation, calculates the JPEG rotation that
25 * needs to be applied to render the resulting JPEG correctly.
26 */
27public interface ImageRotationCalculator {
28
29    /**
30     * Calculates the correct JPEG orientation based on the given sampled device
31     * orientation, and the sensor orientation.
32     *
33     * @return The JPEG rotation that needs to be applied to the final image.
34     */
35    public OrientationManager.DeviceOrientation toImageRotation();
36
37    /**
38     * Returns a supplier of the correct JPEG orientation based on the
39     * sampled device orientation and the sensor orientation.
40     *
41     * @return Supplier of the JPEG rotation that needs to be applied to the
42     *         final image in degrees.
43     */
44    public Supplier<Integer> getSupplier();
45}
46