1 /* 2 * Copyright (c) 2024-2024 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 #include "photo_native_impl.h" 17 #include "camera_log.h" 18 #include "image_kits.h" 19 20 using namespace OHOS; 21 OH_PhotoNative()22OH_PhotoNative::OH_PhotoNative() 23 { 24 MEDIA_DEBUG_LOG("OH_PhotoNative Constructor is called"); 25 } 26 ~OH_PhotoNative()27OH_PhotoNative::~OH_PhotoNative() 28 { 29 MEDIA_DEBUG_LOG("~OH_PhotoNative is called"); 30 if (mainImage_) { 31 mainImage_->release(); 32 mainImage_ = nullptr; 33 } 34 35 if (rawImage_) { 36 rawImage_->release(); 37 rawImage_ = nullptr; 38 } 39 } 40 GetMainImage(OH_ImageNative ** mainImage)41Camera_ErrorCode OH_PhotoNative::GetMainImage(OH_ImageNative** mainImage) 42 { 43 OH_ImageNative *imageNative = new OH_ImageNative; 44 imageNative->imgNative = mainImage_.get(); 45 *mainImage = imageNative; 46 return CAMERA_OK; 47 } 48 SetMainImage(std::shared_ptr<OHOS::Media::NativeImage> & mainImage)49void OH_PhotoNative::SetMainImage(std::shared_ptr<OHOS::Media::NativeImage> &mainImage) 50 { 51 mainImage_ = mainImage; 52 } 53 SetRawImage(std::shared_ptr<OHOS::Media::NativeImage> & rawImage)54void OH_PhotoNative::SetRawImage(std::shared_ptr<OHOS::Media::NativeImage> &rawImage) 55 { 56 rawImage_ = rawImage; 57 } 58