• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  * epfs.h, keep same with fs/epfs/epfs.h
16  *
17  */
18 
19 #ifndef OHOS_MEDIALIBRARY_EXIF_ROTATE_UTILS_H
20 #define OHOS_MEDIALIBRARY_EXIF_ROTATE_UTILS_H
21 
22 #include <string>
23 
24 namespace OHOS {
25 namespace Media {
26 #define EXPORT __attribute__ ((visibility ("default")))
27 
28 enum class ExifRotateType : int32_t {
29     TOP_LEFT = 1,
30     TOP_RIGHT = 2,
31     BOTTOM_RIGHT = 3,
32     BOTTOM_LEFT = 4,
33     LEFT_TOP = 5,
34     RIGHT_TOP = 6,
35     RIGHT_BOTTOM = 7,
36     LEFT_BOTTOM = 8,
37 };
38 
39 struct FlipAndRotateInfo {
40     bool isLeftAndRightFlip {false};
41     bool isUpAndDownFlip {false};
42     int32_t orientation {0};
43 };
44 
45 class EXPORT ExifRotateUtils {
46 public:
47     ExifRotateUtils() = delete;
48     virtual ~ExifRotateUtils() = delete;
49 
50     static bool ConvertOrientationKeyToExifRotate(const std::string &key, int32_t &exifRotate);
51     static bool ConvertOrientationToExifRotate(int32_t orientation, int32_t &exifRotate);
52     static bool IsExifRotateWithFlip(int32_t exifRotate);
53     static bool GetFlipAndRotateInfo(int32_t exifRotate, FlipAndRotateInfo &info);
54 };
55 } // namespace Media
56 } // namespace OHOS
57 #endif // OHOS_MEDIALIBRARY_EXIF_ROTATE_UTILS_H