1 /*
2  * Copyright (C) 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 "mock_picture.h"
17 #include "exif_metadata.h"
18 #include "surface_buffer.h"
19 
20 namespace OHOS {
21 namespace Media {
22 namespace Effect {
23 constexpr uint32_t HALF = 2;
24 const std::string IMAGE_LENGTH = "ImageLength";
25 const std::string IMAGE_WIDTH = "ImageWidth";
26 
MockPicture()27 MockPicture::MockPicture()
28 {
29     mainPixelMap_ = std::make_shared<MockPixelMap>();
30 
31     mockGainmapPixelMap_ =
32         std::make_shared<MockPixelMap>(mainPixelMap_->GetWidth() / HALF, mainPixelMap_->GetHeight() / HALF);
33     mockGainmapAuxiliaryPicture_ = std::make_shared<AuxiliaryPicture>();
34     mockGainmapAuxiliaryPicture_->content_ = mockGainmapPixelMap_;
35     auxiliaryPictures_.emplace(AuxiliaryPictureType::GAINMAP, mockGainmapAuxiliaryPicture_);
36 
37     exifMetadata_ = std::make_shared<ExifMetadata>();
38     exifMetadata_->SetValue(IMAGE_LENGTH, std::to_string(mainPixelMap_->GetHeight()));
39     exifMetadata_->SetValue(IMAGE_WIDTH, std::to_string(mainPixelMap_->GetWidth()));
40 }
41 } // namespace Effect
42 } // namespace Media
43 } // namespace OHOS