[Tizen] Make possible to capture on the old driver devices.
[platform/core/uifw/dali-adaptor.git] / dali / public-api / capture / capture.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/capture/capture.h>
20
21 // INTERNAL HEADER
22 #include <dali/internal/system/common/capture-impl.h>
23
24 namespace Dali
25 {
26 Capture::Capture()
27 {
28 }
29
30 Capture Capture::New()
31 {
32   Internal::Adaptor::CapturePtr internal = Internal::Adaptor::Capture::New();
33
34   return Capture(internal.Get());
35 }
36
37 Capture Capture::New(Dali::CameraActor cameraActor)
38 {
39   Internal::Adaptor::CapturePtr internal = Internal::Adaptor::Capture::New(cameraActor);
40
41   return Capture(internal.Get());
42 }
43
44 Capture Capture::DownCast(BaseHandle handle)
45 {
46   return Capture(dynamic_cast<Internal::Adaptor::Capture*>(handle.GetObjectPtr()));
47 }
48
49 Capture::~Capture()
50 {
51 }
52
53 Capture::Capture(const Capture& copy) = default;
54
55 Capture& Capture::operator=(const Capture& rhs) = default;
56
57 Capture::Capture(Capture&& rhs) = default;
58
59 Capture& Capture::operator=(Capture&& rhs) = default;
60
61 void Capture::Start(Actor source, const Vector2& position, const Vector2& size, const std::string& path, const Vector4& clearColor)
62 {
63   GetImpl(*this).Start(source, position, size, path, clearColor);
64 }
65
66 void Capture::Start(Actor source, const Vector2& size, const std::string& path, const Vector4& clearColor, const uint32_t quality)
67 {
68   GetImpl(*this).Start(source, Vector2::ZERO, size, path, clearColor, quality);
69 }
70
71 void Capture::Start(Actor source, const Vector2& size, const std::string& path, const Vector4& clearColor)
72 {
73   GetImpl(*this).Start(source, Vector2::ZERO, size, path, clearColor);
74 }
75
76 void Capture::Start(Actor source, const Vector2& size, const std::string& path)
77 {
78   GetImpl(*this).Start(source, Vector2::ZERO, size, path, Dali::Color::TRANSPARENT);
79 }
80
81 void Capture::SetImageQuality(uint32_t quality)
82 {
83   return GetImpl(*this).SetImageQuality(quality);
84 }
85
86 Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const
87 {
88   return GetImpl(*this).GetNativeImageSource();
89 }
90
91 Dali::Texture Capture::GetTexture()
92 {
93   return GetImpl(*this).GetTexture();
94 }
95
96 Capture::CaptureFinishedSignalType& Capture::FinishedSignal()
97 {
98   return GetImpl(*this).FinishedSignal();
99 }
100
101 Capture::Capture(Internal::Adaptor::Capture* internal)
102 : BaseHandle(internal)
103 {
104 }
105
106 } // namespace Dali