• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #ifndef MATRIX_IMPL_H
17 #define MATRIX_IMPL_H
18 
19 #include <vector>
20 
21 #include "base_impl.h"
22 
23 #include "utils/point.h"
24 #include "utils/scalar.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 namespace Drawing {
29 class Matrix;
30 class MatrixImpl : public BaseImpl {
31 public:
32     static inline constexpr AdapterType TYPE = AdapterType::BASE_INTERFACE;
MatrixImpl()33     MatrixImpl() {}
~MatrixImpl()34     ~MatrixImpl() override {}
GetType()35     AdapterType GetType() const override
36     {
37         return AdapterType::BASE_INTERFACE;
38     }
39 
40     virtual void Rotate(scalar degree, scalar px, scalar py) = 0;
41     virtual void Translate(scalar dx, scalar dy) = 0;
42     virtual void Scale(scalar sx, scalar sy, scalar px, scalar py) = 0;
43     virtual void Multiply(const Matrix& a, const Matrix& b) = 0;
44     virtual bool Equals(const Matrix& a, const Matrix& b) const = 0;
45     virtual void SetMatrix(scalar scaleX, scalar skewX, scalar transX, scalar skewY, scalar scaleY, scalar transY,
46         scalar persp0, scalar persp1, scalar persp2) = 0;
47     virtual void MapPoints(std::vector<Point>& dst, const std::vector<Point>& src, uint32_t count) const;
48     virtual scalar Get(int index) const = 0;
49 };
50 } // namespace Drawing
51 } // namespace Rosen
52 } // namespace OHOS
53 #endif
54