1 /* 2 * Copyright (C) 2021 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 #ifndef FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_PACKER_NATIVE_IMPL_H 16 #define FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_PACKER_NATIVE_IMPL_H 17 #include <stdint.h> 18 #include "image_packer.h" 19 #include "image_source_native.h" 20 #include "pixelmap_native.h" 21 #include "picture_native.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 struct OH_ImagePackerNative { 28 public: 29 OH_ImagePackerNative(); 30 OH_ImagePackerNative(std::shared_ptr<OHOS::Media::ImagePacker> imagePacker); 31 ~OH_ImagePackerNative(); 32 33 int32_t PackingFromImageSource(OHOS::Media::PackOption *option, struct OH_ImageSourceNative *imageSource, 34 uint8_t *outData, int64_t *size); 35 36 int32_t PackingFromPixelmap(OHOS::Media::PackOption *option, struct OH_PixelmapNative *pixelmap, 37 uint8_t *outData, int64_t *size); 38 39 int32_t PackToDataFromPicture(OHOS::Media::PackOption *option, struct OH_PictureNative *picture, 40 uint8_t *outData, int64_t *size); 41 42 int32_t PackToFileFromImageSource(OHOS::Media::PackOption *option, struct OH_ImageSourceNative *imageSource, 43 const int fd); 44 45 int32_t PackToFileFromPixelmap(OHOS::Media::PackOption *option, struct OH_PixelmapNative *pixelmap, 46 const int32_t fd); 47 48 int32_t PackToFileFromPicture(OHOS::Media::PackOption *option, struct OH_PictureNative *picture, 49 const int32_t fd); 50 51 std::shared_ptr<OHOS::Media::ImagePacker> GetInnerImagePacker(); 52 53 private: 54 std::shared_ptr<OHOS::Media::ImagePacker> imagePacker_; 55 }; 56 57 #ifdef __cplusplus 58 }; 59 #endif 60 /** @} */ 61 #endif // FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_PACKER_NATIVE_IMPL_H