common: code refactoring
[platform/core/graphics/tizenvg.git] / src / lib / tvgPaint.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef _TVG_PAINT_CPP_
18 #define _TVG_PAINT_CPP_
19
20 #include "tvgCommon.h"
21
22 /************************************************************************/
23 /* Internal Class Implementation                                        */
24 /************************************************************************/
25
26 Paint :: Paint() : pImpl(make_unique<Impl>())
27 {
28 }
29
30
31 Paint :: ~Paint()
32 {
33 }
34
35
36 /************************************************************************/
37 /* External Class Implementation                                        */
38 /************************************************************************/
39
40 Result Paint::rotate(float degree) noexcept
41 {
42     if (IMPL->ts->rotate(degree)) return Result::Success;
43     return Result::FailedAllocation;
44 }
45
46
47 Result Paint::scale(float factor) noexcept
48 {
49     if (IMPL->ts->scale(factor)) return Result::Success;
50     return Result::FailedAllocation;
51 }
52
53
54 Result Paint::translate(float x, float y) noexcept
55 {
56     if (IMPL->ts->translate(x, y)) return Result::Success;
57     return Result::FailedAllocation;
58 }
59
60
61 Result Paint::transform(const Matrix& m) noexcept
62 {
63     if (IMPL->ts->transform(m)) return Result::Success;
64     return Result::FailedAllocation;
65 }
66
67
68 Result Paint::bounds(float* x, float* y, float* w, float* h) const noexcept
69 {
70     if (IMPL->ts->bounds(x, y, w, h)) return Result::Success;
71     return Result::InsufficientCondition;
72 }
73
74 #endif //_TVG_PAINT_CPP_