• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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()22 OH_PhotoNative::OH_PhotoNative()
23 {
24     MEDIA_DEBUG_LOG("OH_PhotoNative Constructor is called");
25 }
26 
~OH_PhotoNative()27 OH_PhotoNative::~OH_PhotoNative()
28 {
29     MEDIA_DEBUG_LOG("~OH_PhotoNative is called");
30     if (mainImage_) {
31         mainImage_->release();
32         mainImage_ = nullptr;
33     }
34 
35     CHECK_RETURN(!rawImage_);
36     rawImage_->release();
37     rawImage_ = nullptr;
38 }
39 
GetMainImage(OH_ImageNative ** mainImage)40 Camera_ErrorCode OH_PhotoNative::GetMainImage(OH_ImageNative** mainImage)
41 {
42     OH_ImageNative *imageNative = new OH_ImageNative;
43     imageNative->imgNative = mainImage_.get();
44     *mainImage = imageNative;
45     return CAMERA_OK;
46 }
47 
SetMainImage(const std::shared_ptr<OHOS::Media::NativeImage> & mainImage)48 void OH_PhotoNative::SetMainImage(const std::shared_ptr<OHOS::Media::NativeImage> &mainImage)
49 {
50     mainImage_ = mainImage;
51 }
52 
SetRawImage(const std::shared_ptr<OHOS::Media::NativeImage> & rawImage)53 void OH_PhotoNative::SetRawImage(const std::shared_ptr<OHOS::Media::NativeImage> &rawImage)
54 {
55     rawImage_ = rawImage;
56 }
57