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 16 #ifndef FRAMEWORKS_INNERKITSIMPL_MEDIA_LIBRARY_INCLUDE_MEDIA_IMAGE_FRAMEWORK_UTILS_H_ 17 #define FRAMEWORKS_INNERKITSIMPL_MEDIA_LIBRARY_INCLUDE_MEDIA_IMAGE_FRAMEWORK_UTILS_H_ 18 19 #include "image_source.h" 20 #include "picture.h" 21 22 #include "exif_rotate_utils.h" 23 24 namespace OHOS { 25 namespace Media { 26 #define EXPORT __attribute__ ((visibility ("default"))) 27 28 class EXPORT MediaImageFrameWorkUtils { 29 public: 30 MediaImageFrameWorkUtils() = delete; 31 virtual ~MediaImageFrameWorkUtils() = delete; 32 33 static int32_t GetExifRotate(const std::unique_ptr<ImageSource> &imageSource, int32_t &exifRotate); 34 static int32_t GetOrientationKey(const std::unique_ptr<ImageSource> &imageSource, std::string &orientationKey); 35 static int32_t GetExifRotate(const std::shared_ptr<Picture> picture, int32_t &exifRotate); 36 static int32_t GetOrientationKey(const std::shared_ptr<Picture> picture, std::string &orientationKey); 37 static int32_t GetExifRotate(const std::string &path, int32_t &exifRotate); 38 static bool FlipAndRotatePixelMap(PixelMap &pixelMap, int32_t exifRotate); 39 static bool FlipAndRotatePixelMap(PixelMap &pixelMap, const FlipAndRotateInfo &info); 40 }; 41 } // namespace Media 42 } // namespace OHOS 43 44 #endif // FRAMEWORKS_INNERKITSIMPL_MEDIA_LIBRARY_INCLUDE_MEDIA_IMAGE_FRAMEWORK_UTILS_H_