1 /*
2  * Copyright (c) 2023 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 MATRIX44_IMPL_H
17 #define MATRIX44_IMPL_H
18 
19 #include <array>
20 
21 #include "base_impl.h"
22 #include "utils/scalar.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 namespace Drawing {
27 class Matrix;
28 class Matrix44;
29 class Matrix44Impl : public BaseImpl {
30 public:
31     // Matrix44 is a 4x4 float type matrix.
32     constexpr static int MATRIX44_SIZE = 16;
33 
Matrix44Impl()34     Matrix44Impl() {}
~Matrix44Impl()35     ~Matrix44Impl() override {}
36 
37     virtual void Translate(scalar dx, scalar dy, scalar dz) = 0;
38     virtual void Scale(scalar sx, scalar sy, scalar sz) = 0;
39     virtual void PreTranslate(scalar dx, scalar dy, scalar dz);
40     virtual void PostTranslate(scalar dx, scalar dy, scalar dz);
41     virtual void PreScale(scalar sx, scalar sy, scalar sz);
42     virtual void Multiply(const Matrix44& a, const Matrix44& b) = 0;
43     virtual void SetMatrix44ColMajor(const std::array<scalar, MATRIX44_SIZE>& buffer) = 0;
44     virtual void SetMatrix44RowMajor(const std::array<scalar, MATRIX44_SIZE>& buffer) = 0;
45     virtual Matrix ConvertToMatrix() = 0;
46     virtual void SetCol(int column, scalar x, scalar y, scalar z, scalar w) = 0;
47 };
48 } // namespace Drawing
49 } // namespace Rosen
50 } // namespace OHOS
51 #endif
52